Need Help or More Information?
Questions about this free C programming course, embedded C training or career guidance? Get in touch.
STM32F407 Discovery
Board Overview
A complete walkthrough of every component on the STM32F4-Discovery board — MCU specs, on-board peripherals, power system, and debug interface.
What is the STM32F4-Discovery Board?
The STM32F4-Discovery (official part number: STM32F407VGT6) is a low-cost evaluation board from STMicroelectronics designed to help developers learn and prototype with the ARM Cortex-M4 processor family. It costs around $15–20 USD and packs a tremendous amount of hardware for that price.
This board is widely used in universities, embedded systems courses, and professional prototyping because it gives you direct access to all major peripherals — GPIO, UART, SPI, I2C, CAN, USB, ADC, DAC, Timers, and DMA — without needing external components to get started.
While STM32 HAL library is convenient, register-level programming teaches you exactly how hardware works. You eliminate abstraction layers, write tighter code, debug hardware issues faster, and deeply understand the ARM Cortex-M4 architecture — skills that transfer to any microcontroller.
STM32F407VGT6 MCU Specifications
The heart of the board is the STM32F407VGT6 — a 32-bit ARM Cortex-M4 processor with hardware floating-point unit (FPU). Let’s break down every specification:
| Parameter | Value | Notes |
|---|---|---|
| Core | ARM Cortex-M4 | 32-bit RISC, includes FPU (single-precision), DSP instructions |
| Max Clock Speed | 168 MHz | With PLL from 8 MHz external crystal |
| Flash Memory | 1 MB (1024 KB) | Divided into 8 sectors, 16KB × 4 + 64KB + 128KB × 7 |
| SRAM | 192 KB total | SRAM1: 112 KB + SRAM2: 16 KB + CCM RAM: 64 KB |
| Package | 100-pin LQFP | Low-profile Quad Flat Package, 0.5 mm pitch |
| Supply Voltage | 1.8V – 3.6V | Typical 3.3V; 5V tolerant I/O pins available |
| GPIO Pins | Up to 82 I/O | Ports A, B, C, D, E (full), H (2 pins on 100-pin package) |
| Timers | 17 timers | 2× advanced (TIM1,TIM8), 10× general purpose, 2× basic, 2× watchdog, 1× SysTick |
| UART/USART | 6 interfaces | USART1/2/3/6 + UART4/5 |
| SPI | 3 interfaces | SPI1/2/3, up to 42 Mbps |
| I2C | 3 interfaces | I2C1/2/3, up to 400 kHz (Fast Mode) |
| CAN | 2 interfaces | CAN1/CAN2, 2.0A/B compliant |
| USB OTG | 2 interfaces | USB OTG FS (12 Mbps) + USB OTG HS (480 Mbps) |
| ADC | 3 × 12-bit | ADC1/2/3, up to 2.4 MSPS, 24 channels |
| DAC | 2 × 12-bit | DAC1/DAC2 on PA4, PA5 |
| DMA | 2 controllers | DMA1 (7 streams) + DMA2 (8 streams), 8 channels each |
| I2S | 3 interfaces | For audio (used by on-board CS43L22 codec) |
| SDIO | 1 interface | For SD cards |
| DCMI | 1 interface | Digital Camera Interface |
| Ethernet MAC | 1 (with PHY) | IEEE 802.3 compliant |
| Operating Temp | -40°C to +85°C | Industrial grade |
Board Diagram Walkthrough
Here is a labeled diagram of the STM32F4-Discovery board showing the location and function of every major component:
ST-LINK V2 Debugger
The top portion of the Discovery board contains a complete ST-LINK V2 debugger built around a second STM32 MCU — the STM32F103C8T6. This means you only need a USB cable to program and debug your application — no separate JTAG programmer needed.
How ST-LINK Works
When you connect the board to your PC via the USB Mini-B connector (CN1), the STM32F103 enumerates as a USB HID device and exposes the SWD (Serial Wire Debug) interface to the target STM32F407. STM32CubeIDE (or OpenOCD) communicates with it to:
- Flash your compiled binary to Flash memory
- Set hardware breakpoints (up to 6 simultaneously)
- Inspect/modify registers and memory in real time
- Use ITM/SWO for printf() without UART (Virtual COM Port)
| SWD Pin | Signal | Description |
|---|---|---|
| PA13 | SWDIO | Bidirectional data line for SWD protocol |
| PA14 | SWDCLK | Clock signal for SWD protocol |
| PB3 | SWO / TRACESWO | Single Wire Output — used for ITM printf and trace |
| NRST | RESET | Active-low system reset |
The CN3 header (5-pin SWD connector on the board edge) lets you use the on-board ST-LINK to program an external STM32 board. This makes the Discovery board useful as a standalone programmer.
On-Board User LEDs
The STM32F4-Discovery has four user-controllable LEDs — a perfect “Hello World” for any embedded systems course. Each LED is connected to a GPIOD pin through a 470Ω current-limiting resistor.
All four LEDs are connected between the MCU pin and VDD (3.3V) through resistors. The LEDs are active HIGH — setting the GPIO pin HIGH turns the LED ON. Here is the minimal bare-metal code to blink the green LED:
/* Bare-metal LED blink — no HAL, no libraries */
#include <stdint.h>
/* Base addresses from STM32F407 reference manual */
#define RCC_BASE 0x40023800
#define GPIOD_BASE 0x40020C00
/* Register offsets */
#define RCC_AHB1ENR (*((volatile uint32_t*)(RCC_BASE + 0x30)))
#define GPIOD_MODER (*((volatile uint32_t*)(GPIOD_BASE + 0x00)))
#define GPIOD_ODR (*((volatile uint32_t*)(GPIOD_BASE + 0x14)))
int main(void) {
/* Step 1: Enable GPIOD clock (bit 3 of RCC_AHB1ENR) */
RCC_AHB1ENR |= (1U << 3);
/* Step 2: Set PD12 as output (MODER bits [25:24] = 01) */
GPIOD_MODER &= ~(0x3U << 24); /* clear bits */
GPIOD_MODER |= (0x1U << 24); /* set output mode */
while(1) {
GPIOD_ODR |= (1U << 12); /* PD12 HIGH — LED ON */
for(volatile int i = 0; i < 500000; i++);
GPIOD_ODR &= ~(1U << 12); /* PD12 LOW — LED OFF */
for(volatile int i = 0; i < 500000; i++);
}
}
User Push Button (B1)
There is one user-accessible push button on the board labeled B1 (sometimes marked as USER). It is connected to PA0 (Port A, Pin 0).
Active HIGH — When the button is not pressed, PA0 reads LOW (0V). When pressed, it connects to VDD (3.3V) so PA0 reads HIGH (1). This is opposite to many other boards that use active-low buttons.
The pin has a hardware pull-down resistor on the board (RC2 = 10kΩ to GND), so you do not need to enable the internal pull-down via the PUPDR register for this specific pin. However, enabling it in software does no harm.
/* Read button state — PA0 is active HIGH */
#define GPIOA_BASE 0x40020000
#define RCC_AHB1ENR (*((volatile uint32_t*)0x40023830))
#define GPIOA_MODER (*((volatile uint32_t*)(GPIOA_BASE + 0x00)))
#define GPIOA_IDR (*((volatile uint32_t*)(GPIOA_BASE + 0x10)))
void button_init(void) {
RCC_AHB1ENR |= (1U << 0); /* enable GPIOA clock */
/* MODER bits [1:0] for PA0 = 00 (input mode, default) */
GPIOA_MODER &= ~(0x3U << 0);
}
uint8_t button_read(void) {
return (GPIOA_IDR >> 0) & 0x1; /* returns 1 if pressed */
}
MEMS Accelerometer
The STM32F4-Discovery includes a MEMS 3-axis accelerometer. Original boards use the LIS302DL (discontinued); newer revisions use the LIS3DSH. Both communicate via SPI1.
| Signal | MCU Pin | Description |
|---|---|---|
| SPI1_SCK | PA5 | SPI clock (up to 10 MHz) |
| SPI1_MISO | PA6 | Master In Slave Out (accel → MCU) |
| SPI1_MOSI | PA7 | Master Out Slave In (MCU → accel) |
| SPI1_CS (NSS) | PE3 | Chip select (active LOW) |
| INT1 | PE0 | Interrupt 1 from accelerometer |
| INT2 | PE1 | Interrupt 2 from accelerometer |
The accelerometer measures ±2g / ±4g / ±8g. You can tilt the board and read X, Y, Z acceleration values. This is commonly used to demonstrate SPI communication (Tutorial 14) and interrupt-driven sensor reading (Tutorial 08).
Audio Codec (CS43L22)
The CS43L22 is a 24-bit, 96kHz stereo DAC from Cirrus Logic. It’s connected to the STM32F407 via two interfaces:
- I2C3 — for control/configuration (register writes to set volume, sample rate, etc.)
- I2S3 (I2S protocol over SPI3 pins) — for streaming audio data (PCM samples)
| Signal | MCU Pin | Interface |
|---|---|---|
| I2C3_SCL | PA8 | I2C control clock |
| I2C3_SDA | PC9 | I2C control data |
| I2S3_MCK | PC7 | Master clock (12.288 MHz for 48kHz audio) |
| I2S3_SCK | PC10 | Bit clock |
| I2S3_SD | PC12 | Serial audio data |
| I2S3_WS | PA4 | Word select (L/R channel) |
| RESET | PD4 | Hardware reset (active LOW) |
The 3.5mm stereo audio output jack (CN6) is driven by the CS43L22. The I2C address is 0x94 (write) / 0x95 (read).
USB OTG Connectors
The STM32F407 has two full USB OTG controllers. The Discovery board exposes both:
| Connector | Controller | Speed | Pins | Use Cases |
|---|---|---|---|---|
| CN5 (Micro-B) | USB OTG FS | Full Speed 12 Mbps | PA11 (D−), PA12 (D+), PA9 (VBUS) | USB Device (HID, CDC, MSC), USB Host |
| CN4 (Type-A) | USB OTG HS | High Speed 480 Mbps | Via ULPI PHY chip on PORTB | High-speed USB Host (mouse, keyboard, USB drive) |
Power Supply System
Understanding the power system prevents frustrating “my board doesn’t work” scenarios. The Discovery board can be powered in multiple ways:
| Source | Connector | Voltage | Notes |
|---|---|---|---|
| USB ST-LINK (CN1) | Mini-B | 5V USB → 3.3V LDO | Most common — plug into PC for programming & power |
| USB OTG FS (CN5) | Micro-B | 5V USB → 3.3V LDO | Use when board acts as USB device powered by host |
| External VDD | P1/P2 pins | 1.8V – 3.6V | Direct power via expansion connectors, bypass LDO |
| External 5V | P1/P2 pins | 5V → LDO → 3.3V | Use when running from battery or external supply |
Power domains on the STM32F407:
- VDD (1.8–3.6V): Main digital power for CPU, Flash, peripherals
- VDDA (1.8–3.6V): Analog power for ADC, DAC, comparators, oscillators. Should be filtered separately.
- VBAT (1.65–3.6V): Battery backup domain — powers RTC, backup SRAM, LSE oscillator when main VDD is off
- VDD_USB: Regulated separately for USB transceiver (typically from a 3.3V LDO fed by 5V USB)
On-Board Crystals
The Discovery board has two crystal oscillators:
| Crystal | Frequency | Pins | Purpose |
|---|---|---|---|
| Y1 (HSE) | 8 MHz | PH0 / PH1 (OSC_IN / OSC_OUT) | High-Speed External oscillator. PLL source to reach 168 MHz. More accurate than internal 16 MHz RC (HSI). |
| Y2 (LSE) | 32.768 kHz | PC14 / PC15 (OSC32_IN / OSC32_OUT) | Low-Speed External oscillator. Powers the RTC (Real Time Clock) for accurate timekeeping. This exact frequency divides evenly to 1 Hz (2^15 = 32768). |
Extension Connectors (P1 and P2)
Two 50-pin expansion connectors (P1 and P2) break out all user-accessible STM32F407 pins. These are the connectors you use to wire up external sensors, displays, and modules on a breadboard.
| Connector | Side | Key Pins Available |
|---|---|---|
| P1 | Left edge | GPIOE (PE0–PE15), GPIOD (PD0–PD15), PC0–PC7, GND, VDD |
| P2 | Right edge | GPIOA (PA0–PA15), GPIOB (PB0–PB15), PC8–PC15, GND, VDD, VBAT |
Pin numbering on the connectors starts from pin 1 (marked with a dot on the PCB silkscreen). The pitch is 2.54mm (0.1 inch), compatible with standard jumper wires and breadboards.
- The STM32F407VGT6 is a 168 MHz Cortex-M4 with 1MB Flash and 192KB SRAM
- The on-board ST-LINK V2 uses SWD to program/debug without extra hardware
- 4 user LEDs on PD12–PD15, user button on PA0 (active HIGH)
- LIS3DSH accelerometer uses SPI1; CS43L22 audio codec uses I2C3 + I2S3
- 8 MHz HSE crystal feeds the PLL to reach 168 MHz; 32.768 kHz LSE for RTC
- Two 50-pin expansion connectors provide access to all GPIO
STM32F407 Discovery Tutorial Series — Tutorial 01: Board Overview
Need Help or More Information?
Questions about this free C programming course, embedded C training or career guidance? Get in touch.

2 Comments