STM32F401 Black Pill

The Blue Pill's faster, tidier successor. The Black Pill is built on the STM32F401CCU6 — an ARM Cortex-M4 with a hardware FPU at 84 MHz, 256 KB flash, 64 KB SRAM, a 12-bit ADC and native USB-C. Best of all, its built-in USB DFU bootloader means you can flash it with no ST-Link. This guide covers the full board anatomy, a complete pinout with every port pin explained, 3.3 V logic & 5 V-tolerance, power, the buses, USB DFU / SWD programming, the BOOT0 button, a Black Pill vs Blue Pill vs Uno comparison, and code and mini-projects.

Complete Learning Path — STM32F401 Black Pill

From board anatomy and the Cortex-M4 STM32F401CCU6, to a full port pinout with every pin detailed, 3.3 V logic, power, digital & analog I/O, PWM, the buses, USB-C DFU / SWD programming, the BOOT0 button, Black Pill vs Blue Pill, code and mini-projects

What is the STM32F401 Black Pill?

The STM32F401 Black Pill is a tiny, low-cost development board built around the STM32F401CCU6 — a 32-bit ARM Cortex-M4 with a hardware floating-point unit (FPU). It is the modern answer to the Blue Pill: faster, more memory, a reliable USB-C port, and a factory USB bootloader so you can flash it with no programmer.

Made popular by WeAct, it drops straight into a breadboard and works with the Arduino IDE (STM32duino core), STM32CubeIDE or PlatformIO.

Labelled STM32F401 Black Pill board anatomy: STM32F401CCU6 Cortex-M4, USB-C, 25 MHz and 32 kHz crystals, NRST and BOOT0 buttons, PWR and PC13 LEDs, the 4-pin SWD header and two 20-pin rows
A map of the Black Pill: the STM32F401CCU6 Cortex-M4, USB-C, a 25 MHz and a 32.768 kHz crystal, the NRST and BOOT0 buttons, the PWR and PC13 LEDs, and the 4-pin SWD header.
Cortex-M4
32-bit + FPU, 84 MHz
256 / 64 KB
Flash / SRAM
USB-C DFU
No ST-Link needed
3.3 V
Many 5 V-tolerant pins

The Brain: STM32F401CCU6

At the centre sits the STM32F401CCU6 — a 32-bit ARM Cortex-M4 clocked to 84 MHz (multiplied by an internal PLL from the 25 MHz crystal). The Cortex-M4 adds a hardware FPU and DSP instructions, so floating-point maths runs far faster than on the Blue Pill's M3.

Block diagram of the STM32F401CCU6: 32-bit ARM Cortex-M4 CPU with FPU at 84 MHz, 256 KB flash, 64 KB SRAM, 30+ GPIO, a 12-bit ADC, timers, USB OTG, UART, SPI and I2C
Inside the STM32F401CCU6: a Cortex-M4 core with FPU + 256 KB flash / 64 KB SRAM + 30+ GPIO, a 12-bit ADC, timers, and native USB OTG.
  • Flash (256 KB) — four times the Blue Pill; plenty of room for big sketches.
  • SRAM (64 KB) — working memory for variables and buffers.
  • No EEPROM — there is no dedicated EEPROM; libraries emulate it in flash.
  • Cortex-M4 + FPU — hardware floating point and DSP, great for audio, sensors and control maths.

Full STM32F401 Black Pill Pinout

Here is the complete pinout. Like every STM32, pins are named by port and number — PA0…PA15, PB0…PB15 and PC13…PC15 — and each has several alternate functions.

Detailed STM32F401 Black Pill pinout: every header pin with its port name (PA/PB/PC) and alternate functions - ADC, PWM timers, SPI, I2C, USART and USB OTG, plus the SWD and BOOT pins
The full Black Pill pinout — the two 20-pin rows with every port pin and its alternate functions. PA13/PA14 are SWDIO/SWCLK on the SWD header; PB2 is BOOT1.

Prefer a simpler view? This colour-coded map groups the pins by function:

Simplified STM32F401 Black Pill functional pinout showing GPIO, PWM, ADC, I2C, USART, SPI, USB and 3.3 V power pins colour-coded
Quick overview — GPIO on port A/C along the top, power and port B below. Everything is 3.3 V logic.

Every Pin Explained

Let's go through each group of pins. On the STM32 a single pin often has many roles — you pick one in software.

GPIO pins (PA / PB / PC)

30+ general-purpose pins that read or write HIGH (3.3 V) or LOW (0 V) with pinMode(), digitalWrite() and digitalRead(). Each handles about 20 mA (25 mA max), with configurable built-in pull-ups and pull-downs.

PC13

The on-board user LED — and it is active-low (LOW = on).

PB6 / PB7

I2C1 (SCL / SDA). Second/third buses: I2C2 & I2C3.

PA9 / PA10

USART1 (TX / RX) — the usual serial console pins.

Timer pins (~)

Many PWM channels across TIM1–TIM5, TIM9–TIM11.

PA11 / PA12

Native USB OTG D− / D+ (the USB-C data lines).

Analog input pins (10 channels)

One 12-bit ADC with 10 external channels, each reading 0–3.3 V as 0–4095:

  • PA0–PA7 (ADC channels 0–7) and PB0, PB1 (channels 8, 9).
  • Read them with analogRead(PA0); call analogReadResolution(12) for the full range.
  • Warning: the ADC pins are not 5 V-tolerant — keep them at 3.3 V max.

The buses (and their pins)

BusBus 1 pinsMore buses
UARTUSART1: PA9 (TX) / PA10 (RX)USART2 (PA2/PA3), USART6
SPISPI1: PA5 SCK, PA6 MISO, PA7 MOSISPI2 (PB13/14/15), SPI3 (PB3/4/5)
I2CI2C1: PB6 (SCL) / PB7 (SDA)I2C2, I2C3
USBUSB OTG: PA11 (D−) / PA12 (D+)on the USB-C connector

Power & programming pins

5V (USB input / output), 3.3V (regulated out), GND, VBAT (backup domain), NRST, plus the 4-pin SWD header (3V3, SWDIO = PA13, SWCLK = PA14, GND). There is no barrel jack.

No CAN on the F401

Unlike the Blue Pill's STM32F103, the STM32F401 has no CAN bus. If your project needs CAN, pick the Blue Pill (or an F405/F446 board) instead. Everything else here is an upgrade.

3.3 V Logic — and the 5 V Trap

Like all STM32 boards, the Black Pill runs at 3.3 V. Most digital pins are 5 V-tolerant as inputs, but the analog pins are not — getting this wrong can damage the chip.

STM32F401 Black Pill 3.3 V logic: a 3.3 V device wires straight through, while a 5 V device needs a level shifter; analog pins are not 5 V-tolerant
3.3 V sensors wire straight through. For 5 V modules use a divider or level shifter — and never put 5 V on an analog pin (PA0–PA7, PB0/PB1).
  • 5 V-tolerant (FT) pins — most PA/PB/PC digital pins can safely read a 5 V input.
  • NOT 5 V-tolerant — the analog pins PA0–PA7, PB0 and PB1, plus a few others.
  • Outputs always swing 0–3.3 V. A 3.3 V HIGH is still read as HIGH by most 5 V chips.

Powering the Black Pill

Power it from USB-C (5 V) or feed 5 V into the 5V pin. An on-board AMS1117 regulator makes the 3.3 V the chip and every GPIO run on.

STM32F401 Black Pill power paths: USB-C or the 5V pin feed the AMS1117 3.3 V regulator, which powers the STM32 and the 3.3V pin
USB-C or the 5V pin → the AMS1117 LDO → the 3.3 V rail for the STM32 and all GPIO. You can also feed a regulated 3.3 V straight into the 3.3V pin.
Feeding 3.3 V directly

If you already have a clean 3.3 V supply, you can power the board through the 3.3V pin and skip the on-board regulator. Don't power both USB and an external 3.3 V at the same time.

Digital I/O

Output a HIGH/LOW to drive an LED or relay, or read a HIGH/LOW input from a button or sensor — all at 3.3 V.

STM32 digital I/O: an output pin driving an LED through a resistor, and an input pin reading a button with the built-in pull-up (INPUT_PULLUP)
Output drives an LED (via a 220 Ω resistor); an input reads a button using the built-in INPUT_PULLUP — no external resistor needed.
// digital output + input (STM32, 3.3 V)
void setup() {
  pinMode(PB9, OUTPUT);          // LED pin
  pinMode(PB5, INPUT_PULLUP);    // button to GND
}
void loop() {
  digitalWrite(PB9, !digitalRead(PB5));   // LED follows the button
}

PWM Output (~)

PWM fakes an analog voltage by switching a pin on and off fast. The STM32F401 has powerful timers giving many PWM channels across the PA/PB pins.

STM32 PWM: three duty cycles (25%, 50%, 75%) and their average voltages at 3.3 V, set with analogWrite on a timer pin
Higher duty → higher average voltage (of 3.3 V). Use analogWrite(pin, 0–255) on any timer pin such as PA8.
// fade an LED on a PWM/timer pin (PA8)
void setup() { pinMode(PA8, OUTPUT); }
void loop() {
  for (int v = 0; v <= 255; v++) { analogWrite(PA8, v); delay(5); }
  for (int v = 255; v >= 0; v--) { analogWrite(PA8, v); delay(5); }
}

Analog Input (ADC)

The Black Pill's 12-bit ADC is far finer than an Uno's 10-bit one. Each reading turns 0–3.3 V into 0–4095 — about 0.8 mV per step.

STM32 analog input: a potentiometer feeding PA0, and the 12-bit ADC mapping 0-3.3 V to 0-4095
A potentiometer on PA0 → the ADC reads 0–4095. Convert to volts with v * 3.3 / 4095.0. Keep analog pins at 3.3 V max.
// read a 12-bit analog input on PA0
void setup() {
  Serial.begin(115200);
  analogReadResolution(12);        // full 0..4095 range
}
void loop() {
  int raw = analogRead(PA0);         // 0..4095
  float volts = raw * 3.3 / 4095.0;
  Serial.println(volts);
  delay(200);
}

UART, SPI & I2C

The STM32F401 is generous with buses: three UARTs, three SPI and three I2C — plus native USB OTG. (It has no CAN, unlike the Blue Pill.)

STM32F401 Black Pill communication buses: USART1 on PA9/PA10, SPI1 on PA5/PA6/PA7, I2C1 on PB6/PB7, plus native USB OTG
USART1 on PA9/PA10, SPI1 on PA5/PA6/PA7, I2C1 on PB6/PB7 — each with a second and third copy, plus USB OTG.

How Code Gets onto the Black Pill

The Black Pill's best trick: a built-in USB DFU bootloader, so you can flash it straight over USB-C with no ST-Link.

STM32F401 Black Pill programming flow: write in the IDE, compile, enter DFU with BOOT0 + NRST, flash over USB-C, then run from flash
Write → compile → enter DFU mode (BOOT0 + NRST) → flash over USB-C → the code runs from flash. No ST-Link required.
Arduino IDE setup

Install the “STM32 MCU based boards” core, pick Generic STM32F4 → Black Pill F401CC, and set the upload method to STM32CubeProgrammer (DFU). Put the board in DFU mode first (see below). Prefer debugging? Use an ST-Link on the SWD header instead.

The BOOT0 Button & DFU Mode

Where the Blue Pill uses jumpers, the Black Pill has a BOOT0 button. Use it with NRST to drop into USB DFU mode.

STM32F401 Black Pill BOOT0 button and DFU: hold BOOT0, tap NRST, release to enter USB DFU mode; a table of BOOT0 boot modes
Hold BOOT0, tap NRST, release — the board appears as a USB DFU device. BOOT0 = 0 (normal) runs your program from flash.

After flashing, just press NRST on its own (without BOOT0) to run your program. You only hold BOOT0 when you want to upload.

Black Pill vs Blue Pill vs Arduino Uno

Should you get a Black Pill or a Blue Pill? The Black Pill is faster and easier to flash; the Blue Pill keeps CAN and the ST-Link workflow.

Comparison table of the STM32F401 Black Pill, STM32F103 Blue Pill and Arduino Uno: core, clock, memory, logic voltage, ADC, buses, CAN, USB and programming
The Black Pill wins on speed (Cortex-M4 + FPU), memory, USB-C and DFU flashing; the Blue Pill keeps CAN. Both dwarf the 8-bit Uno.

Choose the Black Pill for the most power, the FPU, USB-C and no-programmer flashing; choose the Blue Pill if you need CAN or already use ST-Link; choose the Uno/Nano for 5 V shields and the biggest beginner ecosystem. For a 32-bit ARM board that uploads over USB like an Arduino, see the Arduino Due.

Code Examples

The everyday building blocks, written for the STM32duino core.

1. Blink the on-board PC13 LED (active-low)

void setup() { pinMode(PC13, OUTPUT); }
void loop() {
  digitalWrite(PC13, LOW);  delay(1000);   // LED on
  digitalWrite(PC13, HIGH); delay(1000);   // LED off
}

2. Fast floating-point maths (the FPU at work)

void setup() { Serial.begin(115200); }
void loop() {
  float sum = 0;
  for (int i = 1; i <= 1000; i++) sum += sqrtf(i) * sinf(i);  // FPU-accelerated
  Serial.println(sum, 4);
  delay(500);
}

3. Talk to a module on USART1 (PA9 / PA10)

// Serial1 is USART1 on PA9 (TX) / PA10 (RX)
void setup() {
  Serial.begin(115200);      // USB to PC
  Serial1.begin(9600);       // module on PA9/PA10
}
void loop() {
  if (Serial1.available()) Serial.write(Serial1.read());
}

Beginner Mini-Projects

Four small builds that show off the Black Pill's strengths.

STM32 Blink project: the on-board PC13 LED and an external LED with a 220 ohm resistor on PB9, with the active-low blink sketch
Project 1 wiring — blink the active-low PC13 LED (works with no parts) or add your own on PB9.

Project 1 — Blink the PC13 LED

Parts: none — PC13 already has an on-board LED. Remember it is active-low.
void setup() { pinMode(PC13, OUTPUT); }
void loop() {
  digitalWrite(PC13, LOW);  delay(500);
  digitalWrite(PC13, HIGH); delay(500);
}

Project 2 — Button with a built-in pull-up

Parts: 1 push-button between PB5 and GND. No resistor needed — the STM32 has internal pull-ups.
void setup() {
  pinMode(PC13, OUTPUT);
  pinMode(PB5, INPUT_PULLUP);
}
void loop() {
  if (digitalRead(PB5) == LOW) digitalWrite(PC13, LOW);   // pressed = LED on
  else                          digitalWrite(PC13, HIGH);
}

Project 3 — 12-bit potentiometer meter

Parts: a potentiometer on PA0 (3.3 V and GND on the ends). Read its fine 12-bit value over USB.
void setup() {
  Serial.begin(115200);
  analogReadResolution(12);
}
void loop() {
  int raw = analogRead(PA0);
  Serial.println(raw * 3.3 / 4095.0, 3);   // volts
  delay(100);
}

Project 4 — I2C scanner on PB6/PB7

Parts: any I2C module. Wire SDA → PB7, SCL → PB6, then scan the bus with the Wire library.
#include <Wire.h>
void setup() {
  Serial.begin(115200);
  Wire.begin();                 // I2C1: SCL=PB6, SDA=PB7
}
void loop() {
  for (byte a = 1; a < 127; a++) {
    Wire.beginTransmission(a);
    if (Wire.endTransmission() == 0) { Serial.print("found 0x"); Serial.println(a, HEX); }
  }
  delay(2000);
}

Specifications

The STM32F401 Black Pill at a glance.

STM32F401 Black Pill specifications table: STM32F401CCU6 Cortex-M4 with FPU, 84 MHz, 3.3 V, 256 KB flash, 64 KB SRAM, 30+ GPIO, 12-bit ADC, USB-C, DFU
Key numbers for the Black Pill — MCU, core, clock, memory, GPIO, ADC, buses and programming.

Key Terms — Glossary

TermMeaning
STM32F401CCU6The Black Pill's 32-bit ARM Cortex-M4 microcontroller.
Cortex-M4ARM's 32-bit core with a hardware FPU, running at 84 MHz here.
FPUFloating-point unit — does decimal maths in hardware, fast.
DFUDevice Firmware Upgrade — flash over USB with no programmer.
BOOT0 buttonHeld with NRST to enter DFU / the system bootloader.
SWDSerial Wire Debug — the 2-wire program/debug interface.
Port pin (PAx)STM32 naming: port letter + number, e.g. PA5, PB7, PC13.
5 V-tolerant (FT)A pin that can safely accept a 5 V input despite 3.3 V logic.
PC13 LEDThe on-board user LED — active-low (LOW = on).
STM32duinoThe Arduino core that programs STM32 boards with Arduino code.

Frequently Asked Questions

Quick answers to the questions people ask most about the STM32F401 Black Pill.

What is the STM32F401 Black Pill?

A tiny, low-cost board built on the STM32F401CCU6, a 32-bit ARM Cortex-M4 with a hardware FPU at 84 MHz, with 256 KB flash and 64 KB SRAM. It has 30+ GPIO, a 12-bit ADC, many PWM timers, three UARTs, three SPI, three I2C and native USB on USB-C — and it flashes over USB with no ST-Link.

Black Pill vs Blue Pill — what's different?

The Black Pill (F401) is a faster Cortex-M4 with an FPU at 84 MHz, 256 KB/64 KB memory, USB-C and built-in USB DFU. The Blue Pill (F103) is a Cortex-M3 at 72 MHz with 64 KB/20 KB, micro-USB, a CAN bus, and usually needs an ST-Link. The F401 has no CAN.

How do I program it?

Easiest is USB DFU: hold BOOT0, tap NRST, release, then upload over USB-C with the STM32CubeProgrammer (DFU) method — no ST-Link. You can also use an ST-Link on the SWD header (adds debugging) or upload over serial. Use the STM32duino core to write Arduino sketches.

Is it 5 V-tolerant?

It runs at 3.3 V. Most digital PA/PB/PC pins are 5 V-tolerant as inputs (marked FT), so they can read 5 V signals. But the analog pins (PA0–PA7, PB0, PB1) are NOT 5 V-tolerant, and outputs only swing 0–3.3 V. Never put 5 V on an analog pin.

How do I enter DFU mode?

Hold the BOOT0 button, briefly tap NRST while still holding BOOT0, then release. The board appears to the PC as a USB DFU device, ready to flash over USB-C. After flashing, press NRST on its own to run your program from flash.

Does the F401 have CAN?

No. The STM32F401 has no CAN controller. If you need CAN, choose the Blue Pill (STM32F103) or a higher STM32F4 such as the F405/F446. Everything else on the Black Pill is a step up from the Blue Pill.

Which pin is the on-board LED?

The user LED is on PC13 and is active-low: digitalWrite(PC13, LOW) turns it on and HIGH turns it off. A separate red PWR LED lights whenever the board is powered.

Where are UART, SPI and I2C?

USART1 on PA9/PA10 (plus USART2 PA2/PA3 and USART6); SPI1 on PA5/PA6/PA7 (plus SPI2 PB13/14/15 and SPI3 PB3/4/5); I2C1 on PB6/PB7 (plus I2C2 and I2C3). Native USB OTG is on PA11/PA12 (the USB-C data lines).

Conclusion & Key Takeaways

The STM32F401 Black Pill is the Blue Pill done better — faster Cortex-M4 with an FPU, more memory, USB-C, and flashing with no programmer.

Cortex-M4 + FPU

32-bit, 84 MHz.

256 / 64 KB

Flash / SRAM.

USB-C DFU

No ST-Link needed.

3.3 V logic

Many 5 V-tolerant pins.

12-bit ADC

3 UART/SPI/I2C.

PC13 LED

Active-low.

Continue Learning