cancel
Showing results for 
Search instead for 
Did you mean: 

How to use STM32CubeProgrammer to access the USART bootloader on my STM32 board

Stefanie LAU
ST Employee

In this example, we will use the Nucleo-H743ZI as our STM32 reference board to show you how to leverage the STM32CubeProgrammer GUI to access the target’s USART bootloader.

Every STM32 MCU comes pre-programmed with a system memory bootloader stored in the internal boot ROM (system memory). It's main purpose is to download the application program to the internal Flash memory through one of the available serial peripherals (e.g. USART, CAN, USB DFU, I2C, and  SPI). To verify which peripheral interfaces support the activation of the bootloader, the communication protocol and respective command set and sequence, please review
AN2606 (STM32 Microcontroller System Memory Boot Mode).
 

STM32CubeProgrammer is an all-in-one software tool for programming STM32 products, compatible across multiple operating systems and available in both graphical user interface (GUI) and command line interface (CLI) versions. It's an easy to use and efficient application for reading, writing, and verifying device memory through both the JTAG and SWD debug interfaces and bootloader interfaces (e.g. USART, CAN, USB DFU, I2C, and  SPI). It is recommended to always keep up to date with the latest version of STM32CubeProgrammer

Step 1. Locate your STM32 device in AN2606. This will reveal the activation pattern you need to apply, the various available bootloader interfaces for your device and the hardware resources required by the bootloader.
1065.png

Step 2.
Locate the pattern denoted in your target MCU’s bootloader configuration description and in the bootloader activation patterns table. Note that if there are multiple options for a pattern, you may select any option of your choice to apply.

In our example case, the pattern we must use is pattern 10.
1066.png

Step 3.
As pattern 10 has two options, we will select the second pattern 10 option: Boot(pin) = 1 and BOOT_ADD1(optionbyte) = 0x1FF0. On my Nucleo-H743ZI, I have verified that the BOOT_ADD1 in the MCU’s option bytes is set to 0x1FF0 using STM32CubeProgrammer and have connected the BOOT0 pin (located on CN11) to VDD.

1067.png

Step 4.
As each STM32 is unique, there may be multiple USARTs to select from to launch the USART bootloader. This information is found in the appropriate STM32’s configuration in system memory boot mode table.

In our example case, we have the choice to select launching the USART bootloader on USART1 via pins PA9/PA10 or PB14/PB15, USART2 via pins PA2/PA3 or USART3 via PB10/PB11.
In this example, we’ll move forward with selecting USART1 (PA9/PA10).

Step 5.
As we are using the Nucleo-H743ZI, we will need to make some additional connections. 

Now this step is extremely critical when using the Nucleo-H743ZI to launch the USART bootloader as this step establishes the connection between the ST LINK’s virtual com port and the STM32H743’s USART1 pin. This connection allows the required 0x7F command to be properly received to launch the USART bootloader.
In our case T_VCP_TX (connected to STLK_VCP_TX) is on pin PD8 and T_VCP_RX (connected to STLK_VCP_RX) pin is on PD9. Therefore, on our Nucleo-H743ZI we will connect PD8 to PA9 (USART1_TX) and PD9 to PA10 (USART1_RX).
Do note that if you are using another STM32 board, you will need to verify if the USART you've selected is directly connected to the ST LINK's virtual com port TX and RX dedicated pins as we've done with the Nucleo-H743ZI in this step. 


Step 6.
  Locate the user USB port on your board and attach the board to to your host machine with a USB cable.

1068.png

Select the UART connectivity option in STM32CubeProgrammer and make sure that you are selecting the appropriate COM port of the target MCU. 

1069.png

Step 7.
Click on the ‘Connect’ icon. Congratulations! We have successfully leveraged STM32CubeProgrammer to launch our Nucleo-H743ZI’s USART bootloader. 

1070.png
The STM32CubeProgrammer GUI is functional in many ways, some of the things you can do include but are not limited to: reading from / writing to flash memory and RAM, reading / programming the device's option bytes and checking CPU register contents. 
Relevant Links & Documentation:

Comments
mathieusteketee
Associate III

Hey @Stefanie LAU

great article you have put together here!

I however dont see the Boot address and Option Bytes in the Option Bytes tab. 

Did you do something special to open this tab?

Thank you.

Version history
Last update:
‎2024-06-04 06:16 AM
Updated by:
Contributors