The overview, with examples running, is on the board page.

The STM32 Nucleo-F411RE

ST's Nucleo-64 with an STM32F411 at 100 MHz, Uno headers, morpho pins, an ADC, and Serial over the ST-LINK.

What it is

ST's NUCLEO-F411RE (board MB1136): the same STM32F411 die as the Black Pill, in its 64-pin package, on our own Cortex-M4 core. The registers are at their real addresses (the STM32F411 model), and the sketch side is STM32duino's: a sketch written for the NUCLEO_F411RE board in the Arduino IDE reads the same here, pin numbers and all.

The clock is what STM32duino programs on this board: 100 MHz for the CPU, the timers and the fast peripheral bus, 50 MHz for the slow one. A cycle is exactly 10 ns. The clock tree itself is not modeled, so the chip is at 100 MHz from power-on.

The pins

Two kinds of header, as on the real board:

  • The Arduino Uno headers inside: CN6 (IOREF, NRST, 3V3, 5V, two GND, VIN), CN8 (A0 to A5), CN5 (D8 to D15, AVDD, GND) and CN9 (D2 to D7).
  • The ST morpho headers CN7 and CN10 down the edges, with every pin the board connects that is not already on an Arduino header: PC10, PC11, PC12, PD2, PA13, PA14, PA15, PB7, PC13, PC2 to PC6, PC8, PC9, PA11, PA12, PB1, PB2, PB12 to PB15, PA2 and PA3, and the supplies VDD, E5V, U5V, AVDD, AGND, VBAT, BOOT0 and grounds.

A pad on both headers is one piece of metal, so it is one pin, named for the Arduino header: the morpho's PA5 is D13. A diagram written with the port names still wires to the right pin.

Not connected, as the board ships: D0 and D1 (solder bridges SB62 and SB63 are open, and PA3/PA2 go to the ST-LINK instead), PC14 and PC15 (the 32.768 kHz crystal) and PH0 and PH1 (the ST-LINK's 8 MHz clock). They are drawn and have no pin behind them.

Pin numbers in a sketch

Numbered exactly as STM32duino's NUCLEO_F411RE variant numbers them:

  • 0 to 15 are the header's D0 to D15, as on an Uno, and D13 is a name too. digitalWrite(13, HIGH) lights the green LED.
  • 16 to 51 are the morpho pins in the variant's order.
  • A0 to A5 are the header's analog pins, A6 to A15 the other ADC pins.
  • The port names work as well: PA5 is the same pin as 13 and D13.

analogRead(0) reads A0, not D0: STM32duino reads a number below 16 as an analog input, and so does this board.

The LED, the button and Serial

LED_BUILTIN is PA5, which is D13. LD2, the green LED, goes from that pin to ground through 510 ohms, so HIGH lights it, as on an Uno and unlike the Black Pill.

USER_BTN is PC13, the blue B1 button, which pulls the pin to ground when it is pressed. The board has its own 4.7 k pull-up (R30) on PC13, so INPUT is enough and the pin reads LOW while it is held. While the simulation runs, the buttons drawn on the board take clicks: hold the blue B1 and PC13 reads LOW until you let go, and hold the black B2 RESET to hold the chip in reset, which starts the sketch again from the top when you let go. A pushbutton wired from PC13 or NRST to GND does the same.

Serial is USART2 on PA2 and PA3, which the board wires to the ST-LINK's USB virtual COM port: that is what the serial monitor shows. STM32duino calls it Serial2 and makes it Serial, and starts no Serial1, so Serial1 does not compile here either. Serial prints nothing until Serial.begin().

What is modeled

  • The Cortex-M4 core (ARMv7-M with Thumb-2), SysTick and the NVIC.
  • GPIO on ports A to D, with the real MODER, OTYPER, PUPDR and BSRR.
  • ADC1: twelve bits, with STM32duino's ten-bit analogRead by default and analogReadResolution up to twelve; 0 to 3.3 V on A0 to A5 and the other ADC pins. Pins with nothing on them read noise, as on the bench.
  • PWM at 1 kHz from TIM1, TIM2, TIM3 and TIM4 on every pin STM32duino routes analogWrite to: D3, D5, D6, D9, D10 and D11 (the tilde pins on an Uno), and D2, D4, D7, D8, D12 to D15, A0, A1, A3 and several morpho pins as well. Pins on one timer channel share it, as on the chip: A0, D13 and PA15 are all TIM2's channel 1.
  • tone() on TIM10, the variant's tone timer; micros() on TIM5.
  • attachInterrupt on every pin, through SYSCFG and EXTI.
  • Wire on D14 (SDA) and D15 (SCL) and SPI on D10 to D13, the variant's pins, driven in software.

What is not

  • I2C, SPI, DMA and USB hardware, the RTC and the watchdogs. Wire and SPI work, in software on the pins above.
  • The FPU. Floats are computed in software, so they come out the same and take more cycles than on the chip.
  • The clock tree, the 32.768 kHz crystal and the ST-LINK itself: there is no mass-storage drive or debugger to talk to.
  • Vendor binaries: the runtime here is ours, not the STM32Cube HAL or the STM32duino core's own code.

Stock Arduino libraries

The same as on the Black Pill: Servo.h, Wire.h, SPI.h, EEPROM.h, LiquidCrystal_I2C.h, Adafruit_GFX.h with Adafruit_SSD1306.h and DHT.h compile as they stand. Wire.begin() puts the bus on D14 (SDA, PB9) and D15 (SCL, PB8). EEPROM.h keeps its bytes in RAM, gone at a reset.

The examples

Blink, Button, Serial, Fade and Analog read.

On a real Nucleo

In the Arduino IDE, install "STM32 MCU based boards" by STMicroelectronics, pick Nucleo-64, then Tools, Board part number, Nucleo F411RE, and upload with Tools, Upload method, Mass Storage. PlatformIO's board is nucleo_f411re.

Elsewhere