Friday, 13 May 2016

Designing for STM32 ARM

There are a few thing to worry about designing STM32 circuits/PCBs. The main ones are power supply,ground, reset, boot pins, SWD, crystals, analog side, USB, and boot loaders.


Power supply


Power is provided with VDD (digital). The voltages are typically around +3.3V. Use decoupling capacitors (example: 0.1uF) near STM32. Place the STM32 close to power supply. Use a large trace for power. Read datasheet for more information.


Ground

Ground is provided with VSS (digital). Use a ground plane or a large trace for ground.


Reset


Reset pin is NRST. Typically the pin is connect to VDD with a pull-up resistor. To reset the STM32 set NRST low. Add a decoupling capacitor (example: 0.1uF) near NRST.


Boot pins


Boot pins are typically BOOT0 and BOOT1. Functionality of boot pins.

BOOT1BOOT0Boot mode
X 0User Flash memory
0 1 System memory (boot-loader)
1 1Embedded SRAM

Add a pull-down resistor (example: 1K ohms) from boot pins to VSS.


SWD


Here are the pins for SWD (Serial debug wire):
  • VDD power supply
  • VSS ground
  • SWDIO
  • SWCLK
  • NRST reset
SWD is used to flash and debug STM32. The STM32 doesn't have flashing/debugging capabilities by itself. STM32 requires STLinkV2 to flash and debug STM32. See SWD design blog post for more information.


Crystals


Some STM32 requires HSE (high frequency external oscillator) and LSE (low frequency external oscillator) . Pin names have OSCIN and OSCOUT. Steps to design:
  1. Find if HSE or LSE or both is required in the datasheet
  2. Find acceptable range of frequencies for crystals (use STM32CubeMX)
  3. Select crystals from component distributor
  4. Get load capacitance of crystals
  5. Find stray capacitance of PCB
  6. Use load capacitance of crystals to calculate external load capacitors
CL = ((C1 x C2) / (C1 + C2)) + Cstray

Where CL = load capacitance of crystal
C1 = external load capacitor
C2 = external load capacitor
Cstray = stray capacitance of PCB

Analog side


The pins are VDDA and VSSA. They are analog power supply and ground. Design steps:
  1. Find if STM32 has VDDA or VSSA or both
  2. If they exist then they must be connected properly
  3. Find tolerances for VDD
  4. Design filter circuit using an inductor and capacitor from VDDA to VDD
  5. Separate VDDA and VDD
  6. Separate VSSA and VSS
  7. Use star ground configurations to connect planes of VSSA and VSS 
  8. VDD and VSS must not be noisy 

 

USB


USB uses USB_DM and USB_DP pins. For USB 2.0 low speed/full speed impedance matching and trace length doesn't matter. Some STM32 have pull up resistors from USB_DP to VDD. See USB page for more information.


Boot loaders



Boot loaders are used to load user flash. Some STM32 have boot loaders builtin from the factory. Use STLinkV2 or STM32 DFU to flash boot loader.



Unused pins


Unused pins can be configured using the following way:
  • Not connected to anything. Make pin output.
  • Connect to VSS using a pull down resistor.
  • Connect to VDD using a pull up resistor.

No comments:

Post a Comment