Updating the NanoVNA Firmware

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.

Linux

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.

MacOS

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

Windows

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 Options > 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 VDD and 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!

17 thoughts on “Updating the NanoVNA Firmware

  1. Thanks for this Jason. I can confirm that it does work on macOS. Also I was able to short the pins for DFU without removing the back, just accessing from the side.

  2. One small thing on macOS, I had to put quote marks around the option with the *. It might be due to the new shell on Catalina. Like this: dfu-util -d ‘0483:*’ -a 0 -s 0x08000000:leave -D ch.bin

  3. lsusb would probably get you the full USB vendor:product code for the nanoVNA that you would provide to dfu-util instead of having to use the wildcard.

  4. @imabug,

    There’s a reason behind my madness. I know that the PID is df11. However, the qrp73 firmware builds don’t seem to have that programmed in correctly (I believe that the DFU format has target VID/PID as metadata). So in order to avoid that potential trouble, I just put in the wildcard PID. One can certainly try it with the actual PID and see how it works for you. There’s also a program called dfu-tool that you can use the correct the PID in the DFU firmware file, but I didn’t see an easy way to get that running on Windows.

  5. With a MacBook Pro running MacOS Catalina v10.15.2, these two steps worked for me:
    Step 1- Saved current image to drive. (It’s a personal preference to backup before image builds.)
    dfu-util -d ‘0483:5740’ -a 0 -s 0x08000000:leave -U original_ch.bin

    Step 2- Updated device image.
    dfu-util -d ‘0483:5740’ -a 0 -s 0x08000000:leave -D ch.bin

    The use of the wildcard prevented dfu-util to find the device. The use of single quotes was required, as mentioned previously by @peterbmarks.

  6. I want to gain skills using the VNA updating the Oct 18 2019 build to latest firmware. I’m using a MacBookPro running High Sierra, and have dfu-util installed.

    I fear bricking the nano so, two q.:
    1) where should the .bin file be saved?
    2) how to prescribe the path to it.

  7. I don’t use MacOS so I’m not an authority on this, but you should be able to put the file wherever you normally download files. In doing some research, it seems you can get the full path of a file in the terminal by using the command realpath.

  8. From a Finder window that lists the FW upate file, select it and option-click the toolbar task (gear) icon and ‘Copy as Path name’.

    Pasted that over “firmware.dfu” in your terminal command line; it worked fine. Thanks!

  9. Is your q. about using NanoVNA-Saver? If so, in the left side pane, near the bottom is a section Serial Port Control. Click the drop-down menu and accept whatever it shows you. (Don’t recall what it showed, but nothing I recognized.) Then click Connect to NanoVNA.

    If you meant something else, pls clarify.

  10. This is the only tutorial I’ve found that explain the easiest way to update the firmware. I followed the instructions and enjoyed my new NanoVNA !

    I just wanted to clarify something about the Poduct ID : When the NanoVNA is connected to the computer, the product ID that we get with the lsucb command is different than the one we get when the device is in DFU mode (DFU for Device Firmware Update).

    So there is no need of using a wildcard in the commands. Just put the NanoVNA in DFU mode via the menu or by connecting the two pins concerned on the board like the photo above. Then, you can use the “lsusb” command and you will get something like this :

    Bus 003 Device 036: ID 0483:df11 STMicroelectronics STM Device in DFU Mode

    Now you can use the command without wildcard. Just copy the information that you’ve got with the “lsusb”. In this example, the parameter is 0483:df11.

    according to the firmware type, use the right command as explained before :

    dfu-util -d 0483:df11 -a 0 -s 0x08000000:leave -D ch.bin

    or

    dfu-util -d 0483:df11 -a 0 -D firmware.dfu

    That’s all. Enjoy !

    David.

  11. David, I needed to use the wildcard as using the specific USB ID resulted in a failure:

    dfu-util: Error: File ID 0483:0000 does not match device (0483:df11 or 0483:df11)

    As noted above, the file evidently does not have the ‘df11’ encoded in it. I am using the dfu-util package from Debian Buster.

  12. Oh, that made things remarkably simple. Thank you, very much!

    Side note, if you are on an ancient version and need to jump the pins, keep them jumpered when you turn on the device. With how many things aren’t really off when they’re “off”, that wasn’t immediately apparent, though it quickly became so.

    Thanks again for saving me a ton of time!

  13. Hi Jason,
    you just saved my day. Tried to flash the FW of my new NanoVNA-H under Win 10 based on user guides I found in the web without success, I wasn’t able at all to bring the STM device on Windows into DFU mode. Your article finally solved the issue for me.
    Vy tnx & 73, Heiko

  14. Great instructions! Short and to the point. I could not generate screenshots properly on my NanoVNA-H4 so I upgraded the firmware to DiSlord V1.0.69, I used Lnux Mint and everything worked as expected. Thank you so much for your tutorial.

Leave a Reply