Skip to content
Simurq Labs

Learn

What does an STM32 board need, in the schematic and the layout?

By Semih Özbir, Electrical and Electronics Engineer

Published · Last reviewed

In this guide · 8

Mostly capacitors. Applied to a 48-pin STM32F103, ST's AN2586 comes to eight, 100 nF at every supply pin among them, and a 10 kΩ resistor holding BOOT0 low; a crystal and an SWD header complete it. On the board, each capacitor sits at its pins, the crystal close inside a ground ring, and ground fills the rest.

Start from ST's getting-started note

ST publishes a getting-started note on hardware development for its STM32 families, each with a reference schematic: AN2586 for the STM32F1, AN5096 for the STM32G0, AN4488 for the STM32F4. This guide works through AN2586, revision 8 of December 2022, on a 48-pin STM32F103, its pin numbers from the note's package table, and says where the G0 and F4 differ.

Schematic of a 48-pin STM32F103's minimum circuit: 100 nF at VDD pins 24, 36 and 48 plus 10 µF, VBAT on VDD with 100 nF, VDDA through a ferrite bead with 100 nF and 1 µF, an 8 MHz crystal with two 20 pF and 390 Ω, 10 kΩ on BOOT0, 100 nF on NRST, and SWD to an STDC14 header.

The 48-pin STM32F103's minimum circuit, simplified and redrawn from STMicroelectronics' AN2586 (Rev 8, Figure 14 and Table 7) and UM2910.

The supply pins and their capacitors

The F1 runs from 2.0 to 3.6 V, or from 2.4 V when its ADC is used. Its 48-pin package has three VDD pins, 24, 36 and 48, each beside a ground pin. AN2586 asks for:

  • VDD: 100 nF ceramic at each VDD pin, plus one tantalum or ceramic capacitor of at least 4.7 µF, typically 10 µF.
  • VDDA: 100 nF and 1 µF at pin 9, with VDDA joined to VDD and VSSA to ground. A ferrite bead from VDD to VDDA filters the analog supply further.
  • VBAT: pin 1, for a backup battery. Without one, join it to VDD with 100 nF.

The 48-pin package has no VREF+ pin; it is tied to VDDA inside. Nor does the note's table list a VCAP pin: an internal regulator makes the core's 1.8 V.

On an STM32G0, AN5096 shows a single VDD/VDDA pin with 100 nF and 4.7 µF, so the analog supply shares those capacitors. An STM32F4 with its regulator on adds VCAP1 and VCAP2: AN4488 asks for 2.2 µF ceramic with an ESR under 2 Ω on each, or one 4.7 µF under 1 Ω where a package has only VCAP1.

Reset and the boot pins

NRST needs no reset circuit: the F1 powers up correctly without one, and the pin has an internal pull-up. AN2586 recommends only a capacitor from NRST to ground against parasitic resets: 100 nF, or 10 nF to save the power spent charging it.

Two pins choose where the chip starts:

  • BOOT0 low: the main flash memory, whatever BOOT1 is.
  • BOOT0 high, BOOT1 low: ST's bootloader in system memory, which on the F103 loads firmware over USART1.
  • Both high: the embedded SRAM.

The chip reads them just after a reset. On the 48-pin package BOOT0 is pin 44, and BOOT1 shares pin 20 with PB2. For a board that always runs its own firmware, one resistor from BOOT0 to ground does it: AN2586 draws 10 kΩ, a value it gives only as a typical example.

On a G0, AN5096 sets the boot source in option bytes by default, and option bits can make NRST a plain I/O, PF2.

The HSE and LSE crystals

The F1 can run on its internal 8 MHz RC oscillator; a crystal buys accuracy. The main one, the HSE, runs at 4 to 16 MHz on the F103; the reference design uses 8 MHz with 20 pF capacitors.

The two load capacitors in series, plus the stray capacitance of pins and tracks, Cs, must equal the load capacitance CL the crystal's maker specifies: CL = CL1 × CL2 / (CL1 + CL2) + Cs. With equal capacitors, each is 2 × (CL − Cs). AN2586 puts Cs at 2 to 7 pF and recommends high-quality ceramic capacitors of 5 to 25 pF. In AN2867, ST's oscillator guide, a crystal specified for 15 pF, with 5 pF of stray, takes 20 pF on each side.

AN2867 also asks for a gain margin of at least 5: the oscillator's transconductance over what the crystal needs, a need that grows with its ESR, frequency, shunt capacitance and load. In its STM32F1 example, an oscillator of 25 mA/V driving an 8 MHz crystal of 80 Ω ESR and a 10 pF load has a margin of 107. The 390 Ω in AN2586's reference design limits the crystal's drive level, as AN2867 explains; its value depends on the crystal.

The 32.768 kHz crystal for the RTC, the LSE, is stricter. AN2586 caps each of its capacitors at 15 pF and strongly recommends a crystal specified for 7 pF or less: "Never use a resonator with a load capacitance of 12.5 pF." The reference design uses 10 pF.

The SWD debug connection

SWD takes two pins: SWDIO on PA13 and SWCLK on PA14, pins 34 and 37 of the 48-pin package. Both are debug pins from reset, SWDIO pulled up and SWCLK pulled down inside the chip, so they need no resistors. PA15, PB3 and PB4 start as JTAG pins; firmware can release them and keep SWD.

AN2586 recommends wiring NRST to the debug connector too, so the tool can reset the application. On ST's 14-pin STDC14 connector, in the STLINK-V3MINIE manual, SWDIO is pin 4, SWCLK pin 6, NRST pin 12 and ground pins 5 and 7. Pin 3 takes the board's supply as an input: the probe powers nothing on the board and works from 1.65 to 3.6 V. Pins 3 to 12 follow the 10-pin Arm Cortex debug connector.

Layout: capacitors, crystal and ground

AN2586 puts each capacitor as close as possible to its pins, or under them on the underside, with a via to VDD and one to ground beside it, and asks for wide, low-impedance supply connections.

ST prefers a board with a whole layer of ground and another of VDD. Where cost rules that out, it asks for ground poured into every area free of parts, and each supply track run beside its ground, since the loop between them acts as an antenna.

The crystal needs more, by AN2867:

  • Close: as near the chip as possible, with short tracks.
  • Guarded: a ring tied to ground around those tracks, over a local ground plane that is separate from the main ground and joined to the chip's nearest ground pin.
  • Clear: high-frequency tracks routed away, the two capacitors symmetrical, and a crystal's metal can kept off that local ground.

It also warns that a toggling PC13 can shift the LSE's frequency.

What PCB Agent does with an STM32

PCB Agent's library has no STM32 module today; its two microcontroller modules are an RP2040 core and an ESP32-C3 module. An STM32 would be researched in the job: code keeps an agent's reading of ST's documents only where its quote stands on the page with every number it states, and the module drafted from it is laid out alone and checked under both fabs' rules. How an AI PCB design agent works follows the rest of a job.

Where a maker asks for a capacitor as close as possible to a pin without a distance, as AN2586 does, the module's rule holds it within 3 mm up to 1 µF and 10 mm above, and the review measures it on the routed board. Can AI design a PCB? shows why such rules matter.

Research matches a part's pins to KiCad's symbol by ST's own pin names, as an STM32G0 datasheet writes them: PF2-NRST for a port pin with a dedicated function, VDD/VDDA for two supplies bonded on one pin. Where KiCad says VDD and ST says VDDIO2, the two stay different.

The library does build the microcontroller's SWD debug header: three pins at 2.54 mm, SWCLK, ground and SWDIO in the Raspberry Pi Pico's order, for a board that powers itself. It has no NRST or supply pin, which ST's connector adds.

Limits

This guide follows one family, the STM32F1, through one note; check the note and the datasheet for your own family and package. It does not cover USB high speed, external memory or analog front ends. Its values are ST's, none measured here. The roadmap says where PCB Agent's test runs and boards stand. KiCad fabrication files covers what a fab needs next.

Sources

Have a board in mind?

PCB Agent is not open to the public yet. Leave your email, and we'll write when early access starts.