How to flash firmware

From STorM32-BGC Wiki
Jump to navigation Jump to search

This page is for instructions on how to flash firmware onto v3.x STorM32 boards.

For instructions on how to flash v1.1/v1.2/v1.3/v1.3x STorM32 boards, please consult the article How to flash v1.x STorM32 boards.

The flashing manual is different for v3.x and v1.x boards because the v3.x boards can conveniently be upgraded via the USB plug, which is not possible with the v1.x boards. For the v3.x boards in fact two situations can be distinguished:

  • Upgrading: If your v3.x board already runs a valid STorM32 firmware, and you want to upgrade or downgrade, then this is the recommended procedure to choose, since it is most simple.
  • First-Time Flashing: In all other cases, when your v3.x board has not yet a STorM32 firmware installed or you don't want to use the upgrade method, this is what needs to be done.

Comment: The same distinction also exists for flashing NT modules, see How to flash NT Modules.

Updating Firmware

If your v3.x STorM32 board runs already a firmware, then this is the canonical procedure for upgrading:

1. Connect the board via the USB plug to the PC.

Comment: If this is the first time the board is connected via USB to the PC, then Win will immediately start with installing the appropriate USB driver. This takes quite a while (several minutes). Please, be patient and wait until Win reports that the device is ready for use. Do not interrupt the driver installation process before it is completed. Otherwise things can get messed up quite considerably, and installing the driver later can be a challenge.

2. Run the GUI and go to the [GUI:Flash Firmware] tab (see the screenshot).

Comment: In principle you can use any GUI version to flash any version of the firmware. However, a GUI which is of the same or higher version than the firmware which is to be installed provides easy access to the firmware via the selector fields on the [GUI:Flash Firmware] window.

Storm32-wiki-upgrade-firmware-v3x.jpg

3. Select the correct board and desired firmware version in the respective combo boxes [Board] and [Firmware Version].

Comment: With these two selectors the correct firmware .hex file is chosen in the [Selected Firmware Hex File] field.
Comment: It is important to choose the correct board version; otherwise the board will not functions correctly.

4. Select "Upgrade via STorM32 USB port" in the [STM32 Programmer] field.

5. In the [Port] field select the COM port which your STorM32 board is connected to (it's the same port you choose when connecting to the GUI).

Comment: If you are not sure which the correct COM port is, then disconnect the STorM32 board from the PC, inspect the drop-down list and memorize the available COM ports, reconnect the STorM32 board and wait until it is enumerated by Win, inspect the drop-down list again, and chose the newly added COM port.

6. If required or desired check the [Perform full chip erase] check button.

7. Remind you about the upgrading process by reading the usage information.

8. Finally, hit the [Flash Firmware] button.

9. Now a black window (DOS console) should open and run the flash loader program, as shown in the screenshot. Wait until it's finished (takes some seconds). The STorM32 board will be reset and start running.

Storm32-wiki-flash-firmware-dosbox.jpg

First-Time Flashing

If your v3.x STorM32 board has not yet been flashed with a STorM32 firmware, or runs a different firmware, then one needs to resort to grass roots flashing methods for flashing the firmware (first-time flashing).

In general, the STM32 micro-controllers which are used in the STorM32 boards provide two different built-in methods for flashing firmware:

  1. via the serial system bootloader on the UART port using a USB-TTL adapter
  2. via SWD using a ST-Link programmer

For v3.x boards method (1) is relatively convenient, since these boards have a USB-TTL adapter integrated and thus no additional hardware is needed for doing this. However, the grain of salt, the BOOT0 pin needs to be temporarily shortened to GND by closing the solder jumper.

Method (2) requires a dedicated ST-Link programmer. These are cheaply available, but nevertheless it is an additional piece of hardware, which one needs.

Flashing via System Bootloader

1. IMPORTANT: Find the BOOT0 solder jumper on the STorM32 board, and close it with a drop of solder.

2. Connect the board via the USB plug to the PC (it is important to do that after step 1).

3. Run the GUI and go to the [GUI:Flash Firmware] tab and choose your settings. It should look something like that:

Storm32-wiki-flash-firmware-systembootloader.jpg

4. Select the correct board and desired firmware version in the respective combo boxes [Board] and [Firmware Version].

5. Select "System Bootloader @ UART1" in the [STM32 Programmer] field.

6. In the [Port] field select the COM port which your STorM32 board is connected to.

7. Finally, hit the [Flash Firmware] button.

8. Now a black window (DOS console) should open and run the flash loader program, as in shown in the above. Wait until it's finished (takes some seconds).

9. IMPORTANT: Open the BOOT0 solder jumper.

Flashing via SWD

1. You need a STLink/V2 programmer. To buy one just search for e.g. "STlink" on ebay, aliexpress, etc. They look something like this:

ST Link V2.jpg

2. You need to install the right driver. You can found and download it here: STLINK-V2 driver

3. Connect the SWD pins from the STorM32 board to the pins of your ST-Link programmer. The SWD pins on the v3.x board are near the USB plug.

"SWDIO" to "SWDIO"
"SWCLK" to "SWCLK"
"GND" to "GND"

4. Power up your STorM32 over USB, and connect your ST-Link programmer over USB to a PC.

5. Go to the [GUI:Flash Firmware] tab and choose your settings. It should look something like that:

Storm32-wiki-flash-firmware-swd.jpg

6. Push the [Flash Firmware] button.

7. Now a black window (DOS console) should open and run the ST-Link loader program, as shown in the screenshot. Wait until it's finished (takes some seconds). The STorM32 board will be reset and start running.

Storm32-wiki-flash-firmware-swd-dosbox.jpg