Getting Started With stm32f030xx and stm32f070xx Series Hardware Development Stmicroelectronics
Getting Started With stm32f030xx and stm32f070xx Series Hardware Development Stmicroelectronics
Application note
Getting started with STM32F030xx and STM32F070xx series
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 STM32F0x0xx products family and describes the minimum hardware
resources required to develop an application.
This document includes detailed reference design schematics and the description of the
main components, interfaces and modes.
Note: In this document, the notation used for STM32F030xx devices is STM32F030 and the
notation used for STM32F070xx devices is STM32F070. When referring to both series the
notation STM32F0x0 is used. The pin count and memory size do not impact this hardware
description.
Contents
2 Clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.1 High speed external clock signal (HSE) OSC clock . . . . . . . . . . . . . . . . . 12
2.2 LSE clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3 HSI clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.4 LSI clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.5 ADC clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.6 Clock security system (CSS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3 Boot configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4 Debug management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.2 SWD port (serial wire debug) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.3 Pinout and debug port pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.3.1 Serial wire debug (SWD) pin assignment . . . . . . . . . . . . . . . . . . . . . . . 17
4.3.2 SWD pin assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.3.3 Internal pull-up and pull-down on SWD pins . . . . . . . . . . . . . . . . . . . . . 18
4.3.4 SWD port connection with standard SWD connector . . . . . . . . . . . . . . 18
5 Recommendations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.1 Printed circuit board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.2 Component position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.3 Ground and power supply (VDD, VDDA) . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.4 Decoupling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.5 Other signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6 Reference design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6.1.1 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6.1.2 Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6.1.3 Boot mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6.1.4 SWD interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6.1.5 Power supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6.1.6 Pinouts and pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6.2 Component references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
8 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
List of tables
List of figures
/6(57&
:DNHXSORJLF
3RZHUVZLWFK
9'' 9&25(
1[9''
5HJXODWRU
9'',2
287 .HUQHOORJLF
/HYHOVKLIWHU
&38'LJLWDO
1[Q) *3,2V ,2 0HPRULHV
,1 ORJLF
[)
1[966
9''$
9''$
966$
D^ǀϯϮϱϭϲsϮ
9'' 9''$
9'' 9''$
6FKRWWN\GLRGH
069
9''9''$
9325
P9
K\VWHUHVLV
93'5
7HPSRUL]DWLRQ
W5677(032
5HVHW
069
9''
538
::'*UHVHW
,:'*UHVHW
3XOVH 3RZHUUHVHW
JHQHUDWRU
6RIWZDUHUHVHW
PLQV
/RZSRZHUPDQDJHPHQWUHVHW
2SWLRQE\WHORDGHUUHVHW
([LWIURPVWDQGE\PRGH
069
Software reset
The SYSRESETREQ bit in Cortex-M0 Application Interrupt and Reset Control Register
must be set to force a software reset on the device. Refer to the Cortex®-M0 technical
reference manual for more details.
Power reset
A power reset sets all registers to their reset values, except the RTC domain. See Table 2.
2 Clocks
Different clock sources can be used to drive the system clock (SYSCLK):
• HSI 8 MHz RC oscillator clock (high-speed internal clock signal)
• HSE oscillator clock (high-speed external clock signal)
• PLL clock
The devices have other secondary clock sources:
• 40 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 RTC.
• HSI 14MHz RC oscillator (HSI14) dedicated for ADC.
Each clock source can be switched on or off independently when it is not used, to optimize
the power consumption. Refer to reference manual STM32F030x4/6/8/C and
STM32F070x6/B advanced ARM®-based 32-bit MCUs (RM0360) for a description of the
clock tree.
26&B,1 26&B287
External clock
*3,2
([WHUQDOVRXUFH
069
2&6B,1 2&6B287
Crystal/Ceramic
resonators
&/ &/
/RDGFDSDFLWRUV
069
Calibration
The RC oscillator frequencies can vary from one chip to another due to manufacturing
process variations, Therefore, it is possible to route the HSI clock to the MCO multiplexer,
then the clock can be input to Timer 14 allowing the user to calibrate the oscillator.
around 40 kHz (between 30 kHz and 60 kHz). For more details, refer to the electrical
characteristics section of the datasheets.
3 Boot configuration
In the STM32F0x0, three different boot modes can be selected through the BOOT0 pin and
boot configuration bits nBOOT1 in the User option byte, as shown in the following table:
The Boot mode configuration is latched on the 4th rising edge of SYSCLK after a reset. It is
up to the user to set Boot mode configuration related to the required Boot mode.
The Boot mode configuration is also re-sampled when exiting from Standby mode.
Consequently they must be kept in the required Boot mode configuration in Standby mode.
After this startup delay has elapsed, the CPU fetches the top-of-stack value from address
0x0000 0000, then starts code execution from the boot memory at 0x0000 0004.
Depending on the selected boot mode, main Flash memory, system memory or SRAM is
accessible as follows:
• Boot from main Flash memory: the main Flash memory is aliased in the boot memory
space (0x0000 0000), but still accessible from its original memory space
(0x0800 0000). In other words, the Flash memory contents can be accessed starting
from address 0x0000 0000 or 0x0800 0000.
• Boot from system memory: the system memory is aliased in the boot memory space
(0x0000 0000), but still accessible from its original memory space (0x1FFF EC00 on
STM32F030x4, STM32F030x6 and STM32F030x8 devices, 0x1FFF C400 on
STM32F070x6 devices, 0x1FFF C800 on STM32F070xB and 0x1FFF D800 on
STM32F030xC devices).
• Boot from the embedded SRAM: the SRAM is aliased in the boot memory space
(0x0000 0000), but it is still accessible from its original memory space (0x2000 0000).
Empty check
On STM32F070x6 and STM32F030xC devices only, internal empty check flag is
implemented to allow easy programming of the virgin devices by the boot loader. This flag is
used when BOOT0 pin is defining Main Flash memory as the target boot space. When the
flag is set, the device is considered as empty and System memory (boot loader) is selected
instead of the Main Flash as a boot space to allow user to program the Flash memory.
This flag is updated only during Option bytes loading: it is set when the content of the
address 0x08000 0000 is read as 0xFFFF FFFF, otherwise it is cleared. It means a power
on or setting of OBL_LAUNCH bit in FLASH_CR register is needed to clear this flag after
programming of a virgin device to execute user code after System reset.
Note: If the device is programmed for a first time but the Option bytes are not reloaded, the device
will still select System memory as a boot space after a System reset. The boot loader code
is able to detect this situation and will change the boot memory mapping to Main Flash and
perform a jump to user code programmed there.
Physical remap
Once the boot mode is selected, the application software can modify the memory accessible
in the code area. This modification is performed by programming the MEM_MODE bits in
the SYSCFG configuration register 1 (SYSCFG_CFGR1). Unlike Cortex® M3 and M4, the
M0 CPU does not support the vector table relocation. For application code which is located
in a different address than 0x0800 0000, some additional code must be added in order to be
able to serve the application interrupts. A solution will be to relocate by software the vector
table to the internal SRAM:
• Copy the vector table from the Flash (mapped at the base of the application load
address) to the base address of the SRAM at 0x2000 0000.
• Remap SRAM at address 0x0000 0000, using SYSCFG configuration register 1.
• Then once an interrupt occurs, the Cortex®-M0 processor will fetch the interrupt
handler start address from the relocated vector table in SRAM, then it will jump to
execute the interrupt handler located in the Flash.
This operation should be done at the initialization phase of the application. Please refer to
application note STM32F0xx in-application programming using the USART (AN4065) and
attached IAP code from www.st.com for more details.
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, an SWD
connector and a cable connecting the host to the debug tool.
Figure 6 shows the connection of the host to the evaluation board.
'HEXJWRRO 6:'FRQQHFWRU
+RVW3& 3RZHUVXSSO\
(YDOXDWLRQERDUG
DLF
&1
1567
6:&/.3$
6:'$73$
9''
6:'FRQQHFWRU
06Y9
5 Recommendations
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 an 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 100 nF filtering ceramic
capacitor and a chemical capacitor of about 4.7 µF connected between the supply pins of
the STM32F0x0 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 8 shows the typical layout of such
a VDD/VSS pair.
9LDWR9'' 9LDWR966
&DS
9'' 966
069
6 Reference design
6.1 Description
The reference design shown in Figure 9, introduces the STM32F0x0, a highly integrated
microcontroller running at 48 MHz, that combines the Cortex®-M0 32-bit RISC CPU core
with 64 Kbytes of embedded Flash memory and 8 Kbytes of SRAM.
6.1.1 Clock
Two clock sources are used for the microcontroller:
• HSE: X1– 8 MHz crystal for the STM32F0x0 microcontroller
• LSE: X2– 32.768 kHz crystal for the embedded RTC
Refer to Section 2: Clocks on page 11.
6.1.2 Reset
The reset signal in Figure 9 is active low. The reset sources include:
• Reset button (B1)
• Debugging tools via the connector CN1
Refer to Section 1.2.2: System reset on page 9.
6:' FRQQHFWRU
&1
)76+/'9
9''
0&8
8
670)57
%RRW PRGH
3)
3)
3$
3$
3$
3$
3$
3$
3&
3&
3&
3&
3%
3%
3%
3%
9'' 9''
3$ 9''
3$ 966
6: 3& 3%
3& 3%
3& 3%
3' 3%
3% 3%
3& 7$03(5 :.83
3% 3&
3$ 7$03(5 :.83
5
. 3% 3&
3% 3$
3& 26&B287
3% 3$
3& 26&B,1
%227 3$
3) 26&B287
9''$ 95()
3% 3$
966$ 95()
3) 26&B,1
3% 3)
966 3)
9'' 3$
1567
9''
3$
3$
3&
3&
3&
3&
9''
9'' 9''$
5
; ; %
9''$ 9''
.+] 0+]
5(6(7 &
& & & & & & & &
S) S) S) S) X) Q) Q) Q) X)
&
/6( +6(
Q)
069
1 1 VBAT VDD
5 5 PD0 - OSC_IN PF0 - OSC_IN
6 6 PD1 - OSC_OUT PF1 - OSC_OUT
18 - VSS_4 PF4
19 - VDD_4 PF5
28 20 BOOT1 - PB2 PB2
47 35 VSS_2 PF6
48 36 VDD_2 PF7
1. Highlighted in bold the impacted pins of the transition between STM32F1 series to STM32F030 devices.
8 Revision history
STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, enhancements, modifications, and
improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on
ST products before placing orders. ST products are sold pursuant to ST’s terms and conditions of sale in place at the time of order
acknowledgement.
Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or
the design of Purchasers’ products.
Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product.
ST and the ST logo are trademarks of ST. All other product or service names are the property of their respective owners.
Information in this document supersedes and replaces information previously supplied in any prior versions of this document.