LED Blink with STM32Cube Framework
Let's blink an LED on the Blackpill STM32 board using the STM32Cube framework.
STM32Cube Framework
With STM32Cube framework, you can access the full power of the STM32 microcontroller. The STM32Cube framework provides low-level access to the STM32 hardware, allowing you to write code that is more efficient and optimized for performance.
Prerequisites
In this tutorial, the following hardware is used:
Blackpill STM32 board
MCU: STM32F411CEU6
Board: WeAct Black Pill V2.0
Schematic
You can purchase a cheap clone Blackpill STM32 board under $4. You can use other STM32 boards, but you need to modify platformio.ini file and the LED pin number.
ST-LINK V2 Programmer
You need this to upload the firmware to the board. You can purchase a cheap clone ST-LINK V2 under $5.
Installation
VScode with PlatformIO
You can install PlatformIO from the VSCode extension marketplace.
STM32CubeProgrammer
You need this to flash the firmware to the board.
STM32CubeMX
This tool allows you to configure the STM32 microcontroller and generate the initialization code for your project.
Clone the repository
git clone --branch blackpill-led-blink-stm32cube https://github.com/yuichiroaoki/stm32-tutorial.git
cd stm32-tutorial
Quickstart
-
Connect the Blackpill STM32 board to the ST-LINK V2 programmer.

Connect the ST-LINK V2 programmer to the Blackpill STM32 board as shown in the image above. -
Connect the ST-LINK V2 programmer to your computer.
-
Open the project folder in VSCode.
-
Click on the PlatformIO tab on the left sidebar and click on the
Uploadbutton to upload the firmware to the board.
Now you should see the LED on the Blackpill STM32 board blinking.