Building and Flashing
This tutorial covers compiling the NanoVNA-H firmware from source and flashing it to your device using DFU (Device Firmware Update) mode.
What You Will Learn
Section titled “What You Will Learn”- Building firmware for NanoVNA-H and NanoVNA-H4
- Entering DFU mode on the device
- Flashing firmware using dfu-util
- Verifying a successful flash
Prerequisites
Section titled “Prerequisites”Ensure you have completed the Build Environment Setup:
- ARM toolchain (version 8) installed
- ChibiOS extracted
- Source code cloned
Building the Firmware
Section titled “Building the Firmware”For NanoVNA-H (STM32F072)
Section titled “For NanoVNA-H (STM32F072)”-
Navigate to the source directory
Terminal window cd /path/to/NanoVNA-H -
Clean any previous build
Terminal window make clean -
Build the firmware
Terminal window makeThis builds for the default target (F072/NanoVNA-H).
-
Verify the build output
Terminal window ls -la build/You should see:
H.elf- ELF file with debug symbolsH.bin- Binary file for flashingH.hex- Intel HEX format (optional use)
For NanoVNA-H4 (STM32F303)
Section titled “For NanoVNA-H4 (STM32F303)”-
Clean the build directory
Terminal window make clean -
Build with TARGET=F303
Terminal window make TARGET=F303 -
Verify the output
Terminal window ls -la build/You should see:
H4.elfH4.binH4.hex
Build Output Information
Section titled “Build Output Information”After a successful build, make displays memory usage:
text data bss dec hex filename 115432 740 22364 138536 21d28 build/H.elf| Section | Description |
|---|---|
| text | Code and read-only data (stored in flash) |
| data | Initialized variables (stored in flash, copied to RAM) |
| bss | Uninitialized variables (RAM only) |
| dec/hex | Total size |
For NanoVNA-H (F072): Total flash must be under 128 KB (131072 bytes) For NanoVNA-H4 (F303): Total flash must be under 256 KB (262144 bytes)
Installing dfu-util
Section titled “Installing dfu-util”dfu-util is used to flash firmware via USB.
sudo apt install dfu-utilsudo pacman -S dfu-utilbrew install dfu-utilOption 1: Download binaries
Download from dfu-util releases and add to PATH.
Option 2: Chocolatey
choco install dfu-utilDriver setup:
Windows requires proper USB drivers. Use Zadig to install WinUSB driver for the “STM32 BOOTLOADER” device when in DFU mode.
Verify installation:
dfu-util --versionEntering DFU Mode
Section titled “Entering DFU Mode”The NanoVNA must be in DFU (bootloader) mode to receive firmware updates.
If your current firmware supports it:
-
Power on the NanoVNA
-
Navigate to the DFU menu
Go to CONFIG > DFU
Or on some firmware versions: CONFIG > VERSION > DFU
-
Confirm DFU mode
The screen goes blank or shows “DFU” - this is normal.
-
Connect USB cable
If not already connected, connect to your computer.
If the menu method is unavailable (corrupted firmware, etc.):
-
Locate the BOOT0 jumper/button
On the NanoVNA-H PCB, find the BOOT0 pad or button.
-
Short BOOT0 to VCC
- Use a jumper wire or tweezers
- Or press the BOOT0 button (if present)
-
Power on while BOOT0 is shorted
Connect USB while holding BOOT0.
-
Release BOOT0
After power is applied, you can release the jumper.
Verifying DFU Mode
Section titled “Verifying DFU Mode”-
List DFU devices
Terminal window dfu-util -l -
Expected output
Found DFU: [0483:df11] ver=2200, devnum=12, cfg=1, intf=0, path="1-2", alt=0, name="@Internal Flash /0x08000000/064*0002Kg", serial="XXXX"The vendor:product ID should be
0483:df11(STMicroelectronics DFU device).
Flashing the Firmware
Section titled “Flashing the Firmware”Using make flash
Section titled “Using make flash”The Makefile includes a flash target:
make flashFor NanoVNA-H4:
make flash TARGET=F303Using dfu-util directly
Section titled “Using dfu-util directly”dfu-util -d 0483:df11 -a 0 -s 0x08000000:leave -D build/H.bindfu-util -d 0483:df11 -a 0 -s 0x08000000:leave -D build/H4.binCommand breakdown
Section titled “Command breakdown”| Option | Meaning |
|---|---|
-d 0483:df11 | Target STM32 DFU device |
-a 0 | Select alternate setting 0 (internal flash) |
-s 0x08000000:leave | Start address and leave DFU mode after flashing |
-D build/H.bin | Download (flash) this file |
Flash Output
Section titled “Flash Output”A successful flash looks like:
dfu-util 0.11
Opening DFU capable USB device...Device ID 0483:df11Run-Time device DFU version 011aClaiming USB DFU Interface...Setting Alternate Interface #0 ...Determining device status...DFU state(10) = dfuIDLE, status(0) = No error condition is presentTransferring 116172 bytes...Download [=========================] 100% 116172 bytesDownload done.DFU state(7) = dfuMANIFEST, status(0) = No error condition is presentResetting USB...After flashing, the NanoVNA should automatically restart with the new firmware.
Verifying the Flash
Section titled “Verifying the Flash”-
Check the device starts normally
The NanoVNA should boot to the main display with traces.
-
Check the firmware version
Go to CONFIG > VERSION
Verify the build date matches your compile time.
-
Test basic functionality
- Touch screen responds
- Sweep runs
- Calibration can be performed
Troubleshooting
Section titled “Troubleshooting””No DFU capable USB device available”
Section titled “”No DFU capable USB device available””- Device is not in DFU mode - try again
- USB drivers not installed (Windows)
- Try running with sudo (Linux):
sudo dfu-util -l - USB cable may be faulty
”Cannot open DFU device”
Section titled “”Cannot open DFU device””-
On Linux, add udev rule:
Terminal window echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="0483", ATTR{idProduct}=="df11", MODE="0666"' | sudo tee /etc/udev/rules.d/50-stm32-dfu.rulessudo udevadm control --reload-rules -
On macOS, this usually just works
-
On Windows, use Zadig to install WinUSB driver
Device does not restart after flashing
Section titled “Device does not restart after flashing”- Try power cycling (disconnect USB, reconnect)
- The
:leaveoption should exit DFU mode, but some devices need manual reset
Device boots to blank screen after flash
Section titled “Device boots to blank screen after flash”- Wrong firmware file (H.bin vs H4.bin)
- Corrupted build - try
make clean && make - Flash again, ensuring correct target
Build succeeds but device crashes
Section titled “Build succeeds but device crashes”- Wrong compiler version (must be version 8)
- Try a clean build:
make clean && make - Check for modifications that may have introduced bugs
Quick Reference
Section titled “Quick Reference”| Task | Command |
|---|---|
| Build for NanoVNA-H | make |
| Build for NanoVNA-H4 | make TARGET=F303 |
| Clean build | make clean |
| Flash NanoVNA-H | make flash |
| Flash NanoVNA-H4 | make flash TARGET=F303 |
| List DFU devices | dfu-util -l |
Next Steps
Section titled “Next Steps”- Debugging with CMSIS-DAP - Hardware debugging
- Build Environment Setup - Toolchain details