Skip to content

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.

  • Building firmware for NanoVNA-H and NanoVNA-H4
  • Entering DFU mode on the device
  • Flashing firmware using dfu-util
  • Verifying a successful flash

Ensure you have completed the Build Environment Setup:

  • ARM toolchain (version 8) installed
  • ChibiOS extracted
  • Source code cloned
  1. Navigate to the source directory

    Terminal window
    cd /path/to/NanoVNA-H
  2. Clean any previous build

    Terminal window
    make clean
  3. Build the firmware

    Terminal window
    make

    This builds for the default target (F072/NanoVNA-H).

  4. Verify the build output

    Terminal window
    ls -la build/

    You should see:

    • H.elf - ELF file with debug symbols
    • H.bin - Binary file for flashing
    • H.hex - Intel HEX format (optional use)
  1. Clean the build directory

    Terminal window
    make clean
  2. Build with TARGET=F303

    Terminal window
    make TARGET=F303
  3. Verify the output

    Terminal window
    ls -la build/

    You should see:

    • H4.elf
    • H4.bin
    • H4.hex

After a successful build, make displays memory usage:

text data bss dec hex filename
115432 740 22364 138536 21d28 build/H.elf
SectionDescription
textCode and read-only data (stored in flash)
dataInitialized variables (stored in flash, copied to RAM)
bssUninitialized variables (RAM only)
dec/hexTotal 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)

dfu-util is used to flash firmware via USB.

Terminal window
sudo apt install dfu-util

Verify installation:

Terminal window
dfu-util --version

The NanoVNA must be in DFU (bootloader) mode to receive firmware updates.

If your current firmware supports it:

  1. Power on the NanoVNA

  2. Navigate to the DFU menu

    Go to CONFIG > DFU

    Or on some firmware versions: CONFIG > VERSION > DFU

  3. Confirm DFU mode

    The screen goes blank or shows “DFU” - this is normal.

  4. Connect USB cable

    If not already connected, connect to your computer.

  1. List DFU devices

    Terminal window
    dfu-util -l
  2. 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).

The Makefile includes a flash target:

Terminal window
make flash

For NanoVNA-H4:

Terminal window
make flash TARGET=F303
Terminal window
dfu-util -d 0483:df11 -a 0 -s 0x08000000:leave -D build/H.bin
OptionMeaning
-d 0483:df11Target STM32 DFU device
-a 0Select alternate setting 0 (internal flash)
-s 0x08000000:leaveStart address and leave DFU mode after flashing
-D build/H.binDownload (flash) this file

A successful flash looks like:

dfu-util 0.11
Opening DFU capable USB device...
Device ID 0483:df11
Run-Time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Interface #0 ...
Determining device status...
DFU state(10) = dfuIDLE, status(0) = No error condition is present
Transferring 116172 bytes...
Download [=========================] 100% 116172 bytes
Download done.
DFU state(7) = dfuMANIFEST, status(0) = No error condition is present
Resetting USB...

After flashing, the NanoVNA should automatically restart with the new firmware.

  1. Check the device starts normally

    The NanoVNA should boot to the main display with traces.

  2. Check the firmware version

    Go to CONFIG > VERSION

    Verify the build date matches your compile time.

  3. Test basic functionality

    • Touch screen responds
    • Sweep runs
    • Calibration can be performed
  • 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
  • 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.rules
    sudo udevadm control --reload-rules
  • On macOS, this usually just works

  • On Windows, use Zadig to install WinUSB driver

  • Try power cycling (disconnect USB, reconnect)
  • The :leave option should exit DFU mode, but some devices need manual reset
  • Wrong firmware file (H.bin vs H4.bin)
  • Corrupted build - try make clean && make
  • Flash again, ensuring correct target
  • Wrong compiler version (must be version 8)
  • Try a clean build: make clean && make
  • Check for modifications that may have introduced bugs
TaskCommand
Build for NanoVNA-Hmake
Build for NanoVNA-H4make TARGET=F303
Clean buildmake clean
Flash NanoVNA-Hmake flash
Flash NanoVNA-H4make flash TARGET=F303
List DFU devicesdfu-util -l