Difference between revisions of "Rocking FPGA SAO Installation"

From Open Hardware Miniconf
Jump to: navigation, search
Line 92: Line 92:
 
     python tools/i2c_probe.sh  
 
     python tools/i2c_probe.sh  
  
= Test reading Theremin dual input frequency counting
+
= Test reading Theremin dual input frequency counting via Python script =
  
 
     wishbone-tool --server=wishbone  # terminal session 1
 
     wishbone-tool --server=wishbone  # terminal session 1
 
     python tools/read_freq.py        # terminal session 2
 
     python tools/read_freq.py        # terminal session 2

Revision as of 19:48, 12 March 2023

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 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 Rocking 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

   python 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