Black Pill (STM32F401CE) Pinout, Datasheet, Schematic [Ultimate Guide]

In this guide, you’ll find the Black Pill F401CE pinout diagram (both side headers and the SWD header), the datasheet and schematic, and every pin group explained with its default pins and gotchas. Without further ado, let’s get right into it!

The Black Pill F401CE is WeAct Studio’s “Black Pill” core board with the STM32F401CEU6, an 84MHz Arm Cortex-M4 with FPU, 512KB Flash and 96KB RAM. It packs 32 GPIO pins on two breadboard-friendly headers, a USB-C port wired to the MCU’s own USB, and a 25MHz crystal, on a board just 21mm wide.


Black Pill F401CE Pinout Diagram

Here is a detailed Black Pill F401CE Pinout Diagram with colored labels and legends to help you easily identify the functionalities that each pin can perform. It covers both 20-pin side headers (P2 on the left, P1 on the right) and the 4-pin SWD header (P3) at the end of the board.

WeAct Black Pill STM32F401CEU6 pinout diagram with GPIO, ADC, PWM, UART, SPI, I2C, USB and SWD pin functions
Black Pill STM32F401CEU6: headers P1, P2 and the SWD header P3

Each row shows the header pin number, the silkscreen label (B12, A8…), the STM32 GPIO name and its alternate functions, color-coded by peripheral. The small dot marks a 5v-tolerant pin, the square marks PB5 (keep it at 3.3v or below, see the errata note), and the numbered badges point to the notes at the bottom of the diagram.

Pin 1 of each header has a square pad. With the USB-C connector at the top, P2 (left) runs from B12 (pin 1) down to 3V3 (pin 20), and P1 (right) runs from 5V (pin 1) down to VB (pin 20). The two headers are 15.24mm (600 mil) apart, so the board fits a standard breadboard.

Buy an STM32F401 Black Pill: If you don’t have one yet, you can get one from Amazon or AliExpress. WeAct has discontinued the F401CE, so most F401 boards sold today carry the STM32F401CCU6, which has the same pinout with 256KB of Flash.

Download Black Pill F401CE Pinout Diagram (Full Resolution)

The Black Pill F401CE pinout diagram (P1, P2 and SWD headers) in full resolution (5120×3460 px WebP), in one ZIP file. Print it, zoom in, or keep it next to your bench. Please consider supporting my work if it helped you.


Black Pill F401CE Datasheet

This development board is built around the STM32F401CEU6 microcontroller (UFQFPN48 package). ST doesn’t make the board, so the Black Pill F401CE datasheet set has two parts: ST’s documents for the chip, and WeAct Studio’s own files for the board, all linked to their official sources:

DocumentIDRevisionWhat you’ll use it forLink
STM32F401xD/xE datasheetDS10086Rev 5 (Mar 2026)Pin definitions (FT), alternate-function table, electrical limitsPDF
STM32F401xB/C and xD/E reference manualRM0368Rev 6 (Feb 2025)Registers and how every peripheral worksPDF
STM32F401xD/xE errata sheetES0299Rev 6 (Feb 2025)Silicon limitations (PB5 and PA0 voltage, PC13 and the LSE)PDF
System memory boot modeAN2606Rev 71 (Nov 2026)Bootloader pins (USART1, I2C, SPI, USB DFU) and the HSE detectionPDF
WeAct MiniF4x1Cx schematicMiniF4 V3.1V3.1 (Apr 2021)Full board circuit (see the next section)PDF
WeAct board outlineMiniF4x1Cx V3.1V3.1Board size and hole positions for your own PCB or enclosurePDF
WeAct STM32F4x1 pin layout–v2.0+ boardsWeAct’s own pin-function sheet for the F401/F411 Black PillPDF

Which document do I need? The datasheet for pin functions and electrical limits, the reference manual for registers, the errata before you connect 5v signals, and the WeAct schematic for what’s on the board. The chip documents are listed on ST’s STM32F401CE product page, and the board files are in WeAct’s official WeActStudio.MiniSTM32F4x1 GitHub repository.


Black Pill F401CE Schematic

The Black Pill F401CE schematic is shown below. It’s one sheet shared by the F401CC, F401CE, and F411CE boards, so here is the full sheet followed by close-ups of each block; click a page to view it full screen.

Black Pill F401CE schematic page 1: full sheet (WeAct MiniF4x1Cx V3.1)
Page 1 of 5 · Full Sheet
Black Pill F401CE schematic page 2: MCU, crystals and headers P1/P2 (WeAct MiniF4x1Cx V3.1)
Page 2 of 5 · MCU, Crystals & Headers
Black Pill F401CE schematic page 3: KEY, reset, BOOT0 and RTC supply (WeAct MiniF4x1Cx V3.1)
Page 3 of 5 · KEY, Reset, BOOT0 & RTC
Black Pill F401CE schematic page 4: USB-C, 5v input (D4, SB1) and SPI flash (WeAct MiniF4x1Cx V3.1)
Page 4 of 5 · USB-C, 5v Input & SPI Flash
Black Pill F401CE schematic page 5: SWD header, LEDs and 3.3v LDO (WeAct MiniF4x1Cx V3.1)
Page 5 of 5 · SWD Header & 3.3v LDO
Page 1 of 4

Official source: MiniF4x1Cx V3.1 schematic (PDF) from WeAct’s GitHub repository (Hardware folder; the release notes list what changed in each version). Here’s what to look at:

  • Power path: USB-C VBUS goes through the Schottky diode D4 (B5819WS) to the 5V net and the 5V pins. The 5V net feeds the U2 LDO, an ME6231A33M3G on V3.1 (500mA max, 3v–18v input), whose 3.3v output powers the MCU, the LEDs, the 3V3 pins, and the optional flash. VDDA/VREF+ gets the same 3.3v through ferrite L1.
  • SB1 (V3.1, bottom side): a solder pad across D4. Bridging it lets the USB-C port output 5v for USB host projects, but it also removes the protection that stops the 5V pins from back-feeding the USB port.
  • USB-C: D+ and D− go straight to PA12 and PA11 (USB OTG FS), and CC1/CC2 have 5.1kΩ pull-downs, so any USB-C charger or port supplies 5v. PA9 (VBUS sense) and PA10 (ID) are not connected to the connector.
  • Clocks: a 25MHz HSE crystal (Y2) on PH0/PH1, and a 32.768kHz LSE crystal (Y1) on PC14/PC15, which are also on the P1 header.
  • Buttons and LEDs: KEY connects PA0 to GND through a 330Ω resistor (no pull-up), BOOT0 has a 10kΩ pull-down and the button pulls it to 3.3v, PB2 (BOOT1) has a 10kΩ pull-down, and the blue LED goes from 3.3v through 1.5kΩ to PC13, so it lights when PC13 is low.
  • RTC supply: the BAT54C dual diode (D1) feeds VBAT from whichever is higher, the 3.3v rail or the VB pin, so a coin cell on VB keeps the RTC running when the board is off.
  • SPI flash (U3): an empty SOIC-8 footprint on the bottom for a W25Qxx flash, wired to PA4 (CS), PA5 (SCK), PA6 (MISO) and PA7 (MOSI). The schematic labels it “buy and solder yourself”.

Black Pill F401CE Specs

The Black Pill F401CE is WeAct’s MiniF4 core board fitted with the STM32F401CEU6. Here are its specifications, including the board-level parts that chip-only spec lists usually skip.

Black Pill F401CE development board (WeAct Black Pill STM32F401CEU6)

Get an STM32F401 Black Pill: Grab one from Amazon or AliExpress, and check for the STM32F401 chip marking when it arrives.

ItemBlack Pill F401CE
MCUSTM32F401CEU6, UFQFPN48
CoreArm Cortex-M4 with FPU and DSP, up to 84MHz, ART Accelerator
Memory512KB Flash, 96KB SRAM; optional SPI flash footprint (U3, empty)
Logic level3.3v (every I/O is 5v tolerant; PB5 must stay ≤ 3.3v per the errata)
GPIO pins32 on the side headers, plus PA13/PA14 on the SWD header
Board supplyUSB-C 5v, or 5v into a 5V pin
3.3v regulatorME6231A33M3G on V3.1 (500mA max, 3v–18v input); “SOT23-3 LDO” on V3.0
Clocks25MHz HSE crystal (Y2), 32.768kHz LSE crystal (Y1)
USB connectorUSB-C (J1), wired to the MCU’s USB 2.0 Full-Speed OTG (PA11/PA12)
DebuggerNone on board: 4-pin SWD header (P3) for an ST-LINK, or USB DFU / USART bootloader
Headers2x 20-pin 0.1″ (P1, P2), 15.24mm apart, + 4-pin SWD (P3)
User I/OBlue LED on PC13 (active low), KEY button on PA0, NRST and BOOT0 buttons, red power LED
PCBWeAct MiniF4 V3.1 (V3.0 in the photo), 20.78 × 52.81mm
Not AvailableDAC, CAN, SDIO (not on this 48-pin package), USB-UART chip

Black Pill F401CE Specifications Summary

  • The Black Pill F401CE runs the STM32F401CEU6 at up to 84MHz with 512KB Flash and 96KB RAM.
  • It has 32 GPIOs on the P1/P2 headers, plus PA13/PA14 on the SWD header (34 of the chip’s 36 I/Os; PH0/PH1 drive the crystal).
  • Every I/O is 5v tolerant (FT), except in analog mode, and PB5 must never see more than 3.3v (ES0299 errata).
  • It has 1x 12-bit ADC (2.4Msps) with all 10 channels on the headers: PA0–PA7, PB0 and PB1.
  • 25 header pins can output PWM, from TIM1–TIM5 and TIM9–TIM11.
  • It has 3 USARTs. Arduino Serial is USART1 on PA9 (TX) / PA10 (RX); USART6 is only on the USB pins.
  • It has 3x I2C. The Arduino Wire pins are PB7 (SDA) and PB6 (SCL).
  • It has 3x SPI (two with I²S). The Arduino SPI pins are PA5 (SCK), PA6 (MISO), PA7 (MOSI), with PA4 as SS.
  • The USB-C port is the MCU’s own USB 2.0 Full-Speed on PA11/PA12 (DFU, CDC, HID); there’s no USB-UART chip.
  • The blue LED is on PC13 (on when LOW), and the KEY button is on PA0 (reads LOW when pressed, needs the internal pull-up).
  • The LDO gives 500mA max on V3.1 and also powers the MCU. There’s no DAC and no CAN.

Black Pill F401CE Peripherals: MCU vs On the Headers

The STM32F401CE in its 48-pin package loses some of the family’s pins. This table tells you what the chip has and what you can actually reach on the board.

PeripheralSTM32F401CE (UFQFPN48)On the Black Pill headers
GPIO36 I/Os32 on P1/P2 + PA13/PA14 on SWD; PH0/PH1 are the 25MHz crystal
ADC1x 12-bit, 2.4Msps, 10 external channelsall 10 (PA0–PA7, PB0, PB1)
TimersTIM1 (advanced), TIM2/TIM5 (32-bit), TIM3, TIM4, TIM9–TIM1125 PWM pins
USARTUSART1, USART2, USART6all 3; USART6 only on PA11/PA12 (the USB pins)
SPI / I²SSPI1, SPI2, SPI3; I²S2, I²S3all 3 (SPI4 is not bonded out on 48 pins)
I²CI2C1, I2C2, I2C3all 3
USBUSB 2.0 OTG Full-Speedon the USB-C connector (VBUS sense and ID not wired)
SDIOnot on the 48-pin package–
DAC, CANnone on the STM32F401–

Black Pill F401CE Quick Pin Selection Guide

Not sure which pin to use? Here are the Black Pill F401CE pins I’d pick first for each job, and why.

Use CaseRecommended PinsWhy
Serial to the PCUSB-C (USB CDC)No USB-UART chip on the board; enable USB CDC in your firmware
Serial to a module (GPS, Bluetooth…)USART2: PA2 (TX), PA3 (RX)Leaves USART1 (PA9/PA10) free for the bootloader and Serial
I2C sensors and displaysPB6 (SCL), PB7 (SDA)The Arduino Wire pins; add 4.7kΩ pull-ups
SPI devicesPA5 (SCK), PA6 (MISO), PA7 (MOSI), PA4 (CS)The Arduino SPI pins; or SPI2 on PB13–PB15 + PB12
PWM (motors, LEDs, servos)PB6–PB9 (TIM4), PA8–PA10 (TIM1), PA1–PA3 (TIM2)Four channels on one timer share a frequency
Analog inputsPA1, PA2, PA3, PB0, PB1Free ADC pins with no button or flash on them
USB deviceUSB-C (PA11/PA12)Already wired; CDC, HID, MSC or DFU
External interruptAny GPIO (one pin per EXTI line)PA0 (KEY) is already a button
On-board LED / buttonPC13 (LED), PA0 (KEY)LED_BUILTIN and USER_BTN in Arduino
Safest general GPIOPB12–PB15, PB10, PB0, PB1, PA1–PA3No board load and no debug or boot role

Black Pill F401CE Pins to Use With Caution

PinReasonWhat to Do
PA11, PA12USB D− / D+, wired to the USB-C connectorKeep them for USB; using them as GPIO or USART6 breaks USB
PA13, PA14SWD pins (SWDIO, SWCLK)Don’t reuse them, or you lose debugging
PB3, PB4, PA15JTAG pins (SWO, NJTRST, JTDI) after resetSet debug to Serial Wire to free them
PB5Must never exceed VDD (ES0299: I/O leakage)Never connect 5v signals here, even though it’s FT
PC13, PC14, PC15Backup-domain pins: 3mA sink max, 2MHz max, never a current sourcePC13 has the LED, PC14/PC15 the 32.768kHz crystal; use them for slow inputs
PA0KEY button to GND (330Ω); must not exceed VDD in Standby (errata)Use the internal pull-up; don’t drive it hard while the button is pressed
PA4–PA7Go to the optional SPI flash footprintFree by default; if you fit a flash chip, they’re its SPI1 bus
PA9, PA10USART1, the system bootloader UARTKeep PA10 quiet (or low) while entering DFU
PB2BOOT1, 10kΩ pull-downKeep it LOW at reset if you use the system bootloader

Black Pill F401CE Pins Functions

The 40 header pins of the Black Pill F401CE (plus the 4-pin SWD header) are divided into the following groups based on the hardware functionality they’re used for. Most pins have several alternate functions, so one pin can belong to more than one group.

We’ll discuss each pin group in the following sections one by one in more detail.


Black Pill F401CE Power Pins

The Black Pill F401CE is powered from the USB-C connector (5v) or from 5v on a 5V pin. An on-board LDO makes the 3.3v rail for the MCU and the 3V3 pins, and the VB pin can take a coin cell for the RTC. The power pins are highlighted in red in the pinout diagram.

Black Pill F401CE power pins (5V, 3V3, VB, GND) on headers P1, P2 and P3

PinHeader PinsRangeNotes
5VP2-18, P1-15v in / outUSB-C 5v minus the D4 diode drop when USB is plugged in; feed 5v here when it isn’t
3V3P2-20, P1-3, P3-13.3v outLDO output (ME6231A33M3G, 500mA max on V3.1), shared with the MCU and LEDs
VBP1-20coin cellVBAT for the RTC and backup registers, through the BAT54C diode
GNDP2-19, P1-2, P3-40vAll grounds are common

Diode D4 blocks a 5v supply on the 5V pins from flowing back into your PC’s USB port, so it’s safe to have both connected. The 3.3v LDO also powers the MCU and the LEDs, so plan your external 3.3v loads with some margin below the 500mA limit, and power motors or LED strips from their own supply.

Note: Do not feed 5v into a 3V3 pin. And if you bridge the SB1 pad on the back (V3.1), D4 is shorted, so a supply on the 5V pins goes straight into the USB-C port: never plug the board into a PC with SB1 bridged and an external 5v supply connected.


Black Pill F401CE GPIO Pins

The Black Pill F401CE has 32 GPIO pins on its two side headers, plus PA13/PA14 on the SWD header. They work at 3.3v, and all of them are 5v tolerant as digital inputs, with one exception from the errata: PB5.

Black Pill F401CE GPIO pins on headers P1 and P2 (PA0-PA15, PB0-PB15, PC13-PC15)

Each GPIO can be an input (floating, pull-up or pull-down), a push-pull or open-drain output, an analog pin or an alternate function. The internal pull-up/pull-down resistors are about 40kΩ. Here are the electrical limits from the DS10086 datasheet:

  • Absolute max current per pin: ±25mA. Keep it under ±8mA for guaranteed logic levels.
  • Total current sunk by all pins: 120mA, and 160mA total into the VDD pins.
  • PC13, PC14 and PC15: 3mA sink max, 2MHz max, never as a current source.
  • 5v tolerance (FT) only applies while the pin isn’t in analog mode, and not for PC14/PC15 while the LSE crystal runs.

Note: The ES0299 errata says PB5 must never see a voltage above VDD, because of an I/O leakage that can shorten the chip’s life, even though the datasheet lists it as FT. On the Black Pill F401CE, treat PB5 as a 3.3v-only pin, and use a level shifter if a 5v signal must go there. PA0 has a similar limit, but only in Standby mode.

Learn more in our STM32 GPIO Tutorial series.


Black Pill F401CE Interrupt Pins

Every GPIO pin on the Black Pill F401CE can be an external interrupt source. The STM32F401CE has 16 EXTI lines for the pins, one per pin number, so PA0 and PB0 share EXTI0 and only one of them can use it at a time.

EXTI LinePins That Can Use ItInterrupt Vector
EXTI0 – EXTI4Px0 – Px4 (one port each)EXTI0_IRQn … EXTI4_IRQn (one each)
EXTI5 – EXTI9Px5 – Px9EXTI9_5_IRQn (shared)
EXTI10 – EXTI15Px10 – Px15 (PC13 on EXTI13)EXTI15_10_IRQn (shared)

The KEY button on PA0 is the easiest pin to try an interrupt with: enable the internal pull-up, and it reads LOW when pressed, so set a falling-edge trigger. In Arduino, attachInterrupt(digitalPinToInterrupt(PA0), isr, FALLING) after pinMode(PA0, INPUT_PULLUP).

Learn more in our STM32 External Interrupt Tutorial series.


Black Pill F401CE ADC Pins

The Black Pill F401CE has 1x 12-bit ADC with 10 external channels, and all 10 are on the headers: PA0–PA7, PB0 and PB1. The ADC reference is the 3.3v rail (through ferrite L1), so the input range is 0v to 3.3v.

Black Pill F401CE ADC pins (PA0-PA7 ADC1_IN0-IN7, PB0 ADC1_IN8, PB1 ADC1_IN9)

GPIOADC ChannelHeader PinNote
PA0ADC1_IN0P1-15KEY button to GND
PA1ADC1_IN1P1-14
PA2ADC1_IN2P1-13USART2_TX
PA3ADC1_IN3P1-12USART2_RX
PA4ADC1_IN4P1-11Flash CS footprint
PA5ADC1_IN5P1-10Flash CLK footprint
PA6ADC1_IN6P1-9Flash DO footprint
PA7ADC1_IN7P1-8Flash DI footprint
PB0ADC1_IN8P1-7
PB1ADC1_IN9P1-6

The ADC converts at up to 2.4Msps and has an internal temperature sensor and VREFINT channel too. All the ADC pins sit together on the P1 header, which makes analog wiring easy.

Note: A pin in analog mode is never 5v tolerant, so keep every ADC input between 0v and 3.3v. Use a voltage divider to measure higher voltages.

There are so many sensors that we can read with the ADC pins, which include: potentiometers, LDRs, analog temperature sensors (LM35, NTC thermistors), current sensors (ACS712), joysticks, soil moisture sensors, and much more.

Learn more in our STM32 ADC Tutorial series.


Black Pill F401CE PWM Pins

The Black Pill F401CE has 25 PWM pins on its headers, driven by TIM1 (advanced), TIM2 and TIM5 (32-bit), TIM3, TIM4, and TIM9–TIM11. The PWM pins are highlighted in orange in the pinout diagram.

Black Pill F401CE PWM pins with their timer channels (TIM1-TIM5, TIM9-TIM11)

TimerPWM Pins (Channel)
TIM1 (advanced)PA8 (CH1), PA9 (CH2), PA10 (CH3), PA11 (CH4); PB13/PA7 (CH1N), PB14/PB0 (CH2N), PB15/PB1 (CH3N)
TIM2 (32-bit)PA0/PA5/PA15 (CH1), PA1/PB3 (CH2), PA2/PB10 (CH3), PA3 (CH4)
TIM3PA6/PB4 (CH1), PA7/PB5 (CH2), PB0 (CH3), PB1 (CH4)
TIM4PB6 (CH1), PB7 (CH2), PB8 (CH3), PB9 (CH4)
TIM5 (32-bit)PA0 (CH1), PA1 (CH2), PA2 (CH3), PA3 (CH4)
TIM9PA2 (CH1), PA3 (CH2)
TIM10 / TIM11PB8 (TIM10_CH1), PB9 (TIM11_CH1)

Pins on the same timer share its frequency, and the CHxN pins (PB13–PB15, PB0, PB1, PA7 on TIM1) are the inverted complementary outputs, made for motor drivers with dead-time. PA11 (TIM1_CH4) is a USB pin, so it’s only a PWM pin if you don’t use USB.

There are so many things that we can control with PWM, which include: LED dimming, DC motor speed (with a driver), servo motors, buzzers, ESCs for brushless motors, and much more.

Calculate your timer settings with this STM32 PWM Calculator.

Learn more in our STM32 PWM Tutorial series.


Black Pill F401CE UART Pins

The Black Pill F401CE has 3 USARTs: USART1, USART2 and USART6. USART1 on PA9 (TX) / PA10 (RX) is the default Arduino Serial and the system bootloader’s UART. There’s no USB-UART chip, so to talk to a PC you either use USB CDC on the USB-C port or a USB-serial adapter on these pins.

Black Pill F401CE UART pins (PA9 USART1_TX, PA10 USART1_RX, PB6/PB7 USART1, PA2 USART2_TX, PA3 USART2_RX)

Black Pill F401CE Default Serial (USART1): PA9 (TX) and PA10 (RX).

UARTTX PinsRX PinsNote
USART1PA9 (P2-6), PB6 (P2-14)PA10 (P2-7), PB7 (P2-15)Arduino Serial; system bootloader UART
USART2PA2 (P1-13)PA3 (P1-12)Best free UART for a module; RTS/CTS on PA1/PA0
USART6PA11 (P2-8)PA12 (P2-9)Only on the USB pins, so not usable with USB

Note: A 3.3v USB-serial adapter connects TX to RX and RX to TX: adapter TX → PA10, adapter RX → PA9, plus GND. The pins are 5v tolerant, but a 3.3v adapter is the safe choice.

There are so many modules that we can interface with the UART pins, which include: GPS modules, Bluetooth modules (HC-05), ESP8266/ESP32 Wi-Fi modules, GSM modules, RS485 transceivers, fingerprint sensors, and much more.

Learn more in our STM32 UART Tutorial series.


Black Pill F401CE I2C Pins

The Black Pill F401CE has 3x I2C buses. The default Arduino Wire pins are PB6 (SCL) and PB7 (SDA) on I2C1, and I2C1 can also use PB8 (SCL) / PB9 (SDA), which is what Zephyr uses.

Black Pill F401CE I2C pins (PB6 SCL, PB7 SDA, PB8 SCL, PB9 SDA, PB10 I2C2_SCL, PB3 I2C2_SDA, PA8 I2C3_SCL, PB4 I2C3_SDA)

Black Pill F401CE Default I2C1 Pins: PB7 (SDA) and PB6 (SCL).

I2C BusSCL PinsSDA PinsNote
I2C1PB6 (P2-14), PB8 (P2-16)PB7 (P2-15), PB9 (P2-17)Arduino Wire on PB6/PB7
I2C2PB10 (P1-4)PB3 (P2-11)PB3 is SWO after reset: set debug to Serial Wire
I2C3PA8 (P2-5)PB4 (P2-12)PB4 is NJTRST after reset: set debug to Serial Wire

Note: There are no I2C pull-up resistors on the board, so add 4.7kΩ pull-ups to 3.3v unless your module already has them. And note that I2C2 has its SCL on the P1 header (PB10) and its SDA on the P2 header (PB3).

There are so many modules and sensors that we can interface with the I2C bus, which include: OLED displays (SSD1306), I2C LCDs, RTC modules (DS3231), IMUs (MPU6050), BME280 sensors, EEPROMs, and much more.

Learn more in our STM32 I2C Tutorial series.


Black Pill F401CE SPI Pins

The Black Pill F401CE has 3x SPI ports (SPI1, SPI2, SPI3), and SPI2/SPI3 can also run as I²S for audio. The default Arduino SPI pins are PA5 (SCK), PA6 (MISO) and PA7 (MOSI) on SPI1, with PA4 as SS.

Black Pill F401CE SPI pins (PA5 SCK, PA6 MISO, PA7 MOSI, PA4 NSS, PB13-PB15 SPI2, PB3-PB5 SPI3)

Black Pill F401CE Default SPI1 Pins: PA5 (SCK), PA6 (MISO), PA7 (MOSI), and PA4 (SS).

SPI PortSCKMISOMOSINSS
SPI1PA5, PB3PA6, PB4PA7, PB5PA4, PA15
SPI2 / I²S2PB13, PB10PB14PB15PB12, PB9
SPI3 / I²S3PB3PB4PB5PA15, PA4

Note: PA4–PA7 also go to the empty SPI flash footprint on the back. If you solder a W25Qxx flash chip there, it sits on SPI1 with PA4 as its chip select, so put your other SPI devices on SPI2 (PB12–PB15).

There are so many modules that we can interface with the SPI bus, which include: TFT displays (ILI9341, ST7735), SD card modules, nRF24L01 radios, MAX7219 LED drivers, W5500 Ethernet modules, and much more.

Learn more in our STM32 SPI Tutorial series.


Black Pill F401CE USB Pins

The Black Pill F401CE’s USB-C connector is wired straight to the STM32F401CE’s USB 2.0 Full-Speed OTG controller on PA11 (D−) and PA12 (D+). That’s how the board gets USB DFU flashing, a virtual COM port (CDC), HID or mass storage, with no extra chip.

Black Pill F401CE USB pins (PA11 USB D-, PA12 USB D+, PA8 SOF, PA9 VBUS, PA10 ID)

SignalGPIOOn This Board
D− (DM)PA11 (P2-8)Wired to the USB-C connector
D+ (DP)PA12 (P2-9)Wired to the USB-C connector
VBUS sensePA9 (P2-6)Not connected: turn VBUS sensing off
IDPA10 (P2-7)Not connected
SOFPA8 (P2-5)Optional start-of-frame output

Note: PA9 is not connected to USB VBUS on this board. In CubeMX, leave “VBUS sensing” disabled for the USB device, otherwise the USB stack waits for a VBUS signal that never arrives and the PC never sees the board.

USB needs an exact 48MHz clock. From the 25MHz crystal, set PLLM = 25, PLLN = 336, PLLP = 4 and PLLQ = 7 to get 84MHz for the core and 48MHz for USB.

Learn more in our STM32 USB CDC Tutorial.


Black Pill F401CE Debug (SWD) & Boot Pins

The Black Pill F401CE is programmed and debugged over SWD on the 4-pin header P3: 3V3, SWDIO (PA13), SWCLK (PA14) and GND. The boot mode is set by the BOOT0 button and PB2 (BOOT1), which has a 10kΩ pull-down.

Black Pill F401CE debug and boot pins (SWD header P3: 3V3, PA13 SWDIO, PA14 SWCLK, GND; NRST, PB2 BOOT1, PB3 SWO, PB4, PA15)

PinHeader PinFunction After Reset
3V3P3-1 (square pad)3.3v (for the debugger’s target voltage sense)
PA13P3-2 (DIO)SWDIO
PA14P3-3 (SCK)SWCLK
GNDP3-4Ground
NRSTP1-16 (R)Reset (NRST button)
PB3P2-11SWO (JTDO)
PA15P2-10JTDI
PB4P2-12NJTRST
PB2 (BOOT1)P1-5Pulled LOW by 10kΩ
BOOT0BOOT1 (PB2)Boots From
0 (button released)anyMain Flash (normal)
1 (button held)0System memory (ST bootloader: USB DFU, USART1, I2C, SPI)
11Embedded SRAM

To start the ST system bootloader, hold BOOT0, tap NRST, and release BOOT0 about half a second later (or hold BOOT0 while you plug in the USB cable). The board then shows up as “STM32 BOOTLOADER” (DFU), and STM32CubeProgrammer can flash it over USB. AN2606 also lists USART1 (PA9/PA10), I2C1–I2C3 and SPI1/SPI2 as bootloader interfaces on this chip.

Note: The P3 header has no reset pin. If your firmware reconfigures PA13/PA14 and the ST-LINK can’t connect anymore, use “Connect under reset” with a wire from NRST (P1-16) to the ST-LINK, or hold the BOOT0 button while you reset so the MCU starts the bootloader instead of your code.

Learn more in our STM32 SWD Debugging Tutorial.

Learn more in our STM32 Boot Modes Tutorial.


Black Pill F401CE On-Board Features

Besides the headers, the Black Pill F401CE has 2 LEDs, 3 buttons, 2 crystals, and a couple of footprints and pads on the back. Here’s what each one does.

PartPin / ConnectionWhat It Does
PWR LED (red, D3)3.3v → 5.1kΩ → GNDOn whenever the 3.3v rail is up
C13 LED (blue, D2)3.3v → 1.5kΩ → PC13On when PC13 is LOW (active low)
KEY buttonPA0 → 330Ω → GNDReads LOW when pressed; needs the internal pull-up
BOOT0 buttonBOOT0 → 3.3v (10kΩ pull-down)Held during reset: start the system bootloader
NRST buttonNRST → GNDResets the MCU
Y2 crystalPH0/PH125MHz HSE for the PLL and USB
Y1 crystalPC14/PC1532.768kHz LSE for the RTC
U3 footprint (bottom)PA4–PA7Empty SOIC-8 for a W25Qxx SPI flash
SB1 pad (bottom, V3.1)Across diode D4Bridge it to let the USB-C port output 5v (USB host)

Getting Started With Black Pill F401CE

You can program the Black Pill F401CE with any of the common STM32 toolchains. You don’t even need a debugger to start: the ST bootloader’s USB DFU mode flashes it over the USB-C cable. An ST-LINK on the SWD header adds real debugging.

  • STM32CubeIDE: start a new project for the STM32F401CEUx, set RCC → HSE to “Crystal/Ceramic Resonator” (25MHz), set SYS → Debug to “Serial Wire”, and configure PC13 as an output for the LED. Flash it with an ST-LINK, or with STM32CubeProgrammer over DFU.
  • Arduino IDE (STM32duino): install “STM32 MCU based boards”, then choose Board: “Generic STM32F4 series” and Board part number: “BlackPill F401CE”. Pick “STM32CubeProgrammer (DFU)” or “(SWD)” as the upload method.
  • PlatformIO: board ID blackpill_f401ce, with the STM32Cube or Arduino framework.
  • Zephyr RTOS: board name blackpill_f401ce.
  • MicroPython: WeAct publishes a MicroPython build for the F401CE in its GitHub repository (SDK folder).
Arduino NamePinDefault
SerialPA9 (TX) / PA10 (RX)USART1 (enable “USB CDC” in the Tools menu to get Serial over USB-C)
WirePB7 (SDA), PB6 (SCL)I2C1
SPIPA5 / PA6 / PA7, SS = PA4SPI1
LED_BUILTINPC13Blue LED, active low
USER_BTNPA0KEY button

Here’s a first test that blinks the blue LED and prints the KEY button state at 115200 baud:

With STM32CubeIDE and HAL, the same blink is HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13); in the main loop. Follow the STM32 LED Blink Code Example for the full walk-through, and set up the 84MHz clock with the STM32 RCC Clock Configuration Guide (PLL from the 25MHz HSE, 2 Flash wait states).


Black Pill STM32F401CE Common Problems & Fixes

Why isn’t my Black Pill recognized in DFU mode? Two known causes. A floating PA10 (USART1_RX) can pick up noise, and the ROM bootloader then picks USART1 instead of USB, so keep PA9/PA10 unconnected or tie PA10 to GND while you enter DFU (stm32duino forum). And the bootloader has to detect the 25MHz crystal against the internal oscillator, which AN2606 says is harder at high HSE values; WeAct’s own tip is to warm the chip a little, or just retry. If DFU still fails, flash over SWD or USART1.

Why does the LED turn on when I write LOW? The blue LED is wired from 3.3v to PC13, so it’s active low: digitalWrite(LED_BUILTIN, LOW) turns it on.

Why does the KEY button always read the same? The KEY button connects PA0 to GND, and there’s no pull-up resistor on the board. Use INPUT_PULLUP (or the CubeMX pull-up), and it reads LOW when pressed.

Why doesn’t Serial show anything on my PC? There’s no USB-UART chip. Serial is USART1 on PA9/PA10, so either connect a USB-serial adapter there, or enable USB CDC in the Arduino Tools menu (or a CDC device in CubeMX) to get a COM port over USB-C.

Why doesn’t my USB device show up on the PC? Check that VBUS sensing is off (PA9 isn’t connected to VBUS) and that the PLL gives exactly 48MHz to USB (PLLQ = 7 with a 25MHz crystal and PLLN = 336).

Why don’t PB3, PB4 and PA15 toggle? They’re JTAG pins after reset. In CubeMX, set SYS → Debug to “Serial Wire”, which frees them.

Why did the RTC drift while the LED was blinking? The ES0299 errata says toggling PC13 can disturb the 32.768kHz LSE crystal on this package. If you need an accurate RTC, don’t blink the C13 LED fast, or use another pin for activity.


STM32 Black Pill: F401CE vs F401CC vs F411CE

WeAct built three Black Pill versions on the same MiniF4 PCB, so the headers, power, LEDs and buttons are identical and the Black Pill F401CE pinout applies to all of them. Only the MCU changes:

FeatureBlack Pill F401CCBlack Pill F401CEBlack Pill F411CE
MCUSTM32F401CCU6STM32F401CEU6STM32F411CEU6
Clock84MHz84MHz100MHz
Flash / RAM256KB / 64KB512KB / 96KB512KB / 128KB
SPI / I²S3 / 23 / 25 / 5
UART / I2C / ADC3 / 3 / 10 ch3 / 3 / 10 ch3 / 3 / 10 ch
WeAct statusDiscontinuedDiscontinuedOn sale

Pick the Black Pill F401CE if you already have one, or when you need twice the Flash of the F401CC. For a new project, the F411CE is the better buy: it’s still in production, faster, and has more RAM, and everything on this page applies to it too. See the STM32F411 Black Pill Pinout guide for that board, or the STM32 Blue Pill Pinout guide if you’re comparing it with the older STM32F103 board.


Black Pill STM32F401CE Pin Details

Here is every Black Pill F401CE header pin in physical order, with its main functions, all its alternate functions, its 5v tolerance, and a short description. Pin 1 of each header has the square pad; with the USB-C connector at the top, P2 is the left header and P1 the right one.

Black Pill F401CE P2 Left Header Pins

PinLabelGPIOMain FunctionsAll Alternate Functions5v TolerantDescription
P2-1B12PB12TIM1_BKIN, SPI2_NSS, I2S2_WS, I2C2_SMBAI2C2_SMBA, I2S2_WS, SPI2_NSS, TIM1_BKINYesSPI2_NSS / I2S2_WS and TIM1_BKIN; a free general-purpose pin with no board load.
P2-2B13PB13TIM1_CH1N, SPI2_SCK, I2S2_CKI2S2_CK, SPI2_SCK, TIM1_CH1NYesSPI2_SCK and TIM1_CH1N (inverted PWM output); free by default.
P2-3B14PB14TIM1_CH2N, SPI2_MISOI2S2_ext_SD, SPI2_MISO, TIM1_CH2NYesSPI2_MISO and TIM1_CH2N (inverted PWM output); free by default.
P2-4B15PB15TIM1_CH3N, SPI2_MOSI, I2S2_SD, RTC_REFINADC1_EXTI15, I2S2_SD, RTC_REFIN, SPI2_MOSI, TIM1_CH3NYesSPI2_MOSI, TIM1_CH3N (inverted PWM output) and RTC_REFIN; free by default.
P2-5A8PA8TIM1_CH1, USART1_CK, I2C3_SCL, OTG_FS_SOF, MCO_1I2C3_SCL, RCC_MCO_1, TIM1_CH1, USART1_CK, USB_OTG_FS_SOFYesTIM1_CH1 PWM, I2C3_SCL, the MCO1 clock output and USART1_CK.
P2-6A9PA9TIM1_CH2, USART1_TX, I2C3_SMBA, OTG_FS_VBUSI2C3_SMBA, TIM1_CH2, USART1_TX, USB_OTG_FS_VBUSYesUSART1_TX (the Arduino Serial TX and the bootloader UART) and TIM1_CH2 PWM; not wired to USB VBUS on this board.
P2-7A10PA10TIM1_CH3, USART1_RX, OTG_FS_IDTIM1_CH3, USART1_RX, USB_OTG_FS_IDYesUSART1_RX (the Arduino Serial RX and the bootloader UART) and TIM1_CH3 PWM; keep it quiet or tied low while entering DFU.
P2-8A11PA11TIM1_CH4, USART6_TX, USART1_CTS, OTG_FS_DM, USB-C D−ADC1_EXTI11, TIM1_CH4, USART1_CTS, USART6_TX, USB_OTG_FS_DMYesUSB D− on the USB-C connector; also USART6_TX and TIM1_CH4, but only if you give up USB.
P2-9A12PA12TIM1_ETR, USART6_RX, USART1_RTS, OTG_FS_DP, USB-C D+TIM1_ETR, USART1_RTS, USART6_RX, USB_OTG_FS_DPYesUSB D+ on the USB-C connector; also USART6_RX and TIM1_ETR, but only if you give up USB.
P2-10A15PA15TIM2_CH1, SPI1_NSS, SPI3_NSS, JTDIADC1_EXTI15, I2S3_WS, SPI1_NSS, SPI3_NSS, SYS_JTDI, TIM2_CH1, TIM2_ETRYesJTDI after reset; free once debug is set to Serial Wire, then TIM2_CH1 or SPI1/SPI3_NSS.
P2-11B3PB3TIM2_CH2, SPI1_SCK, SPI3_SCK, I2C2_SDA, SWOI2C2_SDA, I2S3_CK, SPI1_SCK, SPI3_SCK, SYS_JTDO-SWO, TIM2_CH2YesSWO/JTDO after reset; free once debug is set to Serial Wire, then SPI1/SPI3_SCK, I2C2_SDA or TIM2_CH2.
P2-12B4PB4TIM3_CH1, SPI1_MISO, SPI3_MISO, I2C3_SDA, NJTRSTI2C3_SDA, I2S3_ext_SD, SPI1_MISO, SPI3_MISO, SYS_JTRST, TIM3_CH1YesNJTRST after reset; free once debug is set to Serial Wire, then SPI1/SPI3_MISO, I2C3_SDA or TIM3_CH1.
P2-13B5PB5TIM3_CH2, SPI1_MOSI, SPI3_MOSI, I2C1_SMBAI2C1_SMBA, I2S3_SD, SPI1_MOSI, SPI3_MOSI, TIM3_CH2Yes, but keep ≤ 3.3v (errata)SPI1/SPI3_MOSI and TIM3_CH2 PWM; per the ES0299 errata, never apply more than 3.3v to this pin.
P2-14B6PB6TIM4_CH1, USART1_TX, I2C1_SCLI2C1_SCL, TIM4_CH1, USART1_TXYesThe default Arduino Wire SCL (I2C1_SCL), also USART1_TX and TIM4_CH1 PWM.
P2-15B7PB7TIM4_CH2, USART1_RX, I2C1_SDAI2C1_SDA, TIM4_CH2, USART1_RXYesThe default Arduino Wire SDA (I2C1_SDA), also USART1_RX and TIM4_CH2 PWM.
P2-16B8PB8TIM4_CH3, TIM10_CH1, I2C1_SCLI2C1_SCL, TIM10_CH1, TIM4_CH3YesI2C1_SCL (alternate pair, Zephyr default), TIM4_CH3 and TIM10_CH1 PWM.
P2-17B9PB9TIM4_CH4, TIM11_CH1, SPI2_NSS, I2C1_SDAI2C1_SDA, I2S2_WS, SPI2_NSS, TIM11_CH1, TIM4_CH4YesI2C1_SDA (alternate pair, Zephyr default), TIM4_CH4, TIM11_CH1 PWM and SPI2_NSS.
P2-185V–5v in / out––5v rail: USB-C 5v (through diode D4) out, or 5v in when USB is unplugged.
P2-19GND–Ground––Ground.
P2-203V3–3.3v out––3.3v output of the on-board LDO (shared with the MCU).

Black Pill F401CE P1 Right Header Pins

PinLabelGPIOMain FunctionsAll Alternate Functions5v TolerantDescription
P1-15V–5v in / out––5v rail: USB-C 5v (through diode D4) out, or 5v in when USB is unplugged.
P1-2GND–Ground––Ground.
P1-33V3–3.3v out––3.3v output of the on-board LDO (shared with the MCU).
P1-4B10PB10TIM2_CH3, SPI2_SCK, I2S2_CK, I2C2_SCLI2C2_SCL, I2S2_CK, SPI2_SCK, TIM2_CH3YesI2C2_SCL, SPI2_SCK / I2S2_CK and TIM2_CH3 PWM.
P1-5B2PB2BOOT1, 10k to GND—YesBOOT1, pulled low by a 10kΩ resistor (R3); keep it low at reset to start the system bootloader.
P1-6B1PB1ADC1_IN9, TIM1_CH3N, TIM3_CH4ADC1_IN9, TIM1_CH3N, TIM3_CH4YesADC1_IN9 analog input, TIM3_CH4 and TIM1_CH3N PWM.
P1-7B0PB0ADC1_IN8, TIM1_CH2N, TIM3_CH3ADC1_IN8, TIM1_CH2N, TIM3_CH3YesADC1_IN8 analog input, TIM3_CH3 and TIM1_CH2N PWM.
P1-8A7PA7ADC1_IN7, TIM1_CH1N, TIM3_CH2, SPI1_MOSI, FLASH DIADC1_IN7, SPI1_MOSI, TIM1_CH1N, TIM3_CH2YesADC1_IN7 and SPI1_MOSI (the default Arduino SPI MOSI); goes to the empty flash footprint (DI).
P1-9A6PA6ADC1_IN6, TIM3_CH1, TIM1_BKIN, SPI1_MISO, FLASH DOADC1_IN6, SPI1_MISO, TIM1_BKIN, TIM3_CH1YesADC1_IN6 and SPI1_MISO (the default Arduino SPI MISO); goes to the empty flash footprint (DO).
P1-10A5PA5ADC1_IN5, TIM2_CH1, SPI1_SCK, FLASH CLKADC1_IN5, SPI1_SCK, TIM2_CH1, TIM2_ETRYesADC1_IN5 and SPI1_SCK (the default Arduino SPI SCK); goes to the empty flash footprint (CLK).
P1-11A4PA4ADC1_IN4, USART2_CK, SPI1_NSS, SPI3_NSS, FLASH CSADC1_IN4, I2S3_WS, SPI1_NSS, SPI3_NSS, USART2_CKYesADC1_IN4 and SPI1_NSS (the default Arduino SS); goes to the empty flash footprint (CS).
P1-12A3PA3ADC1_IN3, TIM2_CH4, TIM9_CH2, USART2_RXADC1_IN3, TIM2_CH4, TIM5_CH4, TIM9_CH2, USART2_RXYesADC1_IN3, USART2_RX and TIM2_CH4 / TIM9_CH2 PWM.
P1-13A2PA2ADC1_IN2, TIM2_CH3, TIM9_CH1, USART2_TXADC1_IN2, TIM2_CH3, TIM5_CH3, TIM9_CH1, USART2_TXYesADC1_IN2, USART2_TX and TIM2_CH3 / TIM9_CH1 PWM.
P1-14A1PA1ADC1_IN1, TIM2_CH2, TIM5_CH2, USART2_RTSADC1_IN1, TIM2_CH2, TIM5_CH2, USART2_RTSYesADC1_IN1 and TIM2_CH2 / TIM5_CH2 PWM; a free analog input.
P1-15A0PA0ADC1_IN0, TIM2_CH1, TIM5_CH1, USART2_CTS, KEY button, WKUPADC1_IN0, SYS_WKUP, TIM2_CH1, TIM2_ETR, TIM5_CH1, USART2_CTSYesThe KEY button (to GND through 330Ω), ADC1_IN0, the WKUP pin and TIM2/TIM5 channel 1 PWM.
P1-16NRST–RESET (low)––Reset input: pull it LOW to reset the MCU (same as the NRST button).
P1-17C15PC15OSC32_OUTADC1_EXTI15, RCC_OSC32_OUTYesOSC32_OUT of the 32.768kHz crystal; a weak backup-domain pin (3mA sink max).
P1-18C14PC14OSC32_INRCC_OSC32_INYesOSC32_IN of the 32.768kHz crystal; a weak backup-domain pin (3mA sink max).
P1-19C13PC13LED blue, RTC_TAMP1RTC_AF1YesThe blue C13 LED (active low); a weak backup-domain pin (3mA sink max, never a current source).
P1-20VB–VBAT (RTC)––VBAT for the RTC and backup registers, through the BAT54C diode.

Black Pill F401CE P3 SWD Header Pins

PinLabelGPIOMain FunctionsAll Alternate Functions5v TolerantDescription
P3-13V3–3.3v––3.3v output of the on-board LDO (shared with the MCU).
P3-2DIOPA13SWDIOSYS_JTMS-SWDIOYesSWDIO on the SWD header; leave it for the debugger.
P3-3SCKPA14SWCLKSYS_JTCK-SWCLKYesSWCLK on the SWD header; leave it for the debugger.
P3-4GND–Ground––Ground.

Wrap Up

To conclude this guide article, the Black Pill F401CE is a very solid entry-level development board. It gives you an 84MHz Cortex-M4F with 512KB of Flash, USB on a USB-C port, and 32 breadboard-friendly I/O pins for a few dollars. Just remember the board-level gotchas: PC13 is active low, the KEY button needs a pull-up, PB5 must stay at 3.3v, and PA11/PA12 belong to USB.

We hope it’s been a helpful guide to help you decide which pins to use for your project. For more boards, check out the Pinouts, Datasheets & Schematic Diagrams Library. Follow this STM32 Series of Tutorials to learn more about programming STM32 microcontrollers.

If you’re just getting started with STM32, you need to check out the STM32 Getting Started Ultimate Guide below.

Getting Started With STM32 ARM Cortex MCUs

The complete beginner’s guide to STM32 microcontrollers: the toolchain, your first project, and the STM32 tutorials series step by step.

Share This Page With Your Network!
Join Our +25,000 Newsletter Subscribers!

Stay Updated With All New Content Releases. You Also Get Occasional FREE Coupon Codes For Courses & Other Stuff!

Photo of author
Author
Embedded systems engineer with several years of experience in embedded software and hardware design. I work as an embedded SW engineer in the Automotive & e-Mobility industry. However, I still do Hardware design and SW development for DSP, Control Systems, Robotics, AI/ML, and other fields I'm passionate about.
I love reading, writing, creating projects, and teaching. A reader by day and a writer by night, it's my lifestyle. I believe that the combination of brilliant minds, bold ideas, and a complete disregard for what is possible, can and will change the world! I will be there when it happens, will you?

Leave a Comment