Skip to content
My Account

Reference

STM32F103C8T6 “Blue Pill” Pinout

The STM32F103C8T6 Blue Pill pin reference: both headers, SWD and USB connectors, BOOT jumpers, flashing, code and the hardware traps of the cheap boards.

  • Cortex-M3
  • 72 MHz
  • 23 × 53 mm
  • No wireless
No ratings yet, be the first.

The Blue Pill is a small blue board around an STM32F103C8T6, an Arm Cortex-M3 at 72 MHz from STMicroelectronics. It costs a few euro, plugs into a breadboard, and has no wireless radio at all, which makes it a good contrast with the ESP32 boards on this site: a fast, simple, wired microcontroller with timers, ADC, USB and many serial ports. It is a favourite for motor control, instruments and projects that must run for years without an update.

This guide covers the chip, both headers pin by pin, the SWD and USB connectors, the BOOT jumpers, how to flash it, code, and the hardware traps of the cheap clones, above all the wrong USB resistor. The board data comes from stm32-base.org. I could not download the ST datasheet for this update, so the chip limits are not checked against it here.

Chip and board

ItemValue
ChipSTM32F103C8T6, Arm Cortex-M3, LQFP48
ClockUp to 72 MHz. Oscillators: HSI 8 MHz, LSI 40 kHz, HSE 8 MHz crystal, LSE 32.768 kHz crystal
Memory64 KiB flash and 20 KiB SRAM as listed. Many chips actually have 128 KiB
WirelessNone
USBMicro-B, USB 2.0 full-speed device
RegulatorTX6211B, input 3.6 to 5.5 V, output 3.3 V at 300 mA
LEDsUser LED on PC13 (sinks), power LED on the 3.3 V rail
Buttons and jumpersReset (active low, NRST), BOOT0 and BOOT1 jumpers
Backup batteryNone
Size23 × 53 mm, blue, breadboard format

Source: stm32-base.org Blue Pill reference. The 128 KiB remark is common knowledge about these chips and not from that page.

Getting started

1. What you needA Blue Pill, an ST-Link V2 (or a clone) with its SWD wires, and a USB cable for power.
2. Install the softwareIn the Arduino IDE install the STM32duino “STM32 MCU based boards” package, and choose Generic STM32F1 series, board Generic F103C8, upload method ST-Link.
3. BlinkUpload the Blink sketch below. The user LED on PC13 is active low.

Specifications

Supply3.3 V on the 3V3 pins. The 5V pins connect straight to USB 5 V with no protection
RegulatorTX6211B in a SOT23-5, input 3.6 to 5.5 V, output 3.3 V at 300 mA
Power sourcesAny 3.3 V pin, any 5V pin, or the USB connector
Debug header4 pins: 3V3, SWDIO (PA13), SWCLK (PA14), GND
USB connector1 VCC (+5 V), 2 D− (PA11), 3 D+ (PA12), 4 ID (not connected), 5 GND
ADCPA0 to PA7, PB0 and PB1, 12-bit (ST datasheet, not re-checked here)
5 V toleranceMany pins are 5 V tolerant (marked FT in the ST datasheet). The stm32-base page does not say which, so check the ST datasheet per pin

Source: stm32-base.org Blue Pill reference.

Dimensions

The board is 23 × 53 mm with two rows of 20 pins at the standard 2.54 mm pitch, which fits a breadboard. The micro-USB connector is on one short edge and the 4-pin SWD header on the other short edge. Hole positions and the distance between the two rows are not on the stm32-base page, so measure your own board before you design a socket.

Source: stm32-base.org Blue Pill reference for the size.

Pin reference

Real pin labels as printed on the board’s own silkscreen (source: stm32-base.org’s Blue Pill reference).

HeaderPins
Left headerVBAT, PC13, PC14, PC15, PA0–PA7, PB0, PB1, PB10, PB11, NRST, 3.3V, GND
Right header3.3V, GND, 5V, PB9, PB8, PB7, PB6, PB5, PB4, PB3, PA15, PA12, PA11, PA10, PA9, PA8, PB15, PB14, PB13, PB12
SWD header (4-pin)3.3V, PA13 (SWDIO), PA14 (SWCLK), GND
USB connector5V, PA11 (D−), PA12 (D+), GND

PA0–PA7 and PB0/PB1 double as a 12-bit ADC. Most pins also carry a timer channel (TIM1–TIM4) for hardware PWM, check ST’s own STM32F103C8T6 datasheet for the exact alternate-function map before a design that depends on a specific pin’s timer.

BOOT jumpers and flashing

Two jumpers (labeled BOOT0 and BOOT1) select where the chip starts executing on reset or power-up:

BOOT0BOOT1Boots from
0xMain flash (normal run mode)
10System memory (built-in USART bootloader)
11Embedded SRAM

Three real ways to get code onto it:

  • ST-Link (recommended): a cheap ST-Link V2 clone plugged into the 4-pin SWD header (PA13/PA14), works with both BOOT jumpers left at 0, no jumper changes needed between flashing and running.
  • USB-to-serial + BOOT0 jumper: a USB-to-TTL adapter into PA9 (TX)/PA10 (RX), BOOT0 set to 1 before flashing (triggers the built-in USART bootloader), then back to 0 to run normally.
  • Direct USB (advanced): possible once a USB-capable bootloader is flashed onto the chip by one of the two methods above, but only works if the USB pull-up resistor is correct in the first place, see the gotcha above first.

Programming

The most beginner-friendly path is the community-maintained STM32duino “STM32 MCU based boards” package in the Arduino IDE’s Boards Manager, it gives Arduino-style pinMode()/digitalWrite() functions using the same PA/PB/PC pin names printed on the board. STMicroelectronics’ own official tooling, STM32CubeIDE with the HAL/LL libraries, is the alternative for lower-level register access or when a project outgrows the Arduino abstraction, not covered here in code form since it’s a different, larger toolchain.

void setup() {
  pinMode(PC13, OUTPUT);
}

void loop() {
  digitalWrite(PC13, LOW);   // LED on (active-low)
  delay(500);
  digitalWrite(PC13, HIGH);  // LED off
  delay(500);
}

Real gotchas

  • The USB D+ resistor is wrong on many boards. USB needs a 1.5 kΩ pull-up on PA12. Many boards have 10 kΩ or 4.7 kΩ, which stops the PC from seeing the board. Measure it, and replace it or add a 1.5 to 1.8 kΩ resistor in parallel.
  • Do not power from two places. The 5V pins are wired straight to USB 5 V with no protection. Do not feed an external supply and USB at the same time.
  • PC13 is weak and active low. It is for the on-board LED only, and it sinks. Do not drive anything else from it.
  • The BOOT jumpers must be right. BOOT0 at 1 starts the serial bootloader. Leave both at 0 for normal running with an ST-Link.
  • Clones differ. Fake STM32 chips and other markings exist. If the ST-Link does not see the chip, check the ID and the wiring first.
  • No wireless. For Wi-Fi or Bluetooth add an ESP32 or a module over UART.
  • PA11 and PA12 are USB. Do not use them as GPIO while you use USB.
  • The SWD pins are PA13 and PA14. Reconfiguring them as GPIO in code locks you out of debugging.
  • 3.3 V logic. Only 5 V tolerant pins can take a 5 V signal. When in doubt, use a level shifter.

Compared with ESP32 boards

BoardCoreWirelessStrength
Blue Pill (STM32F103)Cortex-M3, 72 MHzNoneVery cheap, many timers, steady real-time behaviour
ESP32-WROOM-32DDual-core Xtensa, up to 240 MHzWi-Fi and BluetoothWireless, more memory

The ESP32 numbers come from its own guide and are not checked again here. See also the XIAO nRF52840 for a low-power Bluetooth board.

What to build with it

  • A motor or stepper controller with timers and PWM.
  • A USB device such as a keyboard or a serial adapter.
  • A data logger with an SD card and a real-time clock.
  • A small instrument with ADC inputs.
  • A bridge that talks to a wireless module over UART.

Safety notes

Before you wire anything up

  • Keep logic signals at 3.3 V unless a pin is known to be 5 V tolerant.
  • Do not connect USB and an external supply at the same time.
  • Check the USB resistor before you blame the driver.
  • Never connect the board to mains voltage. Keep it on a low-voltage supply.
  • Disconnect the power before you change the wiring.

Conclusion

The Blue Pill is a cheap way into real Arm Cortex-M development, with the tradeoff of no built-in wireless (unlike this site’s ESP32 and nRF52840 boards) and two well-known clone-batch defects worth checking before assuming a dead board. Need Wi-Fi or Bluetooth in the same design? Pair it with a separate radio module, or reach for an ESP32 or nRF52840 board instead if the whole project can live on one chip.

Board data is from stm32-base.org. The ST datasheet was not available for this update, so the chip limits are not checked against it.

Advertisement
All guides

More guides

Keep building.

From ESP32 HomeKit accessories to Arduino and ATtiny reference guides, there’s more where this came from.

All guides