How To Guide: STM32CubeProgrammer for RAK Modules

Overview

This document helps you update the firmware of your RAK modules based on STM32 microcontrollers using STM32CubeProgrammer. Download the STM32CubeProgrammer software and install the appropriate installer based on your Operating System.

By default, RAK modules have RAK Bootloader. To update your device, you will only need the .bin file to be uploaded via RAK DFU Tool or WisToolBox. However, aside from the .bin firmware file, RAK also provides the .hex file, which contains both the RAK bootloader and the application code. This STM32CubeProgrammer guide will use that hex file provided on the modules.

Contents

These are the two ways to use the STM32CubeProgammer:

đź“ť NOTE: If you have no ST-LINK hardware tool, you can only use the STM32's built-in UART bootloader since you will only need a UART connection (no external tool required).

Using the STM32 UART Bootloader

Your RAK module must be connected to the PC via a USB-UART converter (VCC, GND, TX, and RX). It must be in STM32 UART Bootloader mode as well. To do this, you have to connect the BOOT pin of the module to VCC (3.3 V) then reset (momentary pull down of reset pin) the module. You can also power up the module while BOOT pin already connected to VCC so you will not need to reset. Take note that after a successful upload, you have to remove the BOOT pin connection to VCC.

⚠️ WARNING: RAKDAP1 hardware debugger DOES NOT work with STM32CubeProgrammer. It is advisable to use alternative USB-UART converter when using the UART bootloader of STM32WL to upload a .bin nor .hex file.

KHM-064-01.png

KHM-064-02.png

Open the STM32CubeProgrammer software, and select UART on the tool selection.

KHM-064-03.png

With the RAK module connected to the PC, select the correct assigned port (COM19 in this guide), then click Connect. If a wrong port is selected, the connection will fail.

KHM-064-04.png

You should see that the device and its memory are read by STM32CubeProgrammer.

đź“ť NOTE:
  • If the module is not detected by the STM32CubeProgrammer, double-check if the BOOT pin is configured properly.
  • If you are using an external USB-UART converter board, check the VCC, GND, UART_TX, and UART_RX pin connections.
  • If you are using jumper wires, you can manually check the continuity using a multimeter.

KHM-064-05.png

After a successful connection, you have to open the firmware file you need to upload. This is usually a .hex file that contains both the RAK Bootloader and the latest application code. You have to check the specific RAK module documentation for the correct hex file.

KHM-064-06.png

KHM-064-07.png

Click Download to start uploading the firmware file. If all is successful, you should see 100%. At this point, you can now remove the connection of BOOT pin to VCC and restart the module to run the updated application code.

KHM-064-08.png

You need to connect the ST-LINK tool to your RAK module. The RAK module must have external power, and SWD pins (VDD, GND, SWDIO, and SWCLK) must be connected to the ST-LINK. The ST-LINK will detect the voltage level of the supplied power to the RAK module. It must be connected to a PC via USB.

KHM-064-09.png

Open the STM32CubeProgrammer software, and select ST-LINK on the tool selection.

KHM-064-010.png

If the ST-LINK is not detected by the PC, you need to click refresh. Then you can now click Connect button.

KHM-064-011.png

With a successful connection, you should see that the device and its memory content are read by STM32CubeProgrammer.

đź“ť NOTE:
  • If the module is not detected by the STM32CubeProgrammer, double check if the module has the right external power source.
  • If you are using jumper wires to connect the needed SWD pins, you can manually check the continuity using a multimeter.

KHM-064-012.png

You also have the option to perform a full chip erase using ST-LINK if you need your RAK module to be as fresh as a newly purchased module.

KHM-064-013.png

KHM-064-014.png

After successful mass erase, you have to open the firmware file you need to upload. This is usually a .hex file that contains both the RAK Bootloader and the latest application code. You have to check the specific RAK module documentation for the correct hex file.

KHM-064-015.png

KHM-064-016.png

Click Download to start uploading the firmware file.

KHM-064-017.png

If all is successful, you should see 100%. At this point, you can now remove the connection of the module to the ST-LINK and run your device normally.

KHM-064-018.png

Updated