STM32 ARM quick start

From DP

Jump to: navigation , search

Contents

Features

  • 32bits, 24/36/48/72MHz (0xx/1xx/2xx/3xx/7xx), 3.3volts
  • up to 1Mbyte flash
  • USB (F102/103xx)
  • Ethernet (F105/107xx)

References

Development and programming

Bootloaders

The STM32 has a bootloader programmed in system memory. This can be deleted (?).

  • Activated with pins BOOT0=1 and BOOT1=0 at startup
  • USART1, uses internal 8 MHz oscillator (most STM32s)
  • USB OTG DFU, requires external 8 MHz, 14.7456 MHz, or 25 MHz clock (STM32F105xx and STM32F107xx)
  • See AN2606

Basic circuit

Quick-stm32-basic-circuit.png

Power

  • 3.3volt power supply
  • VBat pin for secondary external/backup battery supply
  • Connect all the supply pins to power or ground.
  • Put a 0.1uF decouple capacitor on each positive supply pin, and put it as close to the chip on your PCB as possible.
  • The 4.7uF decouple capacitor has to be near and connected to the VDD3 pin (see the respective power supply scheme in the datasheet of the exact chip you are using)
  • Important: even if you are not using the analog part of the chip you have to connect the power supply to the VDDA and VCCA pins otherwise the chip will have unpredicted behaviour

Reset

Quick-stm32-reset.png

  • NRST is the reset pin
  • It has an internal pullup and does not require an external connection
  • It's an IO: it pulls low externally on all system resets

Programming connections

JTAG

Although some reference designs have pull-up and pull-down resistors connected to the JTAG pins they are NOT necessary. The STM32 has built the needed resistors built in. The only necessary part is a capacitor on the RST line connected to ground that ensures that the line is stable, to prevent unwanted resets of the chip.

SWD (Single Wire Debug)

Some combinations of SWD programmers and STM32 chips (and PCB layouts) sometimes leads to intermittent SWD connections. This seems to be because of "reflection" in the SWDCLK/SWDIO lines. To combat this, try to shorten your SWD cables, or insert in-line resistors to terminate them (around 100 to 1K ohms will do fine).

Boot configuration pins

Pins BOOT0 and BOOT1 select how the STM32 starts.

BOOT1 BOOT0 Boot mode
X 0 User Flash memory
0 1 System memory (bootloader)
1 1 Embedded SRAM

Crystal

The STM32 has an 8MHz internal "HSI" oscillator, and a flexible PLL to multiple all clock sources. Whilst the HSI has an accuracy of +-2%, an external crystal is needed for reliable USB operation on most chips.

The STM32 also has an internal 32.768KHz "LSI" oscillator for RTC duties. Please note that it is not factory trimmed, so without you calibrating it, it's more of a "something between 30 and 60KHz" oscillator.

Peripherals

IO

USB

Quick-stm32-usb-short.png

  • STM32 requires in-line USB resistors

Ethernet