🛠 Passer au niveau supérieur : STM32CubeIDE, HAL et LL sur F103
Why leave (a little) Arduino
The Arduino core stm32duino is itself built on top of STM32Cube HAL/LL + CMSIS + GNU Arm GCC. Working directly within the ST toolchain gives you control over the clock tree, DMA routing, interrupts, and power consumption — while keeping the graphical code generation of STM32CubeMX and the embedded IDE STM32CubeIDE. For flashing: STM32CubeProgrammer (CLI STM32_Programmer_CLI or GUI), which communicates via SWD with the board's 4-pin connector.
Context note: ST's legacy Standard Peripheral Library (SPL) is documented as deprecated — tutorials still using it should be considered historical; the SPL has been replaced by Cube HAL/LL.
Configuring the Blue Pill project in CubeMX
- Select the part number STM32F103C8T6 (LQFP48, 64 KB flash / 20 KB SRAM).
- Clocks: the board's crystal is an HSE 8 MHz (plus an LSE 32.768 kHz for the RTC); the PLL boosts it to 72 MHz, the maximum frequency for the F103 line as stated on the ST product page.
- Enable SWD in Serial Wire mode (PA13/PA14) from the start, otherwise subsequent debugging will end up requiring a forced re-flash via the ROM serial bootloader.
- The flash page size is 1 KB (for densities up to 128 KB) — important for EEPROM emulation and write management.
What the silicon says (CMSIS)
The ST device header stm32f103xb.h (cmsis_device_f1 repository) defines the physical limits: Cortex-M3 r2p0 single-core, no FPU (the M3 does not have one), __MPU_PRESENT 0 (no MPU), 4 bits of NVIC priority. In other words: no hardware floating-point (emulated in software, CPU cost), no memory isolation, no encryption engine — the F103's strengths are price and peripherals (CAN, 3 USARTs, 2 SPIs, 2 I2Cs, 2 12-bit ADCs, 7-channel DMA), not security.
The right documentation habit
The Reference Manual RM0008 (CD00171194 on st.com) is the source of truth for registers, boot modes, and the ROM bootloader; the datasheet cd00161566.pdf details the electrical characteristics. Both are official ST PDFs — in case of contradiction between a blog post and these documents, the latter prevail.
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)
- Alimenter et flasher la Blue Pill : BOOT0, port série, ST-Link et DFU
- 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
- Firmware libre sur Blue Pill avec libopencm3 et OpenOCD