The STM32 "Blue Pill" is a low-cost development board featuring the STM32F103C8T6, a 32-bit ARM Cortex-M3 microcontroller. It offers 64KB flash memory, 20KB SRAM, and runs at 72MHz. With multiple I/O pins, it supports UART, SPI, I2C, and USB interfaces. Ideal for hobbyists and prototyping, it’s compatible with Arduino and STM32Cube IDE, though it requires careful handling due to its basic design and limited documentation. The board also includes a real-time clock (RTC) clocked at 32MHz by a separate crystal. The microcontroller normally operates at a logic level of 3.3V. While 5V is also possible, only some of the pins are 5V-tolerant.
Microcontroller: | STM32F103C8T6 |
---|---|
Architecture: | 32-bit ARM Cortex-M3 |
Clock Speed: | 72 MHz |
Flash Memory: | 64 KB |
SRAM: | 20 KB |
GPIO Pins: | 37 |
Interfaces: | UART, SPI, I2C, USB |
ADC: | 10 channels, 12-bit |
Timers: | 4 (16-bit) |
Operating Voltage: | 2.0V - 3.6V |
Dimensions: | 53mm × 23mm |
📄 STM32F1xxx datasheet (13119 kB)
However, the STM32 does not have a serial UART interface for programming, so you need to use a serial adapter (FTDI adapter).
Pin | Label | Function |
---|---|---|
1 | PA0 | ADC0 / USART2_CTS |
2 | PA1 | ADC1 / USART2_RTS |
3 | PA2 | ADC2 / USART2_TX |
4 | PA3 | ADC3 / USART2_RX |
5 | PA4 | ADC4 / SPI1_NSS |
6 | PA5 | ADC5 / SPI1_SCK |
7 | PA6 | ADC6 / SPI1_MISO |
8 | PA7 | ADC7 / SPI1_MOSI |
9 | PB0 | ADC8 / TIM3_CH3 |
10 | PB1 | ADC9 / TIM3_CH4 |
11 | PB10 | I2C2_SCL / USART3_TX |
12 | PB11 | I2C2_SDA / USART3_RX |
13 | PB12 | SPI2_NSS |
14 | PB13 | SPI2_SCK |
15 | PB14 | SPI2_MISO |
16 | PB15 | SPI2_MOSI |
17 | PA8 | USART1_CK / MCO |
18 | PA9 | USART1_TX |
19 | PA10 | USART1_RX |
20 | PA11 | USB_DM |
21 | PA12 | USB_DP |
22 | PA13 | SWDIO |
23 | PA14 | SWCLK |
24 | PA15 | JTDI |
25 | PB3 | JTDO / SPI1_SCK |
26 | PB4 | JTRST / SPI1_MISO |
27 | PB5 | I2C1_SMBA / SPI1_MOSI |
28 | PB6 | I2C1_SCL |
29 | PB7 | I2C1_SDA |
30 | PB8 | CAN_RX / TIM4_CH3 |
31 | PB9 | CAN_TX / TIM4_CH4 |
32 | PC13 | Onboard LED |
33 | PC14 | OSC32_IN |
34 | PC15 | OSC32_OUT |
Be aware that pin layouts may vary depending on the FTDI board!
STM32 | FTDI |
---|---|
GND | GND |
5V | VCC (Set jumper to 5V!) |
A9 | Rx |
A10 | Tx |
To be able to program the STM32, it must be put into programming mode. This is done by moving the upper yellow jumper (BOOT0) from position 0 to 1. Then the RESET button must be pressed. The lower jumper BOOT1 remains unchanged.
Thanks to the STM32duino community, it is possible to fully integrate the STM32 into the Arduino IDE:
Go to the menu item Tools > Board > Boards Manager, search for Arduino SAM Boards (ARM Cortex-M3), and install this board manager:
Go to https://github.com/rogerclarkmelbourne/Arduino_STM32
and download the entire package as a ZIP archive (approx. 43MB). Then extract the archive and move the resulting folder
Arduino_STM32 into the Arduino IDE’s sketchbook directory. (On Windows: C:\Users\YOUR_USERNAME\Documents\Arduino\hardware). If the subfolder
hardware does not exist, it must be created manually. Now restart the Arduino IDE.
Under the menu item Tools > Board, the correct board can now be selected along with the appropriate options:
void setup() {
pinMode(PC13, OUTPUT); // internal LED
}
void loop() {
digitalWrite(PC13, !digitalRead(PC13));
delay(1000);
}
Unfortunately, many STM32 boards have a built-in error involving a pull-up resistor. A detailed problem description and possible solutions can be found at amitesh-singh.github.io.