Spark Logic

Serial and USB bootloader options for an STM32F103

Identify the bootloader and host protocol before uploading to an STM32F103 board with a USB serial port.

Identify what appears on the host

A USB-to-UART adapter can expose the STM32F103 factory USART bootloader as a host serial port. Put the MCU in system-memory boot mode and use the supported UART pins and a tool that speaks the STM32 ROM protocol. This uses the adapter's USB connector.

The usual medium-density Blue Pill does not provide a USB DFU bootloader in system ROM. A custom loader in user flash can provide USB DFU, HID or a serial-class protocol. The host tool and linker origin must match that loader. The presence of a serial port from a running sketch alone does not imply that the port accepts firmware uploads.

Check upload and sketch startup separately

Enter the chosen bootloader and observe what the host enumerates during the upload window. DFU and HID loaders use different host tools even when the runtime sketch later exposes USB CDC. Use the flash offset documented by the selected loader, or use SWD to upload a normal build at the start of flash.

If there is no bootloader in flash, use SWD or a supported factory serial interface to install the chosen loader. For a normal boot after programming, return BOOT0 to its low state and reset.

References