STM32F0 Reference Manual
STM32F0 Reference Manual
Reference manual
STM32F0x1/STM32F0x2/STM32F0x8
advanced ARM-based 32-bit MCUs
Introduction
This reference manual targets application developers. It provides complete information on
how to use the STM32F0x1/STM32F0x2/STM32F0x8 microcontroller memory and
peripherals.
It applies to the STM32F031x4/x6, STM32F051x4/x6/x8, STM32F071x8/xB,
STM32F042x4/x6, STM32F072x8/xB, STM32F038x6, STM32F048x6, STM32F058x8 and
STM32F078xB devices.
For the purpose of this manual, STM32F0x1/STM32F0x2/STM32F0x8 microcontrollers are
referred to as STM32F0xx.
The STM32F0xx is a family of microcontrollers with different memory sizes, packages and
peripherals.
For ordering information, mechanical and electrical device characteristics, please refer to
the corresponding datasheet.
For information on the ARM CORTEX-M0 core, please refer to the Cortex-M0 technical
reference manual.
Related documents
Cortex-M0 technical reference manual, available from: http://infocenter.arm.com
STM32F0xx Cortex-M0 programming manual (PM0215)
STM32F0xx datasheets available from our website: http://www.st.com
May 2014
DocID018940 Rev 6
1/988
www.st.com
Contents
RM0091
Contents
1
Documentation conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
1.1
1.2
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
1.3
Peripheral availability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
System architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
2.2
Memory organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
2.2.2
2.3
Embedded SRAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.4
2.5
Boot configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
3.2
3.3
2/988
2.2.1
3.2.1
3.2.2
Read operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.2.3
Memory protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
3.3.1
Read protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
3.3.2
Write protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
3.3.3
3.4
Flash interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
3.5
3.5.2
3.5.3
3.5.4
3.5.5
3.5.6
3.5.7
DocID018940 Rev 6
RM0091
Contents
3.5.9
Option bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4.1
3.5.8
4.1.2
4.1.3
4.1.4
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
5.2
5.3
5.4
CRC registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5.4.1
5.4.2
5.4.3
5.4.4
5.4.5
5.4.6
6.2
6.3
Power supplies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
6.1.1
6.1.2
6.1.3
6.1.4
Voltage regulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
6.2.2
Low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
6.3.1
6.3.2
6.3.3
Sleep mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
6.3.4
Stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
DocID018940 Rev 6
3/988
Contents
RM0091
6.4
Standby mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
6.3.6
6.4.2
6.4.3
7.2
4/988
6.3.5
Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
7.1.1
Power reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
7.1.2
System reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
7.1.3
Clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
7.2.1
7.2.2
7.2.3
7.2.4
PLL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
7.2.5
7.2.6
7.2.7
7.2.8
7.2.9
7.2.10
7.2.11
7.2.12
7.2.13
7.3
7.4
7.4.2
7.4.3
7.4.4
7.4.5
7.4.6
7.4.7
7.4.8
7.4.9
RM0091
Contents
7.4.10
7.4.11
7.4.12
7.4.13
7.4.14
7.4.15
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
8.2
8.3
8.3.2
8.3.3
8.3.4
8.3.5
8.4
8.5
8.6
8.6.2
8.6.3
8.6.4
8.6.5
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
9.2
9.3
9.3.2
9.3.3
9.3.4
9.3.5
9.3.6
9.3.7
DocID018940 Rev 6
5/988
Contents
RM0091
9.4
10
9.3.9
9.3.10
9.3.11
9.3.12
9.3.13
9.3.14
9.4.2
9.4.3
9.4.4
9.4.5
9.4.6
9.4.7
9.4.8
9.4.9
9.4.10
9.4.11
9.4.12
6/988
9.3.8
10.1.2
10.1.3
10.1.4
10.1.5
10.1.6
10.1.7
DocID018940 Rev 6
RM0091
11
Contents
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
11.2
11.3
11.4
12
11.3.1
11.3.2
Arbiter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
11.3.3
11.3.4
11.3.5
11.3.6
11.3.7
11.4.2
11.4.3
11.4.4
11.4.5
11.4.6
11.4.7
12.2
12.3
12.1.2
12.1.3
12.2.2
12.2.3
12.2.4
12.2.5
DocID018940 Rev 6
7/988
Contents
13
RM0091
12.3.2
12.3.3
12.3.4
12.3.5
12.3.6
12.3.7
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
13.2
13.3
13.4
13.4.2
13.4.3
13.4.4
13.4.5
13.4.6
13.4.7
13.4.8
13.4.9
13.5
13.6
13.7
8/988
13.5.2
13.5.3
13.5.4
13.5.5
13.6.2
13.6.3
13.6.4
Managing converted data without using the DMA without overrun . . . 228
13.6.5
RM0091
Contents
13.7.1
13.7.2
13.8
13.9
14
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
14.2
14.3
14.4
14.3.1
14.3.2
14.3.3
14.3.4
14.3.5
14.3.6
14.4.2
14.4.3
14.4.4
14.4.5
DocID018940 Rev 6
9/988
Contents
RM0091
14.4.6
14.4.7
14.5
14.6
14.7
14.8
14.8.2
14.8.3
14.8.4
14.8.5
14.8.6
14.8.7
14.8.8
14.8.9
15
10/988
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
15.2
15.3
15.3.2
15.3.3
15.3.4
DocID018940 Rev 6
RM0091
Contents
15.3.5
16
Hysteresis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
15.4
Power mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
15.5
Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
15.6
15.6.2
16.2
16.3
16.3.2
16.3.3
16.3.4
16.3.5
16.3.6
16.3.7
16.3.8
16.3.9
16.4
16.4.2
16.4.3
DocID018940 Rev 6
11/988
Contents
RM0091
16.4.4
16.4.5
16.4.6
16.4.7
16.4.8
16.4.9
17
17.2
17.3
17.3.2
17.3.3
17.3.4
17.3.5
17.3.6
17.3.7
17.3.8
17.3.9
12/988
DocID018940 Rev 6
RM0091
Contents
17.3.15 Timer synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
17.3.16 Debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
17.4
17.4.2
17.4.3
17.4.4
17.4.5
17.4.6
17.4.7
17.4.8
17.4.9
18
18.2
18.3
18.3.2
DocID018940 Rev 6
13/988
Contents
RM0091
18.4
18.3.3
18.3.4
18.3.5
18.3.6
18.3.7
18.3.8
18.3.9
18.4.2
18.4.3
18.4.4
18.4.5
18.4.6
18.4.7
18.4.8
18.4.9
19
19.2
19.3
19.4
19.4.2
19.4.3
19.4.4
19.4.5
19.4.6
19.4.7
19.4.8
19.4.9
DocID018940 Rev 6
RM0091
Contents
19.4.12 Using the break function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
19.4.13 One-pulse mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472
19.4.14 TIM15 external trigger synchronization . . . . . . . . . . . . . . . . . . . . . . . . 474
19.4.15 Timer synchronization (TIM15) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
19.4.16 Debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
19.5
19.5.2
19.5.3
19.5.4
19.5.5
19.5.6
19.5.7
19.5.8
19.5.9
19.6
19.6.2
19.6.3
19.6.4
19.6.5
19.6.6
19.6.7
19.6.8
19.6.9
DocID018940 Rev 6
15/988
Contents
RM0091
19.6.10 TIM16 and TIM17 auto-reload register (TIM16_ARR and
TIM17_ARR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510
19.6.11 TIM16 and TIM17 repetition counter register (TIM16_RCR and
TIM17_RCR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511
19.6.12 TIM16 and TIM17 capture/compare register 1 (TIM16_CCR1 and
TIM17_CCR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511
19.6.13 TIM16 and TIM17 break and dead-time register (TIM16_BDTR and
TIM17_BDTR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512
19.6.14 TIM16 and TIM17 DMA control register (TIM16_DCR and
TIM17_DCR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514
19.6.15 TIM16 and TIM17 DMA address for full transfer (TIM16_DMAR and
TIM17_DMAR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514
19.6.16 TIM16 and TIM17 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516
20
20.2
20.3
20.4
20.3.1
20.3.2
20.3.3
20.3.4
20.4.2
20.4.3
20.4.4
20.4.5
20.4.6
20.4.7
20.4.8
20.4.9
21
22
16/988
22.1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532
22.2
DocID018940 Rev 6
RM0091
Contents
22.3
22.4
23
22.3.1
22.3.2
22.3.3
22.3.4
22.3.5
22.4.2
22.4.3
22.4.4
22.4.5
22.4.6
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
23.2
23.3
23.4
24
23.3.1
23.3.2
23.3.3
23.3.4
23.3.5
23.4.2
23.4.3
23.4.4
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546
24.2
24.3
24.4
24.4.2
DocID018940 Rev 6
17/988
Contents
RM0091
24.4.3
24.4.4
24.4.5
24.4.6
24.4.7
24.4.8
24.4.9
24.5
24.6
24.7
24.7.2
24.7.3
24.7.4
24.7.5
24.7.6
24.7.7
24.7.8
24.7.9
18/988
DocID018940 Rev 6
RM0091
25
Contents
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589
25.2
25.3
25.4
25.4.2
25.4.3
25.4.4
25.4.5
25.4.6
25.4.7
25.4.8
25.4.9
25.5
25.6
25.7
25.7.2
25.7.3
25.7.4
25.7.5
25.7.6
25.7.7
25.7.8
25.7.9
DocID018940 Rev 6
19/988
Contents
RM0091
25.7.12 I2C register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657
26
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 659
26.2
26.3
26.4
26.5
26.5.2
Transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665
26.5.3
Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668
26.5.4
26.5.5
26.5.6
26.5.7
26.5.8
26.5.9
20/988
26.6
26.7
26.7.2
26.7.3
26.7.4
26.7.5
26.7.6
26.7.7
26.7.8
DocID018940 Rev 6
RM0091
Contents
26.7.9
27
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724
27.2
27.3
27.4
27.5
27.5.2
27.5.3
27.5.4
27.5.5
27.5.6
27.5.7
27.5.8
27.5.9
27.6
27.7
27.7.2
27.7.3
27.7.4
27.7.5
27.7.6
27.7.7
27.7.8
27.8
I S interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 766
27.9
DocID018940 Rev 6
21/988
Contents
RM0091
27.9.1
27.9.2
27.9.3
27.9.4
27.9.5
27.9.6
27.9.7
27.9.8
27.9.9
28
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 780
28.2
28.3
28.3.2
28.3.3
28.3.4
28.3.5
28.3.6
28.3.7
28.3.8
28.3.9
22/988
28.4
28.5
28.6
28.6.2
28.6.3
28.6.4
28.6.5
28.6.6
28.6.7
28.6.8
DocID018940 Rev 6
RM0091
Contents
28.6.9
29
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 799
29.2
29.3
29.4
29.5
29.3.1
29.3.2
29.3.3
Tx mailboxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 800
29.3.4
29.4.2
29.4.3
29.5.2
29.5.3
29.6
29.7
29.7.2
29.7.3
29.7.4
29.7.5
29.7.6
29.7.7
29.8
29.9
29.9.2
29.9.3
29.9.4
29.9.5
DocID018940 Rev 6
23/988
Contents
30
RM0091
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 844
30.2
30.3
30.4
30.5
30.6
31
30.5.2
30.5.3
30.5.4
30.5.5
30.6.2
30.6.3
30.6.4
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 877
31.2
31.3
31.4
31.3.1
31.3.2
31.3.3
Arbitration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 881
31.4.1
31.5
31.6
24/988
31.5.2
31.5.3
31.5.4
31.5.5
31.5.6
DocID018940 Rev 6
RM0091
Contents
31.7
32
31.7.2
31.7.3
31.7.4
31.7.5
31.7.6
31.7.7
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 897
32.2
32.3
32.4
32.3.1
32.3.2
32.3.3
32.5
32.5.2
32.5.3
32.5.4
32.5.5
32.5.6
32.6
32.7
32.8
32.9
32.8.2
32.9.2
32.9.3
32.9.4
DocID018940 Rev 6
25/988
Contents
33
RM0091
32.9.5
32.9.6
33.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 914
A.2
A.3
A.4
A.5
A.2.1
A.2.2
A.2.3
A.2.4
A.2.5
A.2.6
A.2.7
A.3.2
A.3.3
A.3.4
GPIO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 921
A.4.1
A.4.2
A.4.3
DMA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 923
A.5.1
A.6
A.7
26/988
A.6.2
ADC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 925
A.7.1
A.7.2
A.7.3
DocID018940 Rev 6
RM0091
Contents
A.8
A.9
A.7.4
A.7.5
A.7.6
A.7.7
A.7.8
A.7.9
A.7.10
A.7.11
A.7.12
A.7.13
A.7.14
A.7.15
A.7.16
DAC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 931
A.8.1
A.8.2
A.8.3
A.8.4
A.8.5
A.8.6
A.8.7
A.8.8
A.8.9
A.8.10
A.8.11
A.8.12
Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 936
A.9.1
A.9.2
A.9.3
A.9.4
A.9.5
A.9.6
A.9.7
A.9.8
A.9.9
A.9.10
DocID018940 Rev 6
27/988
Contents
RM0091
A.10
A.11
A.12
A.13
A.14
A.15
28/988
A.9.11
A.9.12
A.9.13
A.9.14
A.9.15
A.9.16
A.9.17
A.9.18
A.9.19
A.9.20
A.9.21
A.10.2
A.11.2
A.11.3
A.12.2
A.13.2
A.13.3
A.14.2
A.14.3
A.14.4
A.14.5
A.14.6
A.14.7
A.14.8
I2C configured in master mode to transmit with DMA code example . . 958
A.14.9
I2C configured in slave mode to receive with DMA code example . . . . 958
DocID018940 Rev 6
RM0091
Contents
A.16
A.17
A.18
A.19
A.15.1
A.15.2
A.16.2
A.16.3
A.16.4
A.16.5
A.16.6
A.16.7
A.16.8
A.17.2
A.17.3
A.17.4
A.17.5
A.17.6
A.18.2
A.19.2
A.19.3
A.19.4
A.19.5
A.19.6
A.19.7
A.19.8
A.19.9
A.20
DocID018940 Rev 6
29/988
Contents
34
30/988
RM0091
DocID018940 Rev 6
RM0091
List of tables
List of tables
Table 1.
Table 2.
Table 3.
Table 4.
Table 5.
Table 6.
Table 7.
Table 8.
Table 9.
Table 10.
Table 11.
Table 12.
Table 13.
Table 14.
Table 15.
Table 16.
Table 17.
Table 18.
Table 19.
Table 20.
Table 21.
Table 22.
Table 23.
Table 24.
Table 25.
Table 26.
Table 27.
Table 28.
Table 29.
Table 30.
Table 31.
Table 32.
Table 33.
Table 34.
Table 35.
Table 36.
Table 37.
Table 38.
Table 39.
Table 40.
Table 41.
Table 42.
Table 43.
Table 44.
Table 45.
Table 46.
Table 47.
DocID018940 Rev 6
31/988
List of tables
Table 48.
Table 49.
Table 50.
Table 51.
Table 52.
Table 53.
Table 54.
Table 55.
Table 56.
Table 57.
Table 58.
Table 59.
Table 60.
Table 61.
Table 62.
Table 63.
Table 64.
Table 65.
Table 66.
Table 67.
Table 68.
Table 69.
Table 70.
Table 71.
Table 72.
Table 73.
Table 74.
Table 75.
Table 76.
Table 77.
Table 78.
Table 79.
Table 80.
Table 81.
Table 82.
Table 83.
Table 84.
Table 85.
Table 86.
Table 87.
Table 88.
Table 89.
Table 90.
Table 91.
Table 92.
Table 93.
Table 94.
Table 95.
32/988
RM0091
DocID018940 Rev 6
RM0091
Table 96.
Table 97.
Table 98.
Table 99.
Table 100.
Table 101.
Table 102.
Table 103.
Table 104.
Table 105.
Table 106.
Table 107.
Table 108.
Table 109.
Table 110.
Table 111.
Table 112.
Table 113.
Table 114.
Table 115.
Table 116.
Table 117.
Table 118.
Table 119.
Table 120.
Table 121.
Table 122.
Table 123.
Table 124.
Table 125.
Table 126.
Table 127.
Table 128.
Table 129.
Table 130.
Table 131.
Table 132.
Table 133.
Table 134.
Table 135.
Table 136.
Table 137.
List of tables
USART interrupt requests. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 700
USART register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722
STM32F0xx SPI implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725
SPI interrupt requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 750
Audio-frequency precision using standard 8 MHz HSE . . . . . . . . . . . . . . . . . . . . . . . . . . 760
I2S interrupt requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 766
SPI register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 779
Acquisition sequence summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 783
Spread spectrum deviation versus AHB clock frequency . . . . . . . . . . . . . . . . . . . . . . . . . 785
I/O state depending on its mode and IODEF bit value . . . . . . . . . . . . . . . . . . . . . . . . . . . 786
Capacitive sensing GPIOs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 788
Effect of low-power modes on TSC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 788
Interrupt control bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 789
TSC register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 797
Transmit mailbox mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 813
Receive mailbox mapping. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 813
bxCAN register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 840
STM32F0xx USB implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 844
Double-buffering buffer flag definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 854
Bulk double-buffering memory buffers usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 855
Isochronous memory buffers usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 856
Resume event detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 858
Reception status encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 870
Endpoint type encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 871
Endpoint kind meaning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 871
Transmission status encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 871
Definition of allocated buffer memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 875
USB register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 875
HDMI pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 879
Error handling timing parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 885
TXERR timing parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 886
HDMI-CEC interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 887
HDMI-CEC register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 896
SW debug port pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 899
Packet request (8-bits) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 901
ACK response (3 bits). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 901
DATA transfer (33 bits) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 901
SW-DP registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 903
32-bit debug port registers addressed through the shifted value A[3:2] . . . . . . . . . . . . . . 904
Core debug registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 904
DBG register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 911
Document revision history. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 976
DocID018940 Rev 6
33/988
List of figures
RM0091
List of figures
Figure 1.
Figure 2.
Figure 3.
Figure 4.
Figure 5.
Figure 6.
Figure 7.
Figure 8.
Figure 9.
Figure 10.
Figure 11.
Figure 12.
Figure 13.
Figure 14.
Figure 15.
Figure 16.
Figure 17.
Figure 18.
Figure 19.
Figure 20.
Figure 21.
Figure 22.
Figure 23.
Figure 24.
Figure 25.
Figure 26.
Figure 27.
Figure 28.
Figure 29.
Figure 30.
Figure 31.
Figure 32.
Figure 33.
Figure 34.
Figure 35.
Figure 36.
Figure 37.
Figure 38.
Figure 39.
Figure 40.
Figure 41.
Figure 42.
Figure 43.
Figure 44.
Figure 45.
Figure 46.
Figure 47.
Figure 48.
34/988
DocID018940 Rev 6
RM0091
Figure 49.
Figure 50.
Figure 51.
Figure 52.
Figure 53.
Figure 54.
Figure 55.
Figure 56.
Figure 57.
Figure 58.
Figure 59.
Figure 60.
Figure 61.
Figure 62.
Figure 63.
Figure 64.
Figure 65.
Figure 66.
Figure 67.
Figure 68.
Figure 69.
Figure 70.
Figure 71.
Figure 72.
Figure 73.
Figure 74.
Figure 75.
Figure 76.
Figure 77.
Figure 78.
Figure 79.
Figure 80.
Figure 81.
Figure 82.
Figure 83.
Figure 84.
Figure 85.
Figure 86.
Figure 87.
Figure 88.
Figure 89.
Figure 90.
Figure 91.
Figure 92.
Figure 93.
Figure 94.
Figure 95.
Figure 96.
Figure 97.
Figure 98.
List of figures
DAC conversion (SW trigger enabled) with LFSR wave generation. . . . . . . . . . . . . . . . . 259
DAC triangle wave generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
DAC conversion (SW trigger enabled) with triangle wave generation . . . . . . . . . . . . . . . 260
Comparator 1 and 2 block diagrams. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
Comparator hysteresis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
Advanced-control timer block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
Counter timing diagram with prescaler division change from 1 to 2 . . . . . . . . . . . . . . . . . 284
Counter timing diagram with prescaler division change from 1 to 4 . . . . . . . . . . . . . . . . . 284
Counter timing diagram, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Counter timing diagram, internal clock divided by 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Counter timing diagram, internal clock divided by 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Counter timing diagram, internal clock divided by N. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Counter timing diagram, update event when ARPE=0
(TIMx_ARR not preloaded) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Counter timing diagram, update event when ARPE=1
(TIMx_ARR preloaded) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Counter timing diagram, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Counter timing diagram, internal clock divided by 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Counter timing diagram, internal clock divided by 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Counter timing diagram, internal clock divided by N. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Counter timing diagram, update event when repetition counter is not used . . . . . . . . . . . 291
Counter timing diagram, internal clock divided by 1, TIMx_ARR = 0x6 . . . . . . . . . . . . . . 292
Counter timing diagram, internal clock divided by 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Counter timing diagram, internal clock divided by 4, TIMx_ARR=0x36 . . . . . . . . . . . . . . 293
Counter timing diagram, internal clock divided by N. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
Counter timing diagram, update event with ARPE=1 (counter underflow) . . . . . . . . . . . . 294
Counter timing diagram, Update event with ARPE=1 (counter overflow) . . . . . . . . . . . . . 295
Update rate examples depending on mode and TIMx_RCR register settings . . . . . . . . . 296
Control circuit in normal mode, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . . 297
TI2 external clock connection example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
Control circuit in external clock mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
External trigger input block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
Control circuit in external clock mode 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
Capture/compare channel (example: channel 1 input stage) . . . . . . . . . . . . . . . . . . . . . . 301
Capture/compare channel 1 main circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Output stage of capture/compare channel (channel 1 to 3) . . . . . . . . . . . . . . . . . . . . . . . 302
Output stage of capture/compare channel (channel 4). . . . . . . . . . . . . . . . . . . . . . . . . . . 302
PWM input mode timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
Output compare mode, toggle on OC1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
Edge-aligned PWM waveforms (ARR=8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
Center-aligned PWM waveforms (ARR=8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
Complementary output with dead-time insertion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Dead-time waveforms with delay greater than the negative pulse. . . . . . . . . . . . . . . . . . 311
Dead-time waveforms with delay greater than the positive pulse. . . . . . . . . . . . . . . . . . . 311
Output behavior in response to a break . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
Clearing TIMx OCxREF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
6-step generation, COM example (OSSR=1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Example of one pulse mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
Example of counter operation in encoder interface mode. . . . . . . . . . . . . . . . . . . . . . . . . 322
Example of encoder interface mode with TI1FP1 polarity inverted. . . . . . . . . . . . . . . . . . 322
Example of hall sensor interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
Control circuit in reset mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
DocID018940 Rev 6
35/988
List of figures
Figure 99.
Figure 100.
Figure 101.
Figure 102.
Figure 103.
Figure 104.
Figure 105.
Figure 106.
Figure 107.
Figure 108.
Figure 109.
Figure 110.
Figure 111.
Figure 112.
Figure 113.
Figure 114.
Figure 115.
Figure 116.
Figure 117.
Figure 118.
Figure 119.
Figure 120.
Figure 121.
Figure 122.
Figure 123.
Figure 124.
Figure 125.
Figure 126.
Figure 127.
Figure 128.
Figure 129.
Figure 130.
Figure 131.
Figure 132.
Figure 133.
Figure 134.
Figure 135.
Figure 136.
Figure 137.
Figure 138.
Figure 139.
Figure 140.
Figure 141.
Figure 142.
Figure 143.
Figure 144.
Figure 145.
Figure 146.
Figure 147.
Figure 148.
36/988
RM0091
DocID018940 Rev 6
RM0091
Figure 149.
Figure 150.
Figure 151.
Figure 152.
Figure 153.
Figure 154.
Figure 155.
Figure 156.
Figure 157.
Figure 158.
Figure 159.
Figure 160.
Figure 161.
Figure 162.
Figure 163.
Figure 164.
Figure 165.
Figure 166.
Figure 167.
Figure 168.
Figure 169.
Figure 170.
Figure 171.
Figure 172.
Figure 173.
Figure 174.
Figure 175.
Figure 176.
Figure 177.
Figure 178.
Figure 179.
Figure 180.
Figure 181.
Figure 182.
Figure 183.
Figure 184.
Figure 185.
Figure 186.
Figure 187.
Figure 188.
Figure 189.
Figure 190.
Figure 191.
Figure 192.
Figure 193.
Figure 194.
Figure 195.
Figure 196.
List of figures
Counter timing diagram with prescaler division change from 1 to 2 . . . . . . . . . . . . . . . . . 425
Counter timing diagram with prescaler division change from 1 to 4 . . . . . . . . . . . . . . . . . 425
Counter timing diagram, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
Counter timing diagram, internal clock divided by 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
Counter timing diagram, internal clock divided by 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
Counter timing diagram, internal clock divided by N. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
Counter timing diagram, update event when ARPE=0
(TIMx_ARR not preloaded) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
Counter timing diagram, update event when ARPE=1
(TIMx_ARR preloaded) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
Control circuit in normal mode, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . . 429
Capture/compare channel (example: channel 1 input stage) . . . . . . . . . . . . . . . . . . . . . . 429
Capture/compare channel 1 main circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430
Output stage of capture/compare channel (channel 1). . . . . . . . . . . . . . . . . . . . . . . . . . . 430
Output compare mode, toggle on OC1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
Edge-aligned PWM waveforms (ARR=8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434
TIM15 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
TIM16 and TIM17 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448
Counter timing diagram with prescaler division change from 1 to 2 . . . . . . . . . . . . . . . . . 450
Counter timing diagram with prescaler division change from 1 to 4 . . . . . . . . . . . . . . . . . 450
Counter timing diagram, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452
Counter timing diagram, internal clock divided by 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453
Counter timing diagram, internal clock divided by 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453
Counter timing diagram, internal clock divided by N. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
Counter timing diagram, update event when ARPE=0
(TIMx_ARR not preloaded) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
Counter timing diagram, update event when ARPE=1
(TIMx_ARR preloaded) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
Update rate examples depending on mode and TIMx_RCR register settings . . . . . . . . . 456
Control circuit in normal mode, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . . 457
TI2 external clock connection example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458
Control circuit in external clock mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
Capture/compare channel (example: channel 1 input stage) . . . . . . . . . . . . . . . . . . . . . . 460
Capture/compare channel 1 main circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
Output stage of capture/compare channel (channel 1). . . . . . . . . . . . . . . . . . . . . . . . . . . 461
Output stage of capture/compare channel (channel 2 for TIM15) . . . . . . . . . . . . . . . . . . 461
PWM input mode timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463
Output compare mode, toggle on OC1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465
Edge-aligned PWM waveforms (ARR=8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467
Complementary output with dead-time insertion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468
Dead-time waveforms with delay greater than the negative pulse . . . . . . . . . . . . . . . . . . 468
Dead-time waveforms with delay greater than the positive pulse. . . . . . . . . . . . . . . . . . . 469
Output behavior in response to a break . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
Example of One-pulse mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472
Control circuit in reset mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
Control circuit in gated mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
Control circuit in trigger mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
Basic timer block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
Counter timing diagram with prescaler division change from 1 to 2 . . . . . . . . . . . . . . . . . 520
Counter timing diagram with prescaler division change from 1 to 4 . . . . . . . . . . . . . . . . . 520
Counter timing diagram, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
Counter timing diagram, internal clock divided by 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522
DocID018940 Rev 6
37/988
List of figures
RM0091
38/988
DocID018940 Rev 6
RM0091
Figure 247.
Figure 248.
Figure 249.
Figure 250.
Figure 251.
Figure 252.
Figure 253.
Figure 254.
Figure 255.
Figure 256.
Figure 257.
Figure 258.
Figure 259.
Figure 260.
Figure 261.
Figure 262.
Figure 263.
Figure 264.
Figure 265.
Figure 266.
Figure 267.
Figure 268.
Figure 269.
Figure 270.
Figure 271.
Figure 272.
Figure 273.
Figure 274.
Figure 275.
Figure 276.
Figure 277.
Figure 278.
Figure 279.
Figure 280.
Figure 281.
Figure 282.
Figure 283.
Figure 284.
Figure 285.
Figure 286.
Figure 287.
Figure 288.
Figure 289.
Figure 290.
Figure 291.
Figure 292.
Figure 293.
Figure 294.
Figure 295.
Figure 296.
List of figures
Mute mode using Idle line detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680
Mute mode using address mark detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681
Break detection in LIN mode (11-bit break length - LBDL bit is set) . . . . . . . . . . . . . . . . . 684
Break detection in LIN mode vs. Framing error detection. . . . . . . . . . . . . . . . . . . . . . . . . 685
USART example of synchronous transmission. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 686
USART data clock timing diagram (M bits = 00). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 686
USART data clock timing diagram (M bits = 01). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687
RX data setup/hold time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687
ISO 7816-3 asynchronous protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689
Parity error detection using the 1.5 stop bits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690
IrDA SIR ENDEC- block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694
IrDA data modulation (3/16) -Normal Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694
Transmission using DMA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 696
Reception using DMA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697
Hardware flow control between 2 USARTs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697
RS232 RTS flow control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698
RS232 CTS flow control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699
USART interrupt mapping diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701
SPI block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726
Full-duplex single master/ single slave application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727
Half-duplex single master/ single slave application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728
Simplex single master/single slave application (master in transmit-only/
slave in receive-only mode) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729
Master and three independent slaves. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 730
Hardware/software slave select management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731
Data clock timing diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733
Data alignment when data length is not equal to 8-bit or 16-bit . . . . . . . . . . . . . . . . . . . . 734
Packing data in FIFO for transmission and reception . . . . . . . . . . . . . . . . . . . . . . . . . . . . 738
Master full duplex communication. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 741
Slave full duplex communication. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 742
Master full duplex communication with CRC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 743
Master full duplex communication in packed mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 744
NSSP pulse generation in Motorola SPI master mode . . . . . . . . . . . . . . . . . . . . . . . . . . . 747
TI mode transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 748
I2S block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 751
I2S Philips protocol waveforms (16/32-bit full accuracy, CPOL = 0). . . . . . . . . . . . . . . . . 753
I2S Philips standard waveforms (24-bit frame with CPOL = 0) . . . . . . . . . . . . . . . . . . . . . 753
Transmitting 0x8EAA33 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754
Receiving 0x8EAA33 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754
I2S Philips standard (16-bit extended to 32-bit packet frame
with CPOL = 0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754
Example of 16-bit data frame extended to 32-bit channel frame . . . . . . . . . . . . . . . . . . . 754
MSB Justified 16-bit or 32-bit full-accuracy length with CPOL = 0 . . . . . . . . . . . . . . . . . . 755
MSB justified 24-bit frame length with CPOL = 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 755
MSB justified 16-bit extended to 32-bit packet frame with CPOL = 0 . . . . . . . . . . . . . . . . 755
LSB justified 16-bit or 32-bit full-accuracy with CPOL = 0 . . . . . . . . . . . . . . . . . . . . . . . . 756
LSB justified 24-bit frame length with CPOL = 0. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 756
Operations required to transmit 0x3478AE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 756
Operations required to receive 0x3478AE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 757
LSB justified 16-bit extended to 32-bit packet frame with CPOL = 0 . . . . . . . . . . . . . . . . 757
Example of 16-bit data frame extended to 32-bit channel frame . . . . . . . . . . . . . . . . . . . 757
PCM standard waveforms (16-bit) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 758
DocID018940 Rev 6
39/988
List of figures
Figure 297.
Figure 298.
Figure 299.
Figure 300.
Figure 301.
Figure 302.
Figure 303.
Figure 304.
Figure 305.
Figure 306.
Figure 307.
Figure 308.
Figure 309.
Figure 310.
Figure 311.
Figure 312.
Figure 313.
Figure 314.
Figure 315.
Figure 316.
Figure 317.
Figure 318.
Figure 319.
Figure 320.
Figure 321.
Figure 322.
Figure 323.
Figure 324.
Figure 325.
Figure 326.
Figure 327.
Figure 328.
Figure 329.
Figure 330.
Figure 331.
Figure 332.
40/988
RM0091
DocID018940 Rev 6
RM0091
Documentation conventions
Documentation conventions
1.1
1.2
read/write (rw)
read-only (r)
write-only (w)
Software can only write to this bit. Reading the bit returns the reset
value.
read/clear (rc_w1)
Software can read as well as clear this bit by writing 1. Writing 0 has
no effect on the bit value.
read/clear (rc_w0)
Software can read as well as clear this bit by writing 0. Writing 1 has
no effect on the bit value.
read/clear by read
(rc_r)
Software can read this bit. Reading this bit automatically clears it to
0. Writing 0 has no effect on the bit value.
read/set (rs)
Software can read as well as set this bit. Writing 0 has no effect on
the bit value.
Reserved (Res.)
Glossary
This section gives a brief definition of acronyms and abbreviations used in this document:
SWD-DP (SWD DEBUG PORT): SWD-DP provides a 2-pin (clock and data) interface
based on the Serial Wire Debug (SWD) protocol. Please refer to the Cortex-M0
technical reference manual.
IAP (in-application programming): IAP is the ability to re-program the Flash memory
of a microcontroller while the user program is running.
ICP (in-circuit programming): ICP is the ability to program the Flash memory of a
microcontroller using the JTAG protocol, the SWD protocol or the bootloader while the
device is mounted on the user application board.
DocID018940 Rev 6
41/988
42
Documentation conventions
1.3
RM0091
Peripheral availability
For peripheral availability and number across all sales types, please refer to the particular
device datasheet.
42/988
DocID018940 Rev 6
RM0091
2.1
System architecture
The main system consists of:
Two masters:
Four slaves:
Internal SRAM
&RUWH[
0
)/,7)
)ODVKLQWHUIDFH
6\VWHPEXV
65$0
%XVPDWUL[
'0$
&RQWUROOHU
&KDQQHOV
WR
)ODVKPHPRU\
$+%EXV
*3,2SRUWV
$%&'()
'0$
$+%EXV
$+%$3%
%ULGJH
5HVHWDQG
FORFN
FRQWUROOHU
5&&
7RXFK
VHQVLQJ
FRQWUROOHU
76&
&5&
'0$UHTXHVW
$3%EXV
6<6&)*
$'&
'$&
&203
7,0
7,07,0
7,07,07,07,0
7,0
,:'*
::'*
57&
&56
,&,&
86$5786$57
63,,663,
+'0,&(&
'%*0&8