This project consists of two software components: the PC application (written in C++/Qt) and the embedded VNA firmware (C/C++). The VNA firmware is further split into the MCU firmware and the FPGA configuration bitstream. Creating all the different parts from the source code requires quite a few tools:
- For building the PC application:
- Qt Creator (at least with Qt 5.9)
- libusb-1.0
- For building the VNA firmware:
- STM32CubeIDE: Code generator and IDE for STM32 microcontrollers
- For creating the FPGA bitstream:
- Xilinx ISE with support for Spartan 6 FPGA
- Install the required tools (Qt and libusb-1.0):
sudo apt-get install libusb-1.0-0-dev qt6-tools-dev qt6-base-dev
- Build the application:
- either:
cd Software/PC_Application qmake make
- or:
- Open Software/PC_Application/LibreVNA-GUI/LibreVNA-GUI.pro with Qt Creator
- Build the application with Qt Creator
- Importing the project (only has to be done once):
- Open STM32CubeIDE with the workspace set to Software/
- Import the project: File > Import... > General > Exisiting Projects into Workspace > Select root directory (should already be set to Software/) > Select the "VNA_embedded" project > Finish
- Build project: Project > Build Project
- Flashing/Debugging the MCU (only required once for a new hardware or when debugging):
- Create build configuration if it doesn't exist alreay: Run > Run configurations > Create new "STM32 Cortex-M C/C++ Application" > In tab "Main" select the compiled .elf-file
- Connect to the MCU with an ST-Link and the SWD pads on the PCB (requires removing the aluminium enclosure)
- Flash/debug: Run > Run or Run > Debug
- Open FPGA/VNA/VNA.xise in Xilinx ISE
- In the Design tab, select the implementation view and then "top - Behavioral"
- In the Processes tab, doubleclick "Generate Programming File". This will take a couple of minutes.
Only on a new hardware with an empty microcontroller it is required to flash the MCU firmware once. After that updates are possible through the USB port. Updating the firmware requires a combined fimrware image that contains both the MCU firmware as well as the FPGA bitstream and some header data.
- Make sure you compiled the MCU firmware: there should be a binary file "VNA_embedded.bin" in Software/VNA_embedded/[Debug/Release]
- Make sure you have the FPGA bitstream: there should be a file "top.bin" in FPGA/VNA
- Execute the script "AssembleFirmware.py" in the root directory. This creates a combined firmware file "combined.vnafw"
- Flash the compiled MCU firmware by directly connecting to the SWD pads on the board with an ST-Link and using OpenOCD/ST-Link utility/...
- The "Booting" LED should indicate an error code 2 (invalid FLASH content). This does not refer to MCU flash but rather the onboard flash chip which is empty at this point.
- Perform a firmware update using the PC application and the combined firmware:
- Open the compiled PC application
- Connect to the device if not already connected: Device > Update Device List and then Device > Connect to > Select your serialnumber
- Perform firmware update: Device > Firmware Update, select the "combined.vnafw" and click Start
- The board should reboot and not report an error condition anymore (only "Ready" and "Power" LED on)