Flashing STM32 over UART
A USBUSB (Universal Serial Bus). The wired connection used to power a device, flash firmware onto it, and communicate with it over serial.-TTL serial adapter can flash STM32WL without an SWDSWD (Serial Wire Debug). A two-pin debug and programming interface, used on STM32 devices to enter bootloader mode and flash firmware. programmer, once the board is in the ROM bootloader.
The ROM bootloader listens on:
- USART1 — PA9 (TXTX (Transmit). The transmitting of data over the radio link.), PA10 (RXRX (Receive). The receiving of data over the radio link.)
- USART2 — PA2 (TXTX (Transmit). The transmitting of data over the radio link.), PA3 (RXRX (Receive). The receiving of data over the radio link.)
Connect the adapter's RXRX (Receive). The receiving of data over the radio link. to the MCUMCU (Microcontroller Unit). The microcontroller that runs the firmware on a device. The hardware tables list the MCU for each supported board.'s TXTX (Transmit). The transmitting of data over the radio link. and the adapter's TXTX (Transmit). The transmitting of data over the radio link. to the MCUMCU (Microcontroller Unit). The microcontroller that runs the firmware on a device. The hardware tables list the MCU for each supported board.'s RXRX (Receive). The receiving of data over the radio link., with a common ground.
GUI — STM32CubeProgrammer
- Launch STM32CubeProgrammer.
- Select the UARTUART (Universal Asynchronous Receiver-Transmitter). A serial interface used to communicate with a device over its pins or through a USB-to-serial bridge. connection and the serial port of your USBUSB (Universal Serial Bus). The wired connection used to power a device, flash firmware onto it, and communicate with it over serial.-TTL adapter.
- Put the board in the ROM bootloader.
- Click Connect.
- Open the
firmware-<target>-X.X.X.xxxxxxx.binfile and confirm the start address is0x08000000(the default). - Click Download.
CLI — STM32CubeProgrammer
STM32_Programmer_CLI -c port=/dev/ttyUSB0 br=115200 -w firmware-<target>-X.X.X.xxxxxxx.bin 0x08000000 -v -g 0x08000000
-v verifies the write and -g 0x08000000 starts the firmware once it finishes.