🛠 Premier Blink Arduino sur la Nucleo-F401RE avec le core STM32duino
Goals
Set up the STM32duino core (Arduino_Core_STM32) and upload your first sketch to the Nucleo-F401RE. The board name inside the core is NUCLEO_F401RE, supported since core 0.2.1 — the oldest and best-documented of the Nucleo F4 family (F411RE since 0.2.1, F446RE since 1.1.1, F410RB since 2.11.0).
Hardware
- 1× Nucleo-F401RE + data micro-USB cable
- PC with Arduino IDE 2.x — since core 2.8.0, Arduino IDE 1.x is no longer supported, so old tutorials' board-manager screenshots no longer match
Steps
https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
- Arduino IDE 2 → File → Preferences → add the Boards Manager URL:
- Boards Manager → install the STM32F4 boards pack from the ST STM32 core.
- Tools → Board → STSTM32F4 Boards → Nucleo F401RE.
- Plug the board in; the ST-LINK enumerates a virtual COM port automatically — no driver dance on a modern OS.
- Upload the sketch below, then open the serial monitor at 115200.
Code
const int kLedPin = LED_BUILTIN; // PA5 = on-board LD2 (variant header: LED_GREEN PA5)
void setup {
pinMode(kLedPin, OUTPUT);
Serial.begin(115200); // USART2 via the ST-LINK virtual COM port
}
void loop {
digitalWrite(kLedPin, HIGH); delay(150);
digitalWrite(kLedPin, LOW); delay(150);
Serial.println("tick");
}
Expected result
LD2 blinks at about 3 Hz and the serial monitor (115200 baud, the ST-LINK VCP) prints tick on every half-period. The core also ships an examples/ tree (blink, sensors, comms) that compiles for NUCLEO_F401RE out of the box — the fastest way to grow from this sketch.
Common mistakes
Serialis not native USB: on this variant it is USART2 (RX = PA3, TX = PA2) wired to the ST-LINK virtual COM port. Sketches expecting USB-CDC on the board connector are surprised.- Selecting the wrong Nucleo board: pin maps and LED pins differ between F401RE, F410RB, F411RE and F446RE.
- Following an Arduino IDE 1.x screenshot: core ≥ 2.8.0 supports IDE 2 only.
- Copying legacy mbed code: mbed's online services were sunset in July 2026 — use this core, Zephyr, or the Cube toolchain instead (community fork: Mbed CE).
Other tutorials for this board
- Prise en main de la Nucleo-F401RE : ST-LINK, LED LD2 et alimentation
- Console série sur le ST-LINK VCP : printf, ADC 12 bits et piège du USB
- STM32CubeF4 et HAL : blink + UART printf générés pour la Nucleo-F401RE
- ADC 12 bits et PWM sur la Nucleo-F401RE : oversampling, millivolts et LED en fondu
- Zephyr RTOS sur la Nucleo-F401RE : west build, devicetree et west flash
- Bare-metal sur le STM32F401 : clignoter LD2 en écrivant les registres GPIO