cuprio

Designing a PCB with the STM32G4

The STM32G4 is ST's mainstream Arm Cortex-M4 family with a floating-point unit, running at up to 170 MHz, with motor-control timers and a large set of analog peripherals. The STM32G431 needs 100 nF on every VDD pin plus one bulk capacitor, a separately filtered VDDA, a 0.1 µF capacitor on NRST and SWD on PA13/PA14. Its USB 2.0 full-speed port can run without a crystal.

  • 3 min read
  • 6 sections
  • 2 sources
Core
Arm Cortex-M4 with FPU, up to 170 MHz (213 DMIPS)
Flash / SRAM (STM32G431xB)
128 KB flash with ECC; 22 KB SRAM plus 10 KB CCM SRAM
Supply
VDD and VDDA 1.71 V to 3.6 V; 3.0 V to 3.6 V when USB is used
Clocks
4 to 48 MHz crystal oscillator, internal 16 MHz RC (±1 %), internal 48 MHz RC for USB
USB
USB 2.0 full-speed device with embedded DP pull-up, plus USB Type-C PD controller (UCPD)
Analog
2 ADCs (0.25 µs), 4 DAC channels, 4 comparators, 3 op amps
Packages (STM32G431)
UFQFPN32 and LQFP32 up to LQFP100
Board plans in Cuprio using it
4 (as of 27 November 2026)

What is the STM32G4 family?

The STM32G431 is the entry line: up to 128 KB of flash, 22 KB of SRAM plus a 10 KB CCM SRAM for fast routines, three op amps, four comparators, two ADCs, FDCAN and USB. The series reaches LQFP128, and the board-level rules below, from ST's AN5093, apply across it.

How should STM32G4 power pins be decoupled?

The datasheet's power supply scheme shows n × 100 nF on the n VDD pins plus one 4.7 µF bulk capacitor; AN5093 suggests a bulk part of about 10 µF. Either way, each decoupling capacitor belongs right at its pin or directly underneath on the back of the board. Where several VDD pins share one VSS, connect each capacitor between its VDD and that common VSS.

VDDA feeds the ADCs, DACs, comparators, op amps and VREFBUF, and it may differ from VDD. The datasheet shows 10 nF plus 1 µF on VDDA and 100 nF plus 1 µF on VREF+, while AN5093 uses 100 nF plus 1 µF on both. ST's reference design feeds VDDA from VDD through a ferrite bead. On 32-pin packages VREF+ is bonded to VDDA. With no battery, tie VBAT to VDD with a 100 nF capacitor. The core regulator is internal and its voltage ranges are set in firmware, so it needs no parts on the board.

Which crystal does the STM32G4 need?

The HSE oscillator takes 4 to 48 MHz; ST's reference design uses 24 MHz with two 20 pF capacitors and a 390 Ω series resistor. Pick load capacitors of 5 to 20 pF each. The crystal's load is CL1 × CL2 / (CL1 + CL2) plus stray capacitance, which AN5093 puts at 2 to 7 pF. For the RTC, the reference design pairs a 32.768 kHz crystal rated for a 6 pF load with 6.8 pF capacitors. USB can skip the crystal entirely: the internal 48 MHz oscillator trims itself from the USB start-of-frame packets. The datasheet rates crystal-less USB from −15 to 85 °C; colder boards need the PLL fed from an HSE crystal.

How do USB, BOOT0 and reset connect?

USB_DM is PA11 and USB_DP is PA12. The datasheet says no external series resistors are needed, because the driver already includes the matching impedance and the DP pull-up is built in. VDD must be 3.0 to 3.6 V for USB. Put ESD protection at the connector and route D+ and D− as a short differential pair.

BOOT0 is on PB8; the nSWBOOT0 option bit can hand it to the nBOOT0 option bit instead, freeing PB8. ST's reference design gives BOOT0 a switch and a 10 kΩ resistor. The ROM bootloader works over USART, I2C, SPI or USB DFU. NRST (PG10) has a 25 to 55 kΩ internal pull-up, and ST recommends 0.1 µF at the pin; AN5093 allows 10 nF to save power. SWD uses PA13 (SWDIO) and PA14 (SWCLK). Bring NRST to the debug header too.

Common STM32G4 mistakes

  • Using PA9/PA10 (USART1 TX/RX) without reading the UCPD note: a high level on PA9 or PA10 switches on a 5.1 kΩ dead-battery pull-down on PB6 or PB4, until firmware sets UCPD1_DBDIS.
  • Tying VDDA straight to a noisy VDD on an analog design instead of using the ferrite bead and its own capacitors.
  • Driving PC13 to PC15 as LED outputs: they sit behind a 3 mA switch, so limit them to 2 MHz and 30 pF loads and never source current from them.
  • Running USB below 3.0 V, or crystal-less below −15 °C.

Checking an STM32G4 board

Cuprio places and routes the board with its own router and checks the copper against the chosen manufacturer's design rules; see how Cuprio designs a board.

Sources

  1. STMicroelectronics: AN5093 Getting started with STM32G4 Series hardware development boards (Rev 2)

    Supply domains, VDDA/VREF+/VBAT, USB supply range, regulator ranges, NRST, boot modes, crystal load formula, decoupling, reference design values, PC13-PC15 limits

    st.com
  2. STMicroelectronics: STM32G431x6/x8/xB datasheet DS12589

    STM32G431 core, memory, analog, packages, power supply scheme, HSE load capacitors, NRST pull-up and capacitor, USB pins and crystal-less range, UCPD dead-battery pins, bootloader interfaces

    st.com
Close view of the two-wheel robot controller, a board designed in Cuprio

Be first in when we open.

Start with 600 welcome credits and get 30% off your first 12 months.