The STM32 Blue Pill and Black Pill can be programmed in two very different ways: through the familiar Arduino ecosystem using the official STM32 core, or through STMicroelectronics’ own STM32Cube development tools.
Both routes ultimately compile C/C++ for the same microcontroller. The difference is how much of the STM32 hardware is hidden behind convenience layers and how much control you want over clocks, peripherals, DMA, interrupts, linker settings and debugging.
For quick projects, sensors and Arduino-library compatibility, the official Arduino STM32 core is faster to get running. For larger firmware, advanced peripherals, professional debugging and full STM32 control, STM32CubeIDE/CubeMX is the better long-term workflow. There is also a useful middle ground: Arduino code on STM32 while still dropping down into HAL, LL or CMSIS when required.
STM32CubeIDE vs Arduino Core: Quick Comparison
| Feature | Arduino STM32 Core | STM32CubeIDE / CubeMX |
|---|---|---|
| First project setup | Very fast | More steps |
| Arduino libraries | Native Arduino ecosystem | Manual porting/integration |
| GPIO / I²C / SPI / UART | Simple Arduino APIs | HAL/LL or direct register configuration |
| Pin configuration | Board defaults + code | Graphical CubeMX pin planner |
| Clock tree | Mostly preconfigured by core | Full graphical configuration |
| DMA | Possible, but less beginner-friendly | First-class STM32 workflow |
| Interrupt control | Arduino APIs + underlying STM32 APIs | Full HAL/LL/NVIC control |
| Debugging | Possible with SWD/OpenOCD, less integrated | Integrated ST-Link/J-Link debugging |
| RTOS setup | Possible with libraries | CubeMX/CMSIS-RTOS/FreeRTOS workflow |
| USB configuration | Convenient predefined support | Fine-grained middleware/device setup |
| Code portability to Arduino boards | High | Low |
| STM32 hardware control | Good | Excellent |
| Best for | Fast prototypes and Arduino users | Complex/production STM32 firmware |
What the Official Arduino STM32 Core Actually Is
The official Arduino_Core_STM32 is not a completely separate hardware abstraction layer written from scratch. It is built on ST’s STM32Cube packages and uses the same underlying HAL/LL and CMSIS infrastructure.
That means an Arduino sketch such as:
void setup() {
pinMode(PC13, OUTPUT);
}
void loop() {
digitalWrite(PC13, LOW);
delay(500);
digitalWrite(PC13, HIGH);
delay(500);
}
eventually reaches STM32 hardware through the core’s implementation and ST’s device support. The Arduino layer gives you simpler APIs and board defaults, but the underlying MCU remains fully STM32.
Current Arduino STM32 Core in 2026
The current official STM32 Arduino core release is 3.0.0. Since core 2.8.0, Arduino IDE 2 is the supported Arduino development environment for current releases.
The core directly supports common boards including:
- STM32F103C8/C6/CB Blue Pill.
- WeAct STM32F401CC Black Pill.
- WeAct STM32F401CE Black Pill.
- WeAct STM32F411CE Black Pill.
- Many Nucleo, Discovery, Eval and generic STM32 boards.
That makes Blue Pill and Black Pill much easier to use today than the old STM32 Arduino ecosystem based on unofficial Maple-era cores.
What STM32CubeIDE Is
STM32CubeIDE is STMicroelectronics’ integrated C/C++ development environment for STM32 devices. It combines project management, compilation, debugging and STM32-specific device support.
As of 2026, ST offers two main IDE directions:
- STM32CubeIDE based on Eclipse/CDT.
- STM32CubeIDE for VS Code, a newer VS Code-based environment with CMake-oriented workflow.
ST is increasingly focusing development effort on the VS Code-based variant, but the Eclipse-based CubeIDE remains active and supports the full STM32 MCU/MPU portfolio.
Where STM32CubeMX Fits In
STM32CubeMX is the graphical configuration tool used to set up MCU pins, clocks, peripherals, DMA, middleware and code generation.
Instead of manually remembering whether PB6 can be I²C1 SCL or which timer channel maps to a specific pin, CubeMX shows the legal alternate functions and highlights conflicts.
Select MCU
↓
Configure pins
↓
Configure clocks
↓
Enable peripherals
↓
Configure DMA / interrupts
↓
Generate initialization code
↓
Write application logic
For complex STM32 projects, this graphical view is one of the biggest reasons to move beyond a pure Arduino workflow.
Blue Pill in Arduino IDE
For an STM32F103C8 Blue Pill, Arduino IDE gives a very fast route into the board.
- Install the official STM32 MCU based boards package.
- Select the Blue Pill / STM32F103C8 target.
- Use PAx/PBx/PCx pin names directly.
- Upload with ST-Link, UART bootloader or supported USB bootloader configuration.
The classic Blue Pill does not have factory USB DFU in the STM32F103C8 system bootloader. ST-Link over SWD remains the most reliable first-programming and recovery method.
Black Pill in Arduino IDE
The STM32F401/F411 Black Pill experience is generally smoother because these devices support factory USB DFU.
For an F411CE board, a typical workflow is:
- Install STM32 MCU based boards.
- Select the WeAct/BlackPill F411CE target.
- Choose a suitable upload method such as DFU or ST-Link.
- Use Arduino libraries and the real STM32 pin names.
An ST-Link is still worth owning because USB firmware bugs cannot lock you out of SWD debugging or recovery.
The Main Arduino Advantage: Time to First Result
Arduino is hard to beat when the project is conceptually simple.
Reading an I²C sensor may be only a few lines:
#include <Wire.h>
void setup() {
Wire.begin();
Serial.begin(115200);
}
void loop() {
// use sensor library
}
The equivalent CubeIDE project needs clock initialization, GPIO configuration, I²C peripheral setup and HAL calls before the application logic begins. CubeMX generates much of this, but the project structure is still more explicit.
The Main CubeIDE Advantage: You Control the MCU, Not Just the Board
Arduino thinks primarily in terms of a development board. CubeIDE/CubeMX thinks in terms of the actual STM32 microcontroller and its peripheral matrix.
That becomes important when the project needs:
- Specific timer channels.
- DMA chains.
- Multiple SPI/UART/I²C instances.
- Precise clock frequencies.
- Low-power modes.
- Custom interrupt priorities.
- Advanced ADC triggering.
- Timer-triggered ADC or DAC.
- Complex USB classes.
- FreeRTOS with explicit task/interrupt design.
GPIO: Arduino Is Simpler
Arduino uses familiar calls such as pinMode(), digitalWrite() and digitalRead().
CubeIDE using HAL may look more like:
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET);
HAL_Delay(500);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_SET);
HAL_Delay(500);
The CubeIDE version is more verbose but makes the port and pin explicit and integrates cleanly with generated initialization code.
HAL vs LL vs Direct Registers
Cube projects commonly use ST’s HAL APIs. HAL prioritizes portability and readability over minimal overhead.
ST also provides LL — Low Layer APIs for tighter control and lower overhead. Below both layers, you can access CMSIS register definitions directly.
Arduino API
↓
STM32 Arduino core
↓
HAL / LL / CMSIS
↓
STM32 peripheral registers
The important point is that Arduino does not lock you out of low-level STM32 features. Advanced users can mix Arduino code with HAL, LL and CMSIS where necessary.
You Can Call HAL from an Arduino STM32 Sketch
Because the official STM32 Arduino core is based on STM32Cube packages, you can access STM32 HAL functionality from an Arduino project when the core exposes the relevant headers and peripheral setup.
That makes Arduino useful as a stepping stone rather than a dead end. A project can start with Wire and SPI, then use hardware timers, DMA or CMSIS-DSP as requirements grow.
CubeMX Pin Planning Is Much Better for Complex Projects
On an STM32, many pins have several alternate functions. One PA pin may support UART, timer PWM, SPI or another peripheral depending on AF selection.
Arduino board variants define sensible defaults, but once you need five peripherals simultaneously, conflicts become much easier to create.
CubeMX shows these conflicts visually and can reject invalid combinations before you write firmware.
Clock Configuration
In Arduino, the board variant normally initializes the system clock for you. That is ideal when you simply want an F103 running at 72 MHz or an F411 at its normal board clock.
CubeMX exposes the full clock tree:
- HSE / HSI source.
- PLL multipliers/dividers.
- AHB clock.
- APB1/APB2 clocks.
- USB clock.
- Timer clocks.
- Peripheral kernel clocks where supported.
For standard hobby projects, Arduino defaults save time. For USB, audio, high-speed timers or precise peripheral timing, explicit clock configuration is a major advantage.
Timers
The official STM32 Arduino core includes a HardwareTimer API, so Arduino projects can use STM32 timers for much more than analogWrite().
However, CubeIDE gives you the full STM32 timer configuration model: prescaler, ARR, output compare, input capture, encoder mode, master/slave triggering, repetition counters, DMA and interrupts.
If your project is mostly about timers rather than using timers as a support function, CubeIDE usually becomes easier to reason about.
ADC and DMA
Arduino’s analogRead() is perfect when you need occasional sensor values.
It becomes awkward when you want:
- Timer-triggered ADC conversion.
- Continuous circular DMA buffer.
- Synchronized multi-channel acquisition.
- Precise sample frequency.
- Low-overhead high-rate acquisition.
That is CubeMX territory. Configure ADC + timer trigger + DMA graphically, generate initialization, then process buffers in callbacks or RTOS tasks.
Interrupts
Arduino’s attachInterrupt() is simple and portable. CubeIDE exposes the real EXTI and NVIC configuration including interrupt priorities.
For systems using USB, DMA, timers, communication stacks and RTOS tasks simultaneously, priority design matters. CubeMX makes that architecture explicit.
Debugging Is Where CubeIDE Pulls Ahead
Serial prints are useful, but they are not a debugger.
STM32CubeIDE with ST-Link or J-Link can provide:
- Breakpoints.
- Single-step execution.
- Live register inspection.
- Memory view.
- Peripheral/SFR register view.
- Call stack.
- Fault analysis.
- RTOS-aware debugging.
- Watch expressions.
This is a massive advantage for hard faults, DMA bugs, stack corruption and race conditions.
Can You Debug Arduino STM32 Code with ST-Link?
Yes, but the workflow is not as integrated or consistent as CubeIDE’s native debug experience. Depending on the IDE/tooling, OpenOCD, GDB or external extensions may be involved.
If breakpoints and low-level debugging are central to the project rather than occasional rescue tools, CubeIDE is the more natural environment.
Library Ecosystem
Arduino wins immediately if your project depends on hobby/community libraries.
- Displays.
- Environmental sensors.
- IMUs.
- GPS modules.
- Radio modules.
- LED drivers.
- Simple filesystems and peripherals.
Many libraries compile on STM32 with little or no change because they target Arduino APIs rather than a specific AVR or ESP32 chip.
In CubeIDE, the same sensor may require an ST-independent C library, manual porting or writing the driver from the datasheet.
The Catch with Arduino Libraries
Not every Arduino library is truly portable. Some contain AVR registers, ESP32-specific APIs or assumptions about timer architecture.
Before choosing Arduino solely for a library, check whether it actually supports STM32.
Code Size and Overhead
Arduino adds framework code and convenience layers, but modern STM32 boards generally have enough Flash for this to be acceptable in ordinary projects.
CubeIDE gives finer control over what middleware and initialization code is included. In tightly constrained or safety-reviewed firmware, that explicitness is valuable.
The performance difference is also workload-dependent. A slow application caused by an inefficient algorithm will not become fast simply by moving from Arduino to HAL.
USB
Arduino makes common USB device modes relatively approachable on supported STM32 boards.
CubeIDE/CubeMX gives much more control over USB middleware, descriptors, endpoints and class configuration.
For a simple USB serial device, Arduino is faster. For a custom composite USB device, CubeIDE usually scales better.
FreeRTOS
Arduino projects can use RTOS-style libraries or direct STM32 facilities, but CubeMX has a more formal workflow for configuring FreeRTOS/CMSIS-RTOS projects.
You can configure tasks, stack sizes, priorities, queues and middleware as part of the project architecture.
Once firmware has many concurrent tasks and interrupt interactions, CubeIDE’s explicit model tends to be easier to maintain.
STM32CubeIDE for VS Code Changes the Old Argument
Historically, one complaint about CubeIDE was that the Eclipse interface felt heavy compared with Arduino IDE or VS Code.
ST now provides a VS Code-based STM32CubeIDE variant as well. It targets developers who prefer a modern code-centric editor, CMake/Ninja workflows, extensions and CI/CD integration.
That means choosing the STM32Cube ecosystem no longer automatically means choosing Eclipse.
Arduino Is Still Better for Learning by Doing
If somebody understands Arduino but has never used STM32 directly, jumping immediately into RCC, GPIO initialization, NVIC, DMA and HAL handles can hide the actual project behind tooling.
Arduino lets you learn the STM32 hardware gradually while still using familiar code.
A sensible progression is:
Arduino APIs
↓
STM32 pin names + board-specific peripherals
↓
HardwareTimer / STM32duino APIs
↓
HAL / CMSIS inside Arduino
↓
CubeMX / CubeIDE project
CubeIDE Is Better for Learning STM32 Properly
If your goal is not simply to finish a sensor project but to understand STM32 microcontrollers deeply, CubeIDE/CubeMX is the better educational environment.
You are forced to understand:
- Clock sources and bus clocks.
- Peripheral instances.
- Alternate-function mapping.
- DMA streams/channels where applicable.
- NVIC priorities.
- HAL handles.
- Startup code.
- Linker scripts and memory regions.
Those concepts transfer directly to custom STM32 PCBs and professional embedded development.
Blue Pill: Which Environment Makes More Sense?
For a Blue Pill beginner, Arduino IDE is usually easier because the F103 ecosystem has years of Arduino examples and the board is resource-limited enough that simple projects fit naturally.
For CAN, timer-heavy, motor-control or custom PCB work, CubeIDE is worth learning because the STM32F103’s peripheral set is more capable than most Arduino-style examples expose.
Black Pill: Which Environment Makes More Sense?
The F401/F411 Black Pill is powerful enough that either environment works well.
Arduino is excellent for:
- Fast prototyping.
- USB HID/CDC experiments.
- Displays and sensors.
- Arduino-compatible libraries.
- General control projects.
CubeIDE is excellent for:
- DSP and high-rate acquisition.
- DMA-heavy designs.
- RTOS firmware.
- Complex USB.
- Custom board development.
- Motor control.
- Professional debugging.
ST-Link Matters in Both Workflows
An ST-Link is not only a programmer. It gives you SWD access to the MCU.
Even if you normally upload an F411 Black Pill through USB DFU, SWD gives you a recovery and debugging path when USB firmware breaks or the board no longer enumerates.
For Blue Pill development, ST-Link is even more valuable because the F103 factory bootloader does not provide USB DFU.
Porting an Arduino Project to CubeIDE
Do not try to translate every Arduino function line-for-line.
Instead, identify the hardware subsystems:
digitalWrite()→ GPIO.Wire→ I²C peripheral.SPI→ SPI peripheral.HardwareSerial/Uart→ USART/UART.analogRead()→ ADC.attachInterrupt()→ EXTI/NVIC.- Arduino timing → HAL tick, hardware timer or RTOS timing.
Then configure those peripherals in CubeMX and port the application logic on top.
Do Not Mix Generated Cube Code Carelessly
CubeMX marks specific USER CODE regions so your application code can survive code regeneration.
/* USER CODE BEGIN 2 */
/* your initialization */
/* USER CODE END 2 */
If you edit generated sections outside protected regions, regenerating the CubeMX project may overwrite your changes.
This is one of the biggest workflow differences for developers coming from Arduino, where the sketch is almost entirely user-owned code.
Version Control
Both workflows belong in Git.
For Arduino, commit the sketch/project plus any local source libraries and document the STM32 core version.
For Cube projects, commit source, project configuration and the .ioc file so the peripheral configuration can be reproduced.
Avoid relying on a future IDE installation to guess which framework version produced working firmware.
A Practical Decision Table
| Project | Better starting point |
|---|---|
| Blink / sensors / display | Arduino |
| Existing Arduino library stack | Arduino |
| Simple USB HID | Arduino |
| Learn STM32 peripherals deeply | CubeIDE/CubeMX |
| High-rate ADC + DMA | CubeIDE/CubeMX |
| Complex timers / motor control | CubeIDE/CubeMX |
| FreeRTOS product firmware | CubeIDE/CubeMX |
| Quick one-off prototype | Arduino |
| Custom STM32 PCB | CubeIDE/CubeMX |
| Need advanced SWD debugging | CubeIDE |
| Migrating from ESP32/Arduino | Start Arduino, move lower-level as needed |
When I Would Stay with Arduino
- The project already works reliably.
- The libraries I need are maintained in the Arduino ecosystem.
- Timing requirements are modest.
- I do not need complicated DMA/peripheral chaining.
- I value development speed more than low-level control.
- The firmware is a prototype or personal project.
There is no reward for rewriting a stable Arduino project in HAL just to make it look more professional.
When I Would Move to CubeIDE
- The project depends on precise peripheral timing.
- I need deterministic DMA pipelines.
- Interrupt priorities are becoming important.
- The Arduino abstraction is fighting the hardware.
- I need integrated debugging and fault analysis.
- The firmware is moving toward a product/custom PCB.
- I need to document exact clock and peripheral configuration.
The signal that it is time to move is usually not project size in lines of code. It is when the hardware architecture matters more than the convenience API.
Best Hybrid Approach
For many engineers, the best route is not choosing one environment forever.
Prototype the peripheral or algorithm quickly in Arduino. Once the hardware concept is proven, either keep the Arduino project and selectively use STM32 HAL/LL, or move the mature design into CubeMX/CubeIDE.
This avoids spending days building infrastructure for a concept that might not work, while still giving you a path to a cleaner low-level implementation later.
Final Recommendation
Use the official STM32 Arduino core when you want to get a Blue Pill or Black Pill doing useful work quickly. It is mature, uses ST’s own HAL/LL foundation, supports the common boards directly and gives you access to a huge library ecosystem.
Use STM32CubeIDE/CubeMX when the project depends on the actual STM32 peripheral architecture: DMA, timers, low-power modes, advanced USB, RTOS, interrupt priorities, precise clocks or serious debugging.
For a beginner coming from Arduino, I would start with Arduino IDE 2 and the official STM32 core. For an engineer building custom STM32 hardware or complex real-time firmware, I would learn CubeMX/CubeIDE early. The good news is that the skills are not mutually exclusive—the Arduino core itself sits on the STM32Cube ecosystem, so understanding one makes the other easier.
Related STM32 Guides
- STM32F103C8T6 Blue Pill Pinout, GPIOs & Arduino IDE Guide
- STM32F411 Black Pill Pinout, GPIOs, USB & Arduino Guide
- STM32 Blue Pill vs Black Pill: F103 vs F411
- STM32F401 vs STM32F411 Black Pill: Which Board Should You Buy?
Official Resources
- STMicroelectronics STM32CubeIDE — official STM32 C/C++ development and debugging environment.
- STMicroelectronics STM32CubeMX — graphical pin, clock and peripheral configuration/code generation.
- Official Arduino Core for STM32 — current STM32duino core and supported boards.
- Arduino Core for STM32 Releases — current release history and breaking changes.