USB to TTL Dongle to Program a Bootloader
Connect the USB to TTL dongle to the Blue Pill as shown below.
Wiring between USB to TTL Dongle and Blue Pill
Cable |
USB to TTL Dongle |
STM32 Blue Pill |
Green |
TXD (pin 2) |
A10 |
Yellow |
RXD (pin 3) |
A9 |
Black |
GND (pin 4) |
G |
Red |
+5V (pin 5) |
5V |
The STM32F103 is a 3.3V powered device, however some pins are 5V tolerant, these include A9 and A10 and so it is safe to connect
standard 5V TTL signals to these pins without damaging the microcontroller.
Note: The breadboard does not have to be used, as the connections can be made directly to the pins on the Blue Pill itself.
Plug the dongle into a USB port on your computer.
Launch the STMCubeProgrammer application. Select UART from the dropdown list, and click on the "Connect" button. Click the
"Erasing & Programming" icon, click the "Browse" button and navigate to the location where generic_boot20_pc13.bin was saved earlier.
To program the bootloader click on the "Start Programming" button.
When the programming is finished the log should contain the entry "File Download Complete".
ST-LINK Dongle to Program a Bootloader
Connect the ST-LINK dongle to the Blue Pill as shown below.
Wiring between ST-LINK Dongle and Blue Pill
Cable |
ST-LINK Dongle |
STM32 Blue Pill |
Orange |
SWDIO (pin 2) |
SWIO |
Black |
GND (pin 4) |
GND |
Brown |
SWCLK (pin 6) |
SWCLK |
Red |
3.3V (pin 8) |
3V3 |
Note: The breadboard is not actually required, as the connections are be made directly to the pins on the Blue Pill itself.
Plug the dongle into a USB port on your computer.
Launch the STMCubeProgrammer application. Select ST-LINK from the dropdown list, and click on the "Connect" button. Click the
"Erasing & Programming" icon, click the "Browse" button and navigate to the location where generic_boot20_pc13.bin was saved earlier.
To program the bootloader click on the "Start Programming" button.
When the programming is finished the log should contain the entry "File Download Complete".