There are quite a few good resources already out there for the NanoVNA, but I’ve seen a few people mention that the prospect of updating the firmware is daunting. Indeed it is if you try to build it from scratch as the tutorials that I’ve seen have you do. However, that’s not really necessary for the most popular firmware, since the devs provide a pre-compiled binary for you. So this is intended to be a bare-bones guide for someone who just wants to update firmware on the NanoVNA without messing with actually building it first.
First of all, please be aware that I’m providing this guide as a simple courtesy. I haven’t tested all scenarios and I can’t guarantee that you won’t brick your device if you try this. Please proceed at your own caution.
First, we need to install the dfu-util application and any other necessary support tools.
For a Debian-based distribution, installation is this simple:
sudo apt install dfu-util
For other distributions, your package manager command will be different, but dfu-util is probably in your distro repositories.
I have no way of testing this, but [Edit: Peter Marks in the comments below confirms that these steps do work on macOS. Please see his comments for additional information.] The dfu-util homepage says that you can install the program from Homebrew this way:
brew install dfu-util
As is usual, installing on Windows is a bit more complicated. First you’ll need to install the libusb library on your system. The easiest way to do this is to use Zadig. First, place your NanoVNA into DFU mode (see below). Next, download and run Zadig from the previous link, click on menu
List Add Devices and select
STM32 BOOTLOADER from the dropdown box at the top of the window, then click
Install Driver. Once the driver installation is done, go to the dfu-util releases page and grab the latest Windows binary (dfu-util-0.9-win64.zip as of today). Extract the ZIP file and then open a command line window in the folder you just unzipped to have access to dfu-util.exe.
Download and Install Firmware
Grab your pre-compiled firmware. The mainline firmware is from edy555. Releases are packaged so that the binary that you flash is provided to you in a zip file. In this case the firmware binary is in the build folder and is named
ch.bin. A fork of this firmware that I have personally used is called NanoVNA-Q by qrp73, and can be found here. The pre-complied binary in this version is a file with the extension of
dfu. The method of flashing these two different file types is slightly different, which you’ll see shortly.
Before flashing the firmware, you’ll need to place the NanoVNA into DFU mode. This can be accomplished in a few different ways. First, plug the USB-C cable into the NanoVNA and connect the other end to your PC. If you have newer firmware, there is a menu option available. Select the menu, then
CONFIG, and then
→DFU. Tap on
RESET AND ENTER DFU to confirm that you want to enter this mode. If this option is not available, there’s always a way to do it in hardware. Remove the back cover and then look for a 2-pin header socket on the left side of the PCB (under the rocker switch side) labeled
P1 (with pins
BOOT0). Make sure the device power is off, temporarily jumper those two pins together, and then power on the NanoVNA. You should see it turn on with an all-white display. The NanoVNA is now ready to accept new firmware.
Now we are ready to actually upload the firmware. If you are using a
.bin firmware file, use this command to write the new firmware (of course, ensure that you replace
ch.bin below with the path to your actual file):
dfu-util -d 0483:* -a 0 -s 0x08000000:leave -D ch.bin
If you are using a file in the
.dfu format, use this command instead (again, replace
firmware.dfu with your actual file path):
dfu-util -d 0483:* -a 0 -D firmware.dfu
Now simply power off the NanoVNA and power it back on to restart with the new firmware. If you had to use the physical jumper to place it in DFU mode and you flash a newer firmware (as of November 2019) then you shouldn’t need to do that again in the future if you want to upgrade firmware again, as you will have the DFU menu option now available.
Hope that was helpful and that you have fun experimenting with your NanoVNA. I most certainly have!