1. Home
  2. Docs
  3. How-To
  4. Update module firmware

Update module firmware

There are currently two ways to load and update firmware on Hexabitz modules. Both methods work with individual modules only. You cannot currently perform mass update for the entire array at once. However, if you want to update a module remotely (i.e., via another module), check out this article.

1. Using ST Factory Bootloader and Array Ports

The MCU used in Hexabitz mainstream implementation comes from its manufacturer (STMicro) pre-loaded with a small application called factory bootloader. This application allows loading a new firmware to the MCU via one of the UART interfaces connected to array ports. The module port that enables bootloader-based update is marked with (*) . For this process, all you need is a UART-USB converter cable and a special application from ST called Flash Loader Demonstrator. But first, you need to boot up the module in its factory bootloader mode.

Booting into ST Factory Bootloader

In general, when the STM32F0-based module is virgin (i.e., it has no firmware at all) it boots automatically in factory bootloader mode and you can upload firmware right away. However, when the module is already running a firmware, you need to force it to boot into the factory bootloader. You can do that with either one of these two methods:

  • Using the update CLI Command. Once you execute this command, the MCU will leave the running application and jump to factory bootloader. If you are already connected to the programming port, you will need to close this port in RealTerm (or any other terminal emulator) before you can use it to connect to the factory bootloader.
  • Applying 3.3V on module B (Boot0) pad while power cycling. Easiest way to achieve this is to connect a female-to-male jumper wire to one of power ports (edge ports) top connector, and then touch the B pad while power cycling the MCU.

Once the MCU is in factory bootloader mode, connect the USB-UART TXD/RXD (yellow/orange) wires to the appropriate port and run the Flash Loader Demonstrator. Select the appropriate COM port and leave other connection settings to default then click next. If everything is working correctly, you will see a green traffic light with “Target is Readable” message. Otherwise, if the module did not boot in bootloader mode correctly, you will get a red traffic light. Just power cycle and repeat the process again. Click next to select the default MCU Flash algorithm and another click to reach the programming tab. Choose “Download to Device” option and select the module firmware (it should be a HEX file). You can specify a full memory erase or only necessary pages. You can also enable verification. The “Jump to user program” option automatically runs the application after it has been downloaded. Otherwise, you will need to power cycle to run the application.

This article explains how to perform remote bootloader update, i.e., updating a module while connecting to another module.

Note 1: If you are not powering the module from the same USB-UART cable (or another cable connected to your PC), then you need to connect module GND and the PC GND together. Just connect the GND wire on the USB-UART cable to a module GND pad.

Note 2: If you compile your code with uVision, it does not generate a HEX file by default. You need to enable that in Options for Target >> Output Tab.

 

 

2. Using the Serial Wire Debug Interface

The Serial Wire Debug (SWD) interface enables fast firmware update as well as real-time debugging. You will need an STM32-compatible programmer/debugger (e.g., ST-LINK V2 or ST-LINK V3 or the Nucleo board) and a programming software tool (e.g., ST-LINK Utility or STM32CubeProg or via KEIL uVision IDE). Three module pads are needed for connection (plus GND): C (SWD Clock), D (SWD Data) and R (MCU Reset).

You will need to make the following connections between the programmer and the module (example provided for Nucleo programming header CN4):

  • Pin 2 (starting up) >> C.
  • Pin 4 >> D.
  • Pin 5 >> R.
  • You need to connect GND between ST-LINK and the module. If your module is powered from a USB-UART cable connected to the same laptop that you connect the ST-LINK to, then, they both have a common ground and you might not need a separate GND connection.

Note 1: Some ST-LINK programmers require target VCC to be connected as well. In this case, you need to connect one of the module power (top) pads as well.

Note 2: The ST-LINK Utility loads binary and HEX files while uVision IDE loads AXF files. You can use ARM fromelf.exe tool to convert AXF files in binary ones.

FAQs

Q: How do I update firmware in Linux or MacOS?

A: The ST Flash Loader Demonstrator is Windows-only utility. However, we have a couple of articles and videos explaining how to access the CLI and update firmware on Ubuntu/Mac and Raspberry Pi here.

Q: Where do I find module firmware?

A: There are three easy methods to get pre-compiled firmware HEX files for the release you want without cloning and compiling the firmware:

  • Navigate to module website page, Resources tab and download HEX files for latest firmware release.
  • Visit module firmware repository on Github and click on Releases, recent releases should show up with their associated HEX files.
  • Visit module firmware repository on Github and navigate to the Compiled folder within the code. The folder contains HEX files for current and previous releases. Simply copy the release you want if you have a local copy. If you are browsing the repository online, click on the HEX file then, click on Raw to display and download the file. You can also download a zip folder of the entire repository using the Clone or download button.

Articles

Was this article helpful to you? Yes 2 No

How can we help?