🛠 Alimenter et flasher la Blue Pill : BOOT0, port série, ST-Link et DFU
Powering without breaking things
The board is powered by 5 V via micro-USB or the +5V pin, and includes a 3.3 V LDO (TX6211B, input 3.6–5.5 V, output 3.3 V at 300 mA). A critical point confirmed by two sources: “the +5V pins are connected directly to the +5V pin of the USB connector. There is no protection. Do not power this board via USB and an external power supply at the same time.”
Method 1 — ROM bootloader via serial port (zero paid hardware)
All STM32 chips contain a ROM bootloader capable of flashing the chip via USART, provided you can force booting from system memory — this is the role of the BOOT0 jumper. The boot mode is defined by the table in ST’s reference manual RM0008: BOOT0=0 → main flash; BOOT0=1, BOOT1=0 → system memory (ROM); BOOT0=1, BOOT1=1 → SRAM.
Practical recipe:
- Set BOOT0 to the “download” position (1), connect an FTDI adapter to PA9 (TX) / PA10 (RX) of USART1.
- Flash at 115200 8n1 using
stm32flash:stm32flash -w blink.bin -v -g 0x0 /dev/ttyUSB0. - Set BOOT0 back to 0 and reset. The 921600 baud rate only works on genuine ST chips (counterfeits fail — see the diagnostic tutorial).
Method 2 — SWD with an ST-Link
The 4-pin connector (3V3/PA13/PA14/GND) accepts ST-Link, J-Link, Black-Magic, or DAPLink. Example: st-flash --reset write blink.bin 0x8000000. This is the fallback method when everything else fails — always keep an SWD method handy before touching the bootloader.
Method 3 — USB DFU with the community bootloader
The STM32duino bootloader (derived from maple-bootloader) adds USB DFU/serial upload, at the cost of 8 KB of flash; sketches therefore start at 0x8002000: dfu-util -a 1 -D sketch.bin -s 0x8002000:leave. Beware of the documented pitfall: changing the bootloader can render the board unusable if you cannot re-flash it by another means (ST-Link, or serial bootloader mode via UART1 — not USB serial). USB re-enumeration is done by briefly shorting D+ (PA12) to ground, which relies on a pull-up resistor of approximately 1.5 kΩ — often missing or poorly calibrated on cheap boards.
Other tutorials for this board
- Découvrir la Blue Pill : que trouve-t-on dans la boîte ?
- Premier programme Arduino sur la Blue Pill (core officiel stm32duino)
- Série, ADC et chasse aux contrefaçons : diagnostiquer sa Blue Pill
- Dompter l'USB natif de la Blue Pill : CDC, DFU et la résistance rebelle
- Passer au niveau supérieur : STM32CubeIDE, HAL et LL sur F103
- Firmware libre sur Blue Pill avec libopencm3 et OpenOCD