STM32F103R8T6 - Design Guide
STM32F103R8T6 - Design Guide
STM32F103R8T6 - Design Guide
Application note
STM32F10xxx hardware development:
getting started
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 STM32F10xxx product family and describes the minimum hardware
resources required to develop an STM32F10xxx application.
Detailed reference design schematics are also contained in this document with descriptions
of the main components, interfaces and modes.
Contents
1 Power supplies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1.1 Independent A/D converter supply and reference voltage . . . . . . . . . . . . 6
1.1.2 Battery backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.1.3 Voltage regulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.2 Power supply schemes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.3 Reset & power supply supervisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.3.1 Power on reset (POR) / power down reset (PDR) . . . . . . . . . . . . . . . . . . 8
1.3.2 Programmable voltage detector (PVD) . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.3.3 System reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2 Clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.1 HSE OSC clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.1.1 External source (HSE bypass) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.1.2 External crystal/ceramic resonator (HSE crystal) . . . . . . . . . . . . . . . . . 12
2.2 LSE OSC clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2.1 External source (LSE bypass) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2.2 External crystal/ceramic resonator (LSE crystal) . . . . . . . . . . . . . . . . . . 13
2.3 Clock-out capability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.4 Clock security system (CSS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3 Boot configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.1 Boot mode selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.2 Boot pin connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.3 Embedded Boot Loader mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4 Debug management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.2 SWJ debug port (serial wire and JTAG) . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.3 Pinout and debug port pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.3.1 SWJ debug port pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.3.2 Flexible SWJ-DP pin assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.3.3 Internal pull-up and pull-down on JTAG pins . . . . . . . . . . . . . . . . . . . . . 18
2/23
AN2586 - Application note Contents
5 Reference design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.1 Main . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.1.1 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.1.2 Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.1.3 Boot mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.2 SWJ interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.3 Power supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3/23
List of tables AN2586 - Application note
List of tables
4/23
AN2586 - Application note List of figures
List of figures
5/23
Power supplies AN2586 - Application note
1 Power supplies
1.1 Introduction
The device requires a 2.0 V to 3.6 V operating voltage supply (VDD). An embedded regulator
is used to supply the internal 1.8 V digital power.
The real-time clock (RTC) and backup registers can be powered from the VBAT voltage when
the main VDD supply is powered off.
VDDA domain
VREF-
VREF+ A/D converter
Temp. sensor
VDDA Reset block
PLL
VSSA
I/O Ring
VSS Core
Standby circuitry memories'
VDD (Wakeup logic, digital
IWDG) peripherals
Voltage regulator
Backup domain
LSE crystal 32K osc
VBAT
BKP registers
RCC BDCR register
RTC
ai14602b
On 100-pin packages
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 2.0 V to
VDDA.
6/23
AN2586 - Application note Power supplies
7/23
Power supplies AN2586 - Application note
STM32F10xxx
VBAT VREF
VBAT VREF+
Battery VDD 10 nF + 1 µF
(note 1)
VDDA
VDD 10 nF + 1 µF
VSSA
5 × 100 nF VDD 1/2/3/4/5
+ 1 × 10 µF VREF–
VSS 1/2/3/4/5
ai14363
1. Optional. If a separate, external reference voltage is connected on VREF+, the two capacitors (10 nF and
1 µF) must be connected.
2. VREF+ is either connected to VDDA or to VREF.
POR
40 mV PDR
hysteresis
Temporization
tRSTTEMPO
RESET
ai14364
8/23
AN2586 - Application note Power supplies
VDD
PVD output
ai14365
9/23
Power supplies AN2586 - Application note
0.1 µF
ai14366
10/23
AN2586 - Application note Clocks
2 Clocks
Three different clock sources can be used to drive the system clock (SYSCLK):
● 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 Wake-up 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.
8 MHz
HSI RC HSI USBCLK
USB 48 MHz
Prescaler to USB interface
/2 /1, 1.5
HCLK
72 MHz max to AHB bus, core,
Clock memory and DMA
/8 Enable (3 bits) to Cortex System timer
PLLSRC SW
PLLMUL FCLK Cortex
free running clock
HSI SYSCLK AHB APB1
..., x16 36 MHz max PCLK1
x2, x3, x4 Prescaler Prescaler
PLLCLK 72 MHz to APB1
PLL max /1,2...512 /1, 2, 4, 8, 16 peripherals
HSE Peripheral Clock
Enable (13 bits)
to TIM2, 3
TIM2, 3, 4 and 4
CSS x1, 2 Multiplier TIMXCLK
Peripheral Clock
Enable (3 bits)
PLLXTPRE APB2 72 MHz max PCLK2
Prescaler
OSC_OUT to APB2
4-16 MHz /1, 2, 4, 8, 16 peripherals
Peripheral Clock
HSE OSC
OSC_IN /2 Enable (11 bits)
TIM1 Timer to TIM1
x1, 2 Multiplier TIM1CLK
Peripheral Clock
/128 Enable (1 bit)
ADC to ADC
OSC32_IN LSE to RTC Prescaler
LSE OSC ADCCLK
32.768 kHz RTCCLK /2, 4, 6, 8
OS32_OUT
RTCSEL[1:0]
Main /2 PLLCLK
Clock Output
MCO HSI
HSE
SYSCLK
MCO ai14367
1. HSE = High-speed external clock signal; HSI = high-speed internal clock signal; LSI = low-speed internal
clock signal; LSE = low-speed external clock signal.
11/23
Clocks AN2586 - Application note
STM32F10xxx
Hardware configuration
OSC_IN OSC_OUT
OSC_IN OSC_OUT
REXT(1)
(Hi-Z)
External source
ai14369 CL1 CL2
ai14370
12/23
AN2586 - Application note Clocks
OSC32_IN OSC32_OUT
OSC32_IN OSC32_OUT
(Hi-Z)
External source
CL1 CL2
ai14371
ai14372
13/23
Clocks AN2586 - Application note
14/23
AN2586 - Application note Boot configuration
3 Boot configuration
This selection aliases the physical memory associated with each boot mode to Block 000
(boot memory). The values on the BOOT pins are latched on the 4th rising edge of SYSCLK
after a reset. It is up to the user to set the BOOT1 and BOOT0 pins after reset to select the
required boot mode.
The BOOT pins are also re-sampled when exiting the Standby mode. Consequently, they
must be kept in the required Boot mode configuration in the Standby mode.
Even when aliased in the boot memory space, the related memory (Flash memory or
SRAM) is still accessible at its original memory space.
After this startup delay has elapsed, the CPU starts code execution from the boot memory,
located at the bottom of the memory address space starting from 0x0000_0000.
STM32F10xxx
VDD
10 kΩ
BOOT0
VDD
10 kΩ
BOOT1
ai14373
15/23
Boot configuration AN2586 - Application note
16/23
AN2586 - Application note Debug management
4 Debug management
4.1 Introduction
The Host/Target interface is the hardware equipment that connects the host to the
application board. This interface is made of three components: a hardware debug tool, a
JTAG or SW connector and a cable connecting the host to the debug tool.
Figure 12 shows the connection of the host to the STM3210B-EVAL board.
17/23
Debug management AN2586 - Application note
18/23
AN2586 - Application note Debug management
To avoid any uncontrolled I/O levels, the STM32F10xxx embeds internal pull-up and pull-
down resistors on JTAG input pins:
● 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 add pull-up resistors on TDI, TMS and nTRST but
there is no special recommendation for TCK. However, for the STM32F10xxx, an integrated
pull-down resistor is used for JTCK.
Having embedded pull-up and pull-down resistors removes the need to add external
resistors.
ai14376
19/23
Reference design AN2586 - Application note
5 Reference design
5.1 Main
The reference design shown in Figure 14, is based on the STM32F10xxx, a highly
integrated microcontroller running at 72 MHz, that combines the new Cortex™-M3 32-bit
RISC CPU core with 128 Kbytes of embedded Flash memory and up to 20 Kbytes of high
speed SRAM.
5.1.1 Clock
Two clock sources are used for the microcontroller:
● X1– 32.768 kHz crystal for the embedded RTC
● X2– 8 MHz crystal for the STM32F10xxx microcontroller
Refer to Section 2: Clocks on page 11.
5.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 8.
20/23
C1
U1A 10 pF
PA0 23 9 PC15
4
3
PA0-WKUP/USART2_CTS/ADC_IN0/TIM2_CH1_ETR PC15-OSC32_OUT
PA1 24 8 PC14 0
PA1/USART2_RTS/ADC_IN1 PC14-OSC32_IN X1
JTAG connector PA2 25 7 PC13
PA2/USART2_TX/ADC_IN2/ PC13-ANTI_TAMP MC306-G-06Q-32.768 (manufacturer JFVNY)
PA3 26 80 PC12
PA3/USART2_RX/ADC_IN3/ PC12
CN1 PA4 29 79 PC11
2
PA4/SPI1_NSS/USART2_CK/ADC_IN4 PC11
AN2586 - Application note
2
2
Figure 14. STM32F10xxx microcontroller reference schematic
B1 PE4
2 PE3
PE3
1 2 SW1 SW2 1 PE2
PE2
98 PE1
PE1
4 3 97 PE0
1
3
1
3
PE0/TIM4_ETR
RESET
STM32F103VBH6
C13 VCC VCC
100 nF
Notes:
- Capacitors (C3,C4,C7-12) should be placed on the PCB tracks closest to the VDD, VDDA and GND pins of the Microcontrollers
- VCC: mains power supply: the range is between 2.0 and 3.6 Volts (see Section 1 Power supplies) ai14360
- The value of REXT depends on the crystal characteristics. Typical value is in the range of 5 to 6 RS (resonator series resistance) as indicated in Section 2.1.
21/23
Reference design
Revision history AN2586 - Application note
6 Revision history
22/23
AN2586 - Application note
Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve the
right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any
time, without notice.
All ST products are sold pursuant to ST’s terms and conditions of sale.
Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no
liability whatsoever relating to the choice, selection or use of the ST products and services described herein.
No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this
document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products
or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such
third party products or services or any intellectual property contained therein.
UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED
WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS
OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
UNLESS EXPRESSLY APPROVED IN WRITING BY AN AUTHORIZED ST REPRESENTATIVE, ST PRODUCTS ARE NOT
RECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAINING
APPLICATIONS, NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY,
DEATH, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE. ST PRODUCTS WHICH ARE NOT SPECIFIED AS "AUTOMOTIVE
GRADE" MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER’S OWN RISK.
Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void
any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any
liability of ST.
Information in this document supersedes and replaces all information previously supplied.
The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.
23/23