AN3320 STMICROELECTRONICS | Alldatasheet

Document overview

  • Manufacturer or author: Provided By ALLDATASHEET.COM(FREE DATASHEET DOWNLOAD SITE)
  • PDF pages: 29

Technical content

Datasheet sections

  • 1 Power supplies
  • 1.1 Introduction
  • 1.1.1 Independent A/D converter supply and reference voltage
  • 1.1.2 Battery backup
  • 1.1.3 Voltage regulator
  • 1.2 Power supply schemes
  • 1.3 Reset & power supply supervisor
  • 1.3.1 Power on reset (POR) / power down reset (PDR)
  • 1.3.2 Programmable voltage detector (PVD)
  • 1.3.3 System reset
  • 2 Clocks
  • 2.1 HSE OSC clock
  • 2.1.1 External source (HSE bypass)
  • 2.1.2 External crystal/ceramic resonator (HSE crystal)
  • 2.2 LSE OSC clock
  • 2.2.1 External source (LSE bypass)
  • 2.2.2 External crystal/ceramic resonator (LSE crystal)
  • 2.3 Clock security system (CSS)
  • 3 Boot configuration
  • 3.1 Boot mode selection
  • 3.2 Boot pin connection
  • 3.3 Embedded boot loader mode
  • 4 Debug management
  • 4.1 Introduction
  • 4.2 SWJ debug port (serial wire and JTAG)
  • 4.3 Pinout and debug port pins
  • 4.3.1 SWJ debug port pins
  • 4.3.2 Flexible SWJ-DP pin assignment
  • 4.3.3 Internal pull-up and pull-down resistors on JTAG pins
  • 4.3.4 SWJ debug port connection with standard JTAG connector

August 2011 Doc ID 18267 Rev 2 1/29 AN3320 Application note Getting started with STM32F20xxx/21xxx MCU hardware development Introduction This application note is intended for system designers who require a hardware implementation overview of the development board features such as the power supply, the clock management, the reset control, the boot mode settings and the debug management. It shows how to use the high-density performance line STM32F20xxx/21xxx product families and describes the minimum hardware resources required to develop an STM32F20xxx/21xxx application. Detailed reference design schematics are also contained in this document with descriptions of the main components, interfaces and modes.

5.3 Ground and power supply (V

1 Power supplies

1.1 Introduction

internal 1.2 V digital power. the main VDD supply is powered off. Figure 1. Power supply overview

  1. V DDA and VSSA must be connected to VDD and VSS, respectively.
  2. The voltage on V REF ranges from 1.65 V to VDDA for WLCSP64+2 packages.

1.1.1 Independent A/D converter supply and reference voltage

To improve conversion accuracy, the ADC has an independent power supply that can be filtered separately, and shielded from noise on the PCB.

  • the ADC voltage supply input is available on a separate VDDA pin
  • an isolated supply ground connection is provided on the VSSA pin When available (depending on package), VREF– must be tied to VSSA. On 100-pin package and above and on WLCSP64+2 To ensure a better accuracy on low-voltage inputs, the user can connect a separate external reference voltage ADC input on VREF+. The voltage on VREF+ may range from 1.8 V to VDDA. On WLCSP64+2, the VREF- pin is not available, it is internally connected to the ADC ground (VSSA). On 64-pin packages The VREF+ and VREF- pins are not available, they are internally connected to the ADC voltage supply (VDDA) and ground (VSSA).

1.1.2 Battery backup

To retain the content of the Backup registers when VDD is turned off, the VBAT pin can be connected to an optional standby voltage supplied by a battery or another source. The VBAT pin also powers the RTC unit, allowing the RTC to operate even when the main digital supply (VDD) is turned off. The switch to the VBAT supply is controlled by the power down reset (PDR) circuitry embedded in the Reset block. If no external battery is used in the application, it is highly recommended to connect V BAT externally to VDD.

1.1.3 Voltage regulator

The voltage regulator is always enabled after reset. It works in three different modes depending on the application modes.

  • in Run mode, the regulator supplies full power to the 1.2 V domain (core, memories and digital peripherals)
  • in Stop mode, the regulator supplies low power to the 1.2 V domain, preserving the contents of the registers and SRAM
  • in Standby mode, the regulator is powered down. The contents of the registers and SRAM are lost except for those concerned with the Standby circuitry and the Backup domain. Note: Depending on the selected package, there are specific pins that should be connected either to V SS or VDD to activate or deactivate the voltage regulator. Refer to section "Voltage regulator" in STM32F20xxx/21xxx datasheet for details.

1.2 Power supply schemes

The circuit is powered by a stabilized power supply, VDD.

  • Caution: – The V DD voltage range is 1.8 V to 3.6 V (and 1.65 V to 3.6 V for WLCSP64+2 package)
  • The VDD pins must be connected to VDD with external decoupling capacitors: one single Tantalum or Ceramic capacitor (min. 4.7 µF typ.10 µF) for the package + one 100 nF Ceramic capacitor for each V DD pin.
  • The VBAT pin can be connected to the external battery (1.65 V < VBAT < 3.6 V). If no external battery is used, it is recommended to connect this pin to VDD with a 100 nF external ceramic decoupling capacitor.
  • The VDDA pin must be connected to two external decoupling capacitors (100 nF Ceramic + 1 µF Tantalum or Ceramic).
  • The VREF+ pin can be connected to the VDDA external power supply. If a separate, external reference voltage is applied on VREF+, a 100 nF and a 1 µF capacitors must be connected on this pin. In all cases, VREF+ must be kept between 1.65 V and VDDA.
  • Additional precautions can be taken to filter analog noise: –V DDA can be connected to VDD through a ferrite bead. –T h e V REF+ pin can be connected to VDDA through a resistor (typ. 47 Ω).
  • For the voltage regulator configuration, there are specific pins (REGOFF and IRROFF depending on the package) that should be connected either to VSS or VDD to activate or deactivate the voltage regulator specific. Refer to section "Voltage regulator" in STM32F20xxx/21xxx datasheet for details.
  • When the voltage regulator is enabled, VCAP1 and VCAP2 pins must be connected to 2*2.2 µF Ceramic capacitor.

Figure 2. Power supply scheme

  1. Optional. If a separate, external reference voltage is connected on V REF+, the two capacitors (100 nF and
  2. V REF+ is either connected to VREF or to VDDA.
  3. N is the number of V DD and VSS inputs.
  4. Refer to section "Voltage regulator" in STM32F20xxx/21xxx datasheet to connect REGOFF and IRROFF

1.3 Reset & power supply supervisor

1.3.1 Power on reset (POR) / power down reset (PDR)

STM32F20xxx/21xxx datasheets. must ensure that reset pin is activated when VDD/VDDA becomes below 1.65 V.

Figure 3. Power-on reset/power-down reset waveform 1.70 V (typ.). Refer to STM32F20xxx/21xxx datasheets for actual value.

1.3.2 Programmable vo ltage detector (PVD)

selected by the PLS[2:0] bits in the Power control register (PWR_CR). The PVD is enabled by setting the PVDE bit. configuration. As an example the service routine can perform emergency shutdown tasks. Figure 4. PVD thresholds

1.3.3 System reset

controller CSR register and the registers in the Backup domain (see Figure 1).

  1. A low level on the NRST pin (external reset)
  2. window watchdog end-of-count condition (WWDG reset)
  3. Independent watchdog end-of-count condition (IWDG reset)
  4. A software reset (SW reset)
  5. Low-power management reset

The STM32F20xxx/21xxx does not require an external reset circuit to power-up correctly. device against parasitic resets. See Figure 5. Figure 5. Reset circuit

2 Clocks

  • HSI oscillator clock (high-speed internal clock signal)
  • HSE oscillator clock (high-speed external clock signal)
  • PLL clock The devices have two secondary clock sources:
  • 32 kHz low-speed internal RC (LSI RC) that drives the independent watchdog and, optionally, the RTC used for Auto-wakeup from the Stop/Standby modes.
  • 32.768 kHz low-speed external crystal (LSE crystal) that optionally drives the real-time clock (RTCCLK) Each clock source can be switched on or off independently when it is not used, to optimize the power consumption. Refer to the STM32F20xxx/21xxx reference manual RM0033 for the description of the clock tree.

2.1 HSE OSC clock

  • HSE external crystal/ceramic resonator (see Figure 7)
  • HSE user external clock (see Figure 6) 1. The value of R EXT depends on the crystal characteristics. Typical value is in the range of 5 to 6 RS (resonator series resistance). 2. Load capacitance C L has the following formula: CL = CL1 x CL2 / (CL1 + CL2) + Cstray where: Cstray is the pin capacitance and board or trace PCB-related capacitance. Typically, it is between 2 pF and 7 pF. Please refer to Section 5: Recommendations on page 21 to minimize its value.

Figure 6. HSE external clock Figure 7. HSE crystal/ceramic

2.1.1 External source (HSE bypass)

In this mode, an external clock source must be provided. It can have a frequency from 1 to 16 MHz (refer to STM32F20xxx/21xxx datasheets for actual max value). The external clock signal (square, sine or triangle) with a duty cycle of about 50%, has to drive the OSC_IN pin while the OSC_OUT pin must be left in the high impedance state (see Figure 7 and Figure 6).

2.1.2 External crystal/ceram ic resonator (HSE crystal)

The external oscillator frequency ranges from 4 to 26 MHz. The external oscillator has the advantage of producing a very accurate rate on the main clock. The associated hardware configuration is shown in Figure 7. Using a 25 MHz oscillator frequency is a good choice to get accurate Ethernet, USB OTG high-speed peripheral, and I2S. The resonator and the load capacitors have to be connected as close as possible to the oscillator pins in order to minimize output distortion and startup stabilization time. The load capacitance values must be adjusted according to the selected oscillator. For CL1 and CL2 it is recommended to use high-quality ceramic capacitors in the 5 pF-to- 25 pF range (typ.), designed for high-frequency applications and selected to meet the requirements of the crystal or resonator. C L1 and CL2, are usually the same value. The crystal manufacturer typically specifies a load capacitance that is the series combination of CL1 and CL2. The PCB and MCU pin capacitances must be included when sizing CL1 and CL2 (10 pF can be used as a rough estimate of the combined pin and board capacitance). Refer to the electrical characteristics sections in the datasheet of your product for more details.

2.2 LSE OSC clock

  • LSE external crystal/ceramic resonator (see Figure 9)
  • LSE user external clock (see Figure 8) 1. “LSE crystal/ceramic resonators” figure: To avoid exceeding the maximum value of CL1 and CL2 (15 pF) it is strongly recommended to use a resonator with a load capacitance CL ≤ 7 pF. Never use a resonator with a load capacitance of 12.5 pF. 2. “LSE external clock” and “LSE crystal/ceramic resonators” figures: OSC32_IN and OSC32_OUT pins can be used also as GPIO, but it is recommended not to use them as both RTC and GPIO pins in the same application. 3. “LSE crystal/ceramic resonators” figure: The value of REXT depends on the crystal characteristics. A 0 Ω resistor would work but would not be optimal. To fine tube RS value, refer to AN2867 - Oscillator design guide for ST microcontrollers.

2.2.1 External source (LSE bypass)

2.2.2 External crystal/ceram ic resonator (LSE crystal)

peripheral (RTC) for clock/calendar or other timing functions. capacitance values must be adjusted according to the selected oscillator. Figure 8. LSE external clock Figure 9. LSE crystal/ceramic

2.3 Clock security system (CSS)

The clock security system can be activated by software. In this case, the clock detector is enabled after the HSE oscillator startup delay, and disabled when this oscillator is stopped.

  • If a failure is detected on the HSE oscillator clock, the oscillator is automatically disabled. A clock failure event is sent to the break input of the TIM1 advanced control timer and an interrupt is generated to inform the software about the failure (clock security system interrupt CSSI), allowing the MCU to perform rescue operations. The CSSI is linked to the Cortex™-M3 NMI (n on-maskable interrupt) exception vector.
  • If the HSE oscillator is used directly or indirectly as the system clock (indirectly means that it is used as the PLL input clock, and the PLL clock is used as the system clock), a detected failure causes a switch of the system clock to the HSI oscillator and the disabling of the external HSE oscillator. If the HSE oscillator clock (divided or not) is the clock entry of the PLL used as system clock when the failure occurs, the PLL is disabled too. For details, see the STM32F20xxx/21xxx (RM0033) reference manuals available from the STMicroelectronics website www.st.com.

3 Boot configuration

3.1 Boot mode selection

BOOT[1:0] pins as shown in Table 1. starts code execution from the boot memory starting from 0x0000 0004.

3.2 Boot pin connection

Figure 10. Boot mode selection implementation example

  1. Resistor values are giv en only as a typical example.

Table 1. Boot modes

3.3 Embedded boot loader mode

The Embedded boot loader mode is used to reprogram the Flash memory using one of the available serial USART1(PA9/PA10), USART3(PB10/11 & PC10/11), CAN2(PB5/13) or USB OTG FS(PA11/12) in Device mode (DFU: device firmware upgrade). The USART peripheral operates with the internal 16 MHz oscillator (HSI). The CAN and USB OTG FS, however, can only function if an external clock (HSE) multiple of 1 MHz (between 4 and 26 MHz)is present. This embedded boot loader is located in the System memory and is programmed by ST during production. For additional information, refer to AN2606.

4 Debug management

4.1 Introduction

JTAG or SW connector and a cable connecting the host to the debug tool. Figure 11 shows the connection of the host to the evaluation board STM3220G-EVAL. Figure 11. Host-to-board connection

4.2 SWJ debug port (serial wire and JTAG)

  • The JTAG debug port (JTAG-DP) provides a 5-pin standard JTAG interface to the AHP- AP port
  • The serial wire debug port (SW-DP) provides a 2-pin (clock + data) interface to the AHP-AP port In the SWJ-DP , the two JTAG pins of the SW-DP are multiplexed with some of the five JTAG pins of the JTAG-DP .

4.3 Pinout and debug port pins

4.3.1 SWJ debug port pins

I/Os (GPIOs). These pins, shown in Table 2, are available on all packages.

4.3.2 Flexible SWJ-DP pin assignment

assigned except if explicitly programmed by the debugger host). through the GPIOx_AFRx registers. Table 3 shows the different possibilities to release some pins. the STMicroelectronics website www.st.com.

4.3.3 Internal pull-up and pu ll-down resistors on JTAG pins

is directly connected to the clock of some of these flip-flops. Table 2. Debug port pin assignment Table 3. SWJ I/O pin availability

  • JNTRST: Internal pull-up
  • JTDI: Internal pull-up
  • JTMS/SWDIO: Internal pull-up
  • TCK/SWCLK: Internal pull-down Once a JTAG I/O is released by the user software, the GPIO controller takes control again. The reset states of the GPIO control registers put the I/Os in the equivalent state:
  • JNTRST: Input pull-up
  • JTDI: Input pull-up
  • JTMS/SWDIO: Input pull-up
  • JTCK/SWCLK: Input pull-down
  • JTDO: Input floating The software can then use these I/Os as standard GPIOs. Note: The JTAG IEEE standard recommends to ad d pull-up resistors on TDI, TMS and nTRST but there is no special recommendation for TCK. However, for the STM32F20xxx/21xxx, an integrated pull-down resistor is used for JTCK. Having embedded pull-up and pull-down resistors removes the need to add external resistors.

4.3.4 SWJ debug port connecti on with standard JTAG connector

Figure 12. JTAG connector implementation

5 Recommendations

5.1 Printed circuit board

For technical reasons, it is best to use a multilayer printed circuit board (PCB) with a separate layer dedicated to ground (VSS) and another dedicated to the VDD supply. This provides good decoupling and a good shielding effect. For many applications, economical reasons prohibit the use of this type of board. In this case, the major requirement is to ensure a good structure for ground and for the power supply.

5.2 Component position

A preliminary layout of the PCB must separate the different circuits according to their EMI contribution in order to reduce cross-coupling on the PCB, that is noisy, high-current circuits, low-voltage circuits, and digital components.

5.3 Ground and power supply (V SS, VDD)

Every block (noisy, low-level sensitive, digital, etc.) should be grounded individually and all ground returns should be to a single point. Loops must be avoided or have a minimum area. The power supply should be implemented close to the ground line to minimize the area of the supply loop. This is due to the fact that the supply loop acts as an antenna, and is therefore the main transmitter and receiver of EMI. All component-free PCB areas must be filled with additional grounding to create a kind of shielding (especially when using single- layer PCBs).

5.4 Decoupling

All power supply and ground pins must be properly connected to the power supplies. These connections, including pads, tracks and vias should have as low impedance as possible. This is typically achieved with thick track widths and, preferably, the use of dedicated power supply planes in multilayer PCBs. In addition, each power supply pair should be decoupled with filtering Ceramic capacitors C (100 nF) and one single Tantalum or Ceramic capacitor (min. 4.7 µF typ.10 µF) connected in parallel on the STM32F20xxx/21xxx device. These capacitors need to be placed as close as possible to, or below, the appropriate pins on the underside of the PCB. Typical values are 10 nF to 100 nF , but exact values depend on the application needs. Figure 13 shows the typical layout of such a V DD/VSS pair.

Figure 13. Typical layout for V DD/VSS pair

5.5 Other signals

  • Signals for which a temporary disturbance affects the running process permanently (the case of interrupts and handshaking strobe signals, and not the case for LED commands). For these signals, a surrounding ground trace, shorter lengths and the absence of noisy and sensitive traces nearby (crosstalk effect) improve EMC performance. For digital signals, the best possible electrical margin must be reached for the two logical states and slow Schmitt triggers are recommended to eliminate parasitic states.
  • Noisy signals (clock, etc.)
  • Sensitive signals (high impedance, etc.)

5.6 Unused I/Os and features

application does not use 100% of the MCU resources. To increase EMC performance, unused clocks, counters or I/Os, should not be left free, e.g. features should be “frozen” or disabled.

6 Reference design

6.1 Description

The reference design shown in Figure 14, is based on the STM32F207IF(H6), a highly integrated microcontroller running at 120 MHz, that combines the Cortex™ -M3 32-bit RISC CPU core with 1 Mbyte of embedded Flash memory and up to 128 + 4 Kbytes of high-speed SRAM This reference design can be tailored to any other STM32F20xxx/21xxx device with different package, using the pins correspondence given in Table 6: Reference connection for all packages.

6.1.1 Clock

Two clock sources are used for the microcontroller:

  • LSE: X1– 32.768 kHz crystal for the embedded RTC
  • HSE: X2– 25 MHz crystal for the STM32F20xxx/21xxx microcontroller Refer to Section 2: Clocks on page 12.

6.1.2 Reset

The reset signal in Figure 14 is active low. The reset sources include:

  • Reset button (B1)
  • Debugging tools via the connector CN1 Refer to Section 1.3: Reset & power supply supervisor on page 9.

6.1.3 Boot mode

The boot option is configured by setting switches SW2 (Boot 0) and SW1 (Boot 1). Refer to Section 3: Boot configuration on page 16. Note: In low-power mode (more specially in Standby mode) the boot mode is mandatory to be able to connect to tools (the device should boot from the SRAM).

6.1.4 SWJ interface

The reference design shows the connection between the STM32F20xxx/21xxx and a standard JTAG connector. Refer to Section 4: Debug management on page 18. Note: It is recommended to connect the reset pins so as to be able to reset the application from the tools.

6.1.5 Power supply

Refer to Section 1: Power supplies on page 6.

6.2 Component references

Table 4. Mandatory components

1 Microcontroller STM32F207IG(H6) 1 176-pin package

2 Capacitors 100 nF 16 Ceramic capacitors (decoupling

3 Capacitor 10 µF 1 Ceramic capac itor (decoupling capacitor)

Table 5. Optional components 1R e s i s t o r 1 0 k Ω 5 pull-up and pull-down for JTAG and Boot mode. 4 Capacitor 100 nF 2 Ceramic capacitor.

5 Capacitor 2 pF 2 Used for LSE: the value depends on the crystal

6 Capacitor 1 µF 2 Used for V DDA and VREF. 7 Capacitor 2.2 µF 2 Used for internal regulator when it is on.

8 Capacitor 20 pF 2 Used for HSE: the value depends on the

9 Quartz 25 MHz 1 Used for HSE. 10 Quartz 32 kHz 1 Used for LSE.

11 JTAG connector HE10 1

12 Transil diode 5 V-400 W 11 For JTAG protection. 13 Resistor 22 Ohm 11 For JTAG protection.

14 Battery 3V3 1

15 Switch 3V3 2 Used to select the right boot mode.

16 Push-button B1 1

17 Jumper 3 pins 2 Used to select V BAT source, and REGOFF pin.

18 Debug trace

01-L-DV 1 Used for JTAG/SWD and debug trace.

Figure 14. STM32F207IG(H6) microcontroller reference schematic

  1. If no external battery is used in the application, it is recommended to connect VBAT externally to VDD.
  2. To be able to reset the device from t he tools this resistor has to be kept.

3 JP2

1 SW1

Table 6. Reference connection for all packages

Table 6. Reference connection for all packages (continued)

7 Revision history

Table 7. Document revision history 25-Feb-2011 1 Initial release. Updated REGOFF and IRROFF pin configuration. Updated standby mode in Chapter 1.1.3: Voltage regulator. Embedded boot loader mode section.