Difference between revisions of "Rocking FPGA SAO Installation"
(→Test using wishbone bus via shell commands) |
|||
(11 intermediate revisions by 2 users not shown) | |||
Line 35: | Line 35: | ||
sudo apt-get install python3-venv | sudo apt-get install python3-venv | ||
sudo apt-get install meson # ninja-build | sudo apt-get install meson # ninja-build | ||
+ | |||
+ | = Download YoSYS FPGA EDA tools from https://github.com/YosysHQ = | ||
+ | |||
+ | OS_TYPE=linux # or darwin or windows | ||
+ | wget https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2021-05-29/oss-cad-suite-$OS_TYPE-x64-20210529.tgz | ||
+ | tar -zxpf oss-cad-suite-$OS_TYPE-x64-20210529.tgz | ||
+ | mv oss-cad-suite-$OS_TYPE-x64 oss-cad-suite | ||
+ | |||
+ | = Download FOMU development tool chain, includes RISC-V cross-compiling toolchain = | ||
+ | |||
+ | wget https://github.com/im-tomu/fomu-toolchain/releases/download/v1.6/fomu-toolchain-Linux.tar.gz | ||
+ | tar -zxpf ../fomu-toolchain-Linux.tar.gz | ||
= Download and install FPGA development software = | = Download and install FPGA development software = | ||
Line 62: | Line 74: | ||
# python rockling.py | # python rockling.py | ||
− | = Download FPGA gateware (bitstream) on to | + | = Download FPGA gateware (bitstream) on to Rockling SAO = |
+ | |||
+ | Connect Rockling FPGA SAO to USB host port: Fish eye should be slowly pulsing with cyan color | ||
+ | |||
+ | /usr/bin/dfu-util -l | ||
+ | |||
+ | Fish eye will quickly pulse with green color | ||
+ | |||
+ | /usr/bin/dfu-util -D build/rockling/gateware/rockling.bin | ||
+ | |||
+ | Upon success fish eye will quickly pulse with white color or upon failure quickly pulse with red color | ||
+ | |||
+ | Rockling should be now running the RISC-V processor with firmware running on top of that | ||
+ | |||
+ | = Test to see correct firmware "debug_status" = | ||
+ | |||
+ | riscv64-unknown-elf-readelf -s build/rockling/software/bios/bios.elf | egrep '(debug_status|global_counter)' | ||
+ | wishbone-tool 0x01000010 | ||
+ | INFO [wishbone_tool::bridge::usb] opened USB device device 120 on bus 001 | ||
+ | Value at 01000010: a0110060 # I2C DAC and Audio Codec found | ||
+ | Value at 01000010: a011ffff # Error: Only I2C Audio Codec found | ||
+ | Value at 01000010: ffff0060 # Error: I2C DAC found | ||
+ | Value at 01000010: ffffffff # Error: I2C no devices found | ||
+ | |||
+ | = Test using wishbone bus via shell commands = | ||
+ | |||
+ | Will show what I2C peripherals are available on I2C bus 1 ... Audio Codec and DAC | ||
+ | |||
+ | ./tools/i2c_probe.sh | ||
+ | |||
+ | = Test reading Theremin dual input frequency counting via Python script = | ||
+ | |||
+ | wishbone-tool --server=wishbone # terminal session 1 | ||
+ | python tools/read_freq.py # terminal session 2 | ||
+ | |||
+ | = Reset (reboot) Rockling FPGA = | ||
+ | |||
+ | Run this script or sometimes need to power cycle the hardware | ||
+ | |||
+ | ./tools/reboot.sh |
Latest revision as of 04:46, 13 March 2023
Contents
- 1 Overview
- 2 Set-up USB hot-plug UDEV rules (for Linux only)
- 3 Install DFU utility for flashing FPGA gateware (bitstream)
- 4 Install build tools
- 5 Download YoSYS FPGA EDA tools from https://github.com/YosysHQ
- 6 Download FOMU development tool chain, includes RISC-V cross-compiling toolchain
- 7 Download and install FPGA development software
- 8 Build Rockling FPGA gateware and firmware
- 9 Download FPGA gateware (bitstream) on to Rockling SAO
- 10 Test to see correct firmware "debug_status"
- 11 Test using wishbone bus via shell commands
- 12 Test reading Theremin dual input frequency counting via Python script
- 13 Reset (reboot) Rockling FPGA
Overview
GitHub repository: https://github.com/geekscape/ohmc2022-firmware
This project utilizes the excellent prior work from the FOMU FPGA project ... with substantial addition work by Andy Kitchen.
FPGA gateware and firmware for the Rockling FPGA SAO (codec branch) currently supports the Theremin input (dual input frequency counters), the FPGA running a soft RISC-V processor and hardware peripherals. However, the STGL-5000 audio codec IC integration is still a work-in-progress.
Set-up USB hot-plug UDEV rules (for Linux only)
When the Rockling is connected to the computer's USB port, the dynamically created device file /dev/bus/usb/001/...
will need to have the correct permissions set by the UDEV rules.
From FOMU workshop instructions
sudo groupadd plugdev sudo usermod -a -G plugdev $USER
Log out and log in again
sudo bash vi /etc/group # Add users to "plugdev:x:46:$USER" vi /etc/udev/rules.d/99-fomu.rules SUBSYSTEM=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="5bf0", MODE="0664", GROUP="plugdev" udevadm control --reload-rules udevadm trigger
Install DFU utility for flashing FPGA gateware (bitstream)
sudo apt-get install dfu-util # Avoid using FOMU ToolChain version dfu-util -l # Version 0.11
Install build tools
sudo apt-get update sudo apt-get install python3-venv sudo apt-get install meson # ninja-build
Download YoSYS FPGA EDA tools from https://github.com/YosysHQ
OS_TYPE=linux # or darwin or windows wget https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2021-05-29/oss-cad-suite-$OS_TYPE-x64-20210529.tgz tar -zxpf oss-cad-suite-$OS_TYPE-x64-20210529.tgz mv oss-cad-suite-$OS_TYPE-x64 oss-cad-suite
Download FOMU development tool chain, includes RISC-V cross-compiling toolchain
wget https://github.com/im-tomu/fomu-toolchain/releases/download/v1.6/fomu-toolchain-Linux.tar.gz tar -zxpf ../fomu-toolchain-Linux.tar.gz
Download and install FPGA development software
git clone https://github.com/geekscape/ohmc2022-firmware.git --branch codec cd ohmc2022-firmware git submodule update --init --recursive
Create and prepare virtual environment
rm -rf venv ./setup-venv.sh # Doesn't work if "oss-cad-suite/environment" and $PATH already set-up
Everything above here needs to be done just once ... now set-up and ready to go !
Build Rockling FPGA gateware and firmware
source venv/bin/activate
cd .. source oss-cad-suite/environment cd -
export PATH=$HOME/play/fpga/fomu/fomu-toolchain-linux_x86_64-v1.6/bin:$PATH
make all BITSTREAM_FLAGS="--with-analyzer" # python rockling.py
Download FPGA gateware (bitstream) on to Rockling SAO
Connect Rockling FPGA SAO to USB host port: Fish eye should be slowly pulsing with cyan color
/usr/bin/dfu-util -l
Fish eye will quickly pulse with green color
/usr/bin/dfu-util -D build/rockling/gateware/rockling.bin
Upon success fish eye will quickly pulse with white color or upon failure quickly pulse with red color
Rockling should be now running the RISC-V processor with firmware running on top of that
Test to see correct firmware "debug_status"
riscv64-unknown-elf-readelf -s build/rockling/software/bios/bios.elf | egrep '(debug_status|global_counter)' wishbone-tool 0x01000010 INFO [wishbone_tool::bridge::usb] opened USB device device 120 on bus 001 Value at 01000010: a0110060 # I2C DAC and Audio Codec found Value at 01000010: a011ffff # Error: Only I2C Audio Codec found Value at 01000010: ffff0060 # Error: I2C DAC found Value at 01000010: ffffffff # Error: I2C no devices found
Test using wishbone bus via shell commands
Will show what I2C peripherals are available on I2C bus 1 ... Audio Codec and DAC
./tools/i2c_probe.sh
Test reading Theremin dual input frequency counting via Python script
wishbone-tool --server=wishbone # terminal session 1 python tools/read_freq.py # terminal session 2
Reset (reboot) Rockling FPGA
Run this script or sometimes need to power cycle the hardware
./tools/reboot.sh