...

STM32F411CEU6 Getting Started Guide — From First Blink to SPI Flash

Complete getting started guide for the STM32F411CEU6 on the NVX-F4 board. Covers clock configuration, GPIO, UART debug output, ADC reading, SPI flash communication, and DFU USB flashing — from first blink to real peripheral use.

The STM32F411CEU6 is a compact and powerful Cortex-M4 microcontroller in a 48-pin UFQFPN package. At just GH₵220 for a fully assembled breakout board, it provides one of the most cost-effective ways to get started with serious STM32 development. This guide walks you through everything from your first LED blink to working with UART, SPI flash, and USB on the NVX-F4 board.

What You’ll Need

  • NVX-F4 board (any variant)

  • USB-C cable

  • ST-Link V2 debugger (or compatible clone) for SWD programming

  • STM32CubeIDE (free download from ST)

  • STM32CubeProgrammer (free download from ST)

STM32F411CEU6 Key Specifications

  • Core: ARM Cortex-M4 with FPU, up to 100MHz

  • Flash Memory: 512KB internal

  • SRAM: 128KB

  • Package: UFQFPN48 with up to 36 GPIO pins

  • USB: Full Speed (12Mbps)

  • SPI: up to 5 × SPI / I2S interfaces

  • I²C: 3 × I²C interfaces

  • USART: 3 × USART interfaces

  • ADC: 12-bit, up to 16 channels

  • Timers: up to 11, including advanced PWM timers

Step 1 — Power Up and Connect

Connect the NVX-F4 to your computer using the USB-C connector. The onboard 3.3V LDO powers the board directly from USB. The power LED should illuminate immediately. If it does not, verify that your USB cable supports both power and data, as some cables are power-only.

Connect your ST-Link to the board’s 10-pin SWD header. Pin 1 is marked on the silkscreen.

  • VCC → 3.3V

  • GND → GND

  • SWDIO → PA13

  • SWDCLK → PA14

Step 2 — Create Your First Project in STM32CubeIDE

  1. Open STM32CubeIDE and select File → New → STM32 Project

  2. Search for your target MCU and select STM32F411CEU6

  3. Enter a project name and click Finish

  4. CubeMX opens automatically for peripheral configuration

Step 3 — Configure the Clock to 100MHz

In CubeMX, open Clock Configuration and configure:

  • Input Source: HSI (16MHz internal oscillator)

  • PLL Source: HSI

  • PLLM = 8

  • PLLN = 100

  • PLLP = 2

  • System Clock Source: PLLCLK

The resulting HCLK should be 100MHz, the maximum for this MCU. Click Resolve Clock Issues if any warnings appear.

Step 4 — Blink the LED

The NVX-F4 includes a user LED connected to PA5. In CubeMX, configure PA5 as GPIO_Output. Generate the project code and add the following inside the main loop:

while (1) {
    HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
    HAL_Delay(500);
}

Build and flash the firmware. The LED should toggle every 500ms (one complete on/off cycle every second).

Step 5 — Configure UART Debug Output

Enable USART2 in Asynchronous mode within CubeMX.

  • PA2 → TX

  • PA3 → RX

  • Baud Rate → 115200

Add the following to main.c:

#include <stdio.h>
#include <string.h>
void uart_print(const char *msg)
{
    HAL_UART_Transmit(
        &huart2,
        (uint8_t*)msg,
        strlen(msg),
        HAL_MAX_DELAY
    );
}
// Example:
uart_print("NVX-F4 is runningrn");

Connect a USB-to-UART adapter to PA2 and PA3, then open a serial terminal at 115200 baud.

Step 6 — Read Analog Input Using the ADC

The STM32F4 ADC provides 12-bit resolution (0–4095). To read an analog voltage from PA0:

HAL_ADC_Start(&hadc1);
HAL_ADC_PollForConversion(&hadc1, HAL_MAX_DELAY);
uint32_t raw = HAL_ADC_GetValue(&hadc1);
float voltage = (raw / 4095.0f) * 3.3f;

Step 7 — Communicate Using SPI

If you are using the NVX-F4 Flash variant, the onboard W25Q128JV flash memory is connected through SPI1.

To read the JEDEC device ID:

uint8_t cmd = 0x9F;
uint8_t id[3];
HAL_GPIO_WritePin(
    FLASH_CS_GPIO_Port,
    FLASH_CS_Pin,
    GPIO_PIN_RESET
);
HAL_SPI_Transmit(
    &hspi1,
    &cmd,
    1,
    HAL_MAX_DELAY
);
HAL_SPI_Receive(
    &hspi1,
    id,
    3,
    HAL_MAX_DELAY
);
HAL_GPIO_WritePin(
    FLASH_CS_GPIO_Port,
    FLASH_CS_Pin,
    GPIO_PIN_SET
);
// Expected:
// id[0] = 0xEF (Winbond)
// id[1] = 0x40
// id[2] = 0x18

Step 8 — Flash Firmware Through USB (DFU Mode)

The STM32 includes a built-in USB DFU bootloader, allowing firmware updates without an ST-Link.

  1. Press and hold the BOOT0 button

  2. Press and release RESET while continuing to hold BOOT0

  3. Release BOOT0

  4. The board should appear in STM32CubeProgrammer as a DFU device

  5. Select your .bin or .hex file and flash the firmware

  6. Reset the board to launch the new firmware

Next Steps

  • Add FreeRTOS: Enable FreeRTOS under Middleware in CubeMX for multitasking support

  • Connect a display: Use SPI TFT displays such as ILI9341 or ST7789 through SPI2 or SPI3

  • Upgrade to the NVX-F4 Pro: Adds microSD logging, EEPROM, and RTC support with no wiring changes

Full pinout diagrams, schematics, and firmware examples are available on github.com/nvixeon.

If you need assistance, contact info@nvixeon.com for support.

Ready to start building? Get your NVX-F4 board.

Seraphinite AcceleratorOptimized by Seraphinite Accelerator
Turns on site high speed to be attractive for people and search engines.