Sign In
Upload
Manuals
Brands
ST Manuals
Microcontrollers
STM32F301 8 Series
ST STM32F301 8 Series Manuals
Manuals and User Guides for ST STM32F301 8 Series. We have
1
ST STM32F301 8 Series manual available for free PDF download: Reference Manual
ST STM32F301 8 Series Reference Manual (874 pages)
advanced Arm-based 32-bit MCUs
Brand:
ST
| Category:
Microcontrollers
| Size: 11 MB
Table of Contents
Table of Contents
2
Documentation Conventions
36
General Information
36
List of Abbreviations for Registers
36
Register Reset Value
36
Glossary
37
Availability of Peripherals
37
System and Memory Overview
38
System Architecture
38
Figure 1. System Architecture
38
S0: I-Bus
39
S1: D-Bus
39
S2: S-Bus
39
S3: DMA-Bus
39
Busmatrix
39
AHB/APB Bridges
39
Memory Organization
40
Introduction
40
Memory Map and Register Boundary Addresses
41
Table 1. Stm32F3Xx Peripheral Register Boundary Addresses
42
Embedded SRAM
44
Flash Memory Overview
44
Boot Configuration
44
Table 2. Boot Modes
44
Embedded Boot Loader
45
Embedded Flash Memory
46
Flash Main Features
46
Flash Memory Functional Description
46
Flash Memory Organization
46
Table 3. Flash Module Organization
46
Read Operations
47
Instruction Fetch
47
Prefetch Controller
48
Dcode Interface
48
Flash Program and Erase Operations
49
Unlocking the Flash Memory
49
Figure 2. Programming Procedure
50
Page Erase
51
Mass Erase
52
Figure 3. Flash Memory Page Erase Procedure
52
Figure 4. Flash Memory Mass Erase Procedure
53
Option Byte Programming
53
Memory Protection
55
Read Protection (RDP)
55
Table 4. Flash Memory Read Protection Status
55
Level 2: no Debug
56
Table 5. Access Status Versus Protection Level and Execution Modes
56
Write Protection
57
Option Byte Block Write Protection
57
Flash Interrupts
57
Table 6. Flash Interrupt Request
57
Flash Register Description
58
Flash Access Control Register (FLASH_ACR)
58
Flash Key Register (FLASH_KEYR)
58
Flash Option Key Register (FLASH_OPTKEYR)
59
Flash Status Register (FLASH_SR)
59
Flash Control Register (FLASH_CR)
60
Flash Address Register (FLASH_AR)
61
Option Byte Register (FLASH_OBR)
62
Write Protection Register (FLASH_WRPR)
63
Flash Register Map
63
Table 7. Flash Interface - Register Map and Reset Values
63
Option Byte Description
65
Table 8. Option Byte Format
65
Table 9. Option Byte Organization
65
Table 10. Description of the Option Bytes
66
Cyclic Redundancy Check Calculation Unit (CRC)
68
Introduction
68
CRC Main Features
68
CRC Functional Description
69
CRC Block Diagram
69
CRC Internal Signals
69
CRC Operation
69
Table 11. CRC Internal Input/Output Signals
69
Figure 5. CRC Calculation Unit Block Diagram
69
Polynomial Programmability
70
CRC Registers
71
CRC Data Register (CRC_DR)
71
CRC Independent Data Register (CRC_IDR)
71
CRC Control Register (CRC_CR)
72
CRC Initial Value (CRC_INIT)
73
CRC Polynomial (CRC_POL)
73
CRC Register Map
74
Table 12. CRC Register Map and Reset Values
74
Power Control (PWR)
75
Power Supplies
75
Figure 6. Power Supply Overview (Stm32F301Xx Devices)
75
Figure 7. Power Supply Overview (Stm32F318Xx Devices)
76
Independent A/D and D/A Converter Supply and Reference Voltage
77
Battery Backup Domain
77
Voltage Regulator
78
Power Supply Supervisor
78
Power on Reset (Por)/Power down Reset (PDR)
78
Programmable Voltage Detector (PVD)
79
Figure 8. Power on Reset/Power down Reset Waveform
79
External NPOR Signal
80
Low-Power Modes
80
Figure 9. PVD Thresholds
80
Slowing down System Clocks
81
Peripheral Clock Gating
81
Table 13. Low-Power Mode Summary
81
Exiting Sleep Mode
82
Table 14. Sleep-Now
82
Stop Mode
83
Entering Stop Mode
83
Table 15. Sleep-On-Exit
83
Standby Mode
84
Table 16. Stop Mode
84
Exiting Standby Mode
85
I/O States in Standby Mode
85
Auto-Wakeup from Low-Power Mode
86
Power Control Registers
87
Power Control Register (PWR_CR)
87
Power Control/Status Register (PWR_CSR)
88
PWR Register Map
89
Table 18. PWR Register Map and Reset Values
89
Reset and Clock Control (RCC)
90
Reset
90
Power Reset
90
System Reset
90
Figure 10. Simplified Diagram of the Reset Circuit
91
Software Reset
91
Low-Power Management Reset
91
RTC Domain Reset
91
Clocks
92
Figure 11. Stm32F3Xx Clock Tree
93
HSE Clock
94
Figure 12. HSE/ LSE Clock Sources
94
External Crystal/Ceramic Resonator (HSE Crystal)
95
External Source (HSE Bypass)
95
HSI Clock
95
Pll
96
LSE Clock
96
LSI Clock
97
System Clock (SYSCLK) Selection
97
Clock Security System (CSS)
97
ADC Clock
98
RTC Clock
98
Timers (Timx) Clock
98
Watchdog Clock
99
I2S Clock
99
Clock-Out Capability
99
Internal/External Clock Measurement with TIM16
99
Figure 13. Frequency Measurement with TIM16 in Capture Mode
99
Calibration of the LSI
100
Low-Power Modes
100
RCC Registers
102
Clock Control Register (RCC_CR)
102
Clock Configuration Register (RCC_CFGR)
104
Clock Interrupt Register (RCC_CIR)
106
APB2 Peripheral Reset Register (RCC_APB2RSTR)
109
APB1 Peripheral Reset Register (RCC_APB1RSTR)
110
AHB Peripheral Clock Enable Register (RCC_AHBENR)
111
APB2 Peripheral Clock Enable Register (RCC_APB2ENR)
113
APB1 Peripheral Clock Enable Register (RCC_APB1ENR)
114
RTC Domain Control Register (RCC_BDCR)
117
Control/Status Register (RCC_CSR)
118
AHB Peripheral Reset Register (RCC_AHBRSTR)
120
Clock Configuration Register 2 (RCC_CFGR2)
121
Clock Configuration Register 3 (RCC_CFGR3)
122
RCC Register Map
124
Table 19. RCC Register Map and Reset Values
124
Offset Register
125
General-Purpose I/Os (GPIO)
126
Introduction
126
GPIO Main Features
126
GPIO Functional Description
126
Figure 14. Basic Structure of an I/O Port Bit
127
Figure 15. Basic Structure of a 5-Volt Tolerant I/O Port Bit
127
General-Purpose I/O (GPIO)
128
Table 20. Port Bit Configuration Table
128
I/O Pin Alternate Function Multiplexer and Mapping
129
I/O Port Control Registers
130
I/O Port Data Registers
130
I/O Data Bitwise Handling
130
GPIO Locking Mechanism
130
I/O Alternate Function Input/Output
131
External Interrupt/Wake-Up Lines
131
Input Configuration
131
Output Configuration
132
Figure 16. Input Floating / Pull up / Pull down Configurations
132
Alternate Function Configuration
133
Figure 17. Output Configuration
133
Analog Configuration
134
Figure 18. Alternate Function Configuration
134
Figure 19. High Impedance-Analog Configuration
134
Using the HSE or LSE Oscillator Pins as Gpios
135
Using the GPIO Pins in the RTC Supply Domain
135
GPIO Registers
136
GPIO Port Mode Register (Gpiox_Moder)
136
(X = a to D and F)
136
GPIO Port Output Type Register (Gpiox_Otyper)
136
GPIO Port Output Speed Register (Gpiox_Ospeedr)
137
(X = a to D and F)
137
GPIO Port Pull-Up/Pull-Down Register (Gpiox_Pupdr)
137
GPIO Port Input Data Register (Gpiox_Idr)
138
(X = a to D and F)
138
GPIO Port Output Data Register (Gpiox_Odr)
138
GPIO Port Bit Set/Reset Register (Gpiox_Bsrr)
139
(X = a to D and F)
139
GPIO Port Configuration Lock Register (Gpiox_Lckr)
139
(X = a to E and F)
139
GPIO Alternate Function Low Register (Gpiox_Afrl)
140
(X = a to D and F)
140
GPIO Alternate Function High Register (Gpiox_Afrh)
140
GPIO Port Bit Reset Register (Gpiox_Brr) (X = a to D and F)
141
GPIO Register Map
142
Table 21. GPIO Register Map and Reset Values
142
System Configuration Controller (SYSCFG)
144
SYSCFG Registers
144
SYSCFG Configuration Register 1 (SYSCFG_CFGR1)
144
SYSCFG External Interrupt Configuration Register 1
146
(Syscfg_Exticr1)
146
SYSCFG External Interrupt Configuration Register 2
147
(Syscfg_Exticr2)
147
SYSCFG External Interrupt Configuration Register 3
148
(Syscfg_Exticr3)
148
SYSCFG External Interrupt Configuration Register 4
149
(Syscfg_Exticr4)
149
SYSCFG Configuration Register 2 (SYSCFG_CFGR2)
150
SYSCFG Register Map
151
Table 22. SYSCFG Register Map and Reset Values
151
Direct Memory Access Controller (DMA)
152
Introduction
152
DMA Main Features
152
DMA Implementation
153
Dma1
153
DMA Request Mapping
153
Table 23. DMA Implementation
153
Figure 20. DMA Request Mapping
154
Table 24. DMA Requests for each Channel
155
DMA Functional Description
156
DMA Block Diagram
156
Figure 21. DMA Block Diagram
156
DMA Transfers
157
DMA Arbitration
158
DMA Channels
158
Channel Configuration Procedure
159
Memory-To-Memory Mode
161
DMA Data Width, Alignment, and Endianness
162
Table 25. Programmable Data Width and Endian Behavior (When PINC = MINC = 1)
162
DMA Error Management
163
DMA Interrupts
164
DMA Registers
164
DMA Interrupt Status Register (DMA_ISR)
164
Table 26. DMA Interrupt Requests
164
DMA Interrupt Flag Clear Register (DMA
166
DMA Channel X Configuration Register (Dma_Ccrx)
168
DMA Channel X Number of Data to Transfer Register (Dma_Cndtrx)
170
DMA Channel X Peripheral Address Register (Dma_Cparx)
171
DMA Channel X Memory Address Register (Dma_Cmarx)
172
DMA Register Map
172
Table 27. DMA Register Map and Reset Values
172
Interrupts and Events
175
Nested Vectored Interrupt Controller (NVIC)
175
NVIC Main Features
175
Systick Calibration Value Register
175
Interrupt and Exception Vectors
175
Table 28. Stm32F3Xx Vector Table
175
Extended Interrupts and Events Controller (EXTI)
178
Main Features
179
Block Diagram
179
Figure 22. External Interrupt/Event Block Diagram
179
Wake-Up Event Management
180
Asynchronous Internal Interrupts
180
Functional Description
180
Hardware Interrupt Selection
181
Hardware Event Selection
181
Software Interrupt/Event Selection
181
External and Internal Interrupt/Event Line Mapping
182
Figure 23. External Interrupt/Event GPIO Mapping
182
EXTI Registers
183
Interrupt Mask Register (EXTI_IMR1)
183
Event Mask Register (EXTI_EMR1)
184
Rising Trigger Selection Register (EXTI_RTSR1)
185
Falling Trigger Selection Register (EXTI_FTSR1)
186
Software Interrupt Event Register (EXTI_SWIER1)
187
Pending Register (EXTI_PR1)
188
Interrupt Mask Register (EXTI_IMR2)
189
Event Mask Register (EXTI_EMR2)
189
Rising Trigger Selection Register (EXTI_RTSR2)
189
Falling Trigger Selection Register (EXTI_FTSR2)
190
Software Interrupt Event Register (EXTI_SWIER2)
190
Pending Register (EXTI_PR2)
191
EXTI Register Map
191
Table 29. External Interrupt/Event Controller Register Map and Reset Values
191
Analog-To-Digital Converters (ADC)
193
Introduction
193
ADC Main Features
193
ADC Functional Description
195
ADC Block Diagram
195
Figure 24. ADC Block Diagram
195
Pins and Internal Signals
196
Table 30. ADC Internal Signals
196
Clocks
196
Dual Clock Domain Architecture
196
Table 31. ADC Pins
196
Figure 25. ADC Clock Scheme
197
Clock Ratio Constraint between ADC Clock and AHB Clock
198
ADC1 Connectivity
198
Slave AHB Interface
198
Figure 26. ADC1 Connectivity
198
ADC Voltage Regulator (ADVREGEN)
199
Single-Ended and Differential Input Channels
199
Calibration (ADCAL, ADCALDIF, Adcx_Calfact)
200
Software Procedure to Calibrate the ADC
200
Figure 27. ADC Calibration
201
Software Procedure to Re-Inject a Calibration Factor into the ADC
201
Figure 28. Updating the ADC Calibration Factor
201
Converting Single-Ended and Differential Analog Inputs with a Single ADC
201
ADC On-Off Control (ADEN, ADDIS, ADRDY)
202
Figure 29. Mixing Single-Ended and Differential Channels
202
Software Procedure to Enable the ADC
203
Software Procedure to Disable the ADC
203
Figure 30. Enabling / Disabling the ADC
203
Constraints When Writing the ADC Control Bits
203
Channel Selection (Sqrx, Jsqrx)
204
Channel-Wise Programmable Sampling Time (SMPR1, SMPR2)
205
Constraints on the Sampling Time for Fast and Slow Channels
205
Single Conversion Mode (CONT=0)
205
Continuous Conversion Mode (CONT=1)
206
Starting Conversions (ADSTART, JADSTART)
207
Timing
207
Stopping an Ongoing Conversion (ADSTP, JADSTP)
208
Figure 31. Analog-To-Digital Conversion Time
208
Figure 32. Stopping Ongoing Regular Conversions
209
Figure 33. Stopping Ongoing Regular and Injected Conversions
209
Conversion on External Trigger and Trigger Polarity
210
Jextsel, Jexten)
210
Table 32. Configuring the Trigger Polarity for Regular External Triggers
210
Table 33. Configuring the Trigger Polarity for Injected External Triggers
210
Table 34. ADC1 (Master) - External Triggers for Regular Channels
211
Figure 34. Triggers Are Shared between ADC Master & ADC Slave
211
Injected Channel Management
212
Table 35. ADC1 - External Trigger for Injected Channels
212
Auto-Injection Mode
213
Figure 35. Injected Conversion Latency
213
Discontinuous Mode (DISCEN, DISCNUM, JDISCEN)
214
Injected Group Mode
214
Queue of Context for Injected Conversions
215
Behavior When Changing the Trigger or Sequence Context
216
Figure 36. Example of JSQR Queue of Context (Sequence Change)
216
Figure 37. Example of JSQR Queue of Context (Trigger Change)
217
Queue of Context: Behavior When a Queue Overflow Occurs
217
Figure 38. Example of JSQR Queue of Context with Overflow before Conversion
217
Figure 39. Example of JSQR Queue of Context with Overflow During Conversion
218
Queue of Context: Behavior When the Queue Becomes Empty
218
Figure 40. Example of JSQR Queue of Context with Empty Queue (Case JQM=0)
218
Figure 41. Example of JSQR Queue of Context with Empty Queue (Case JQM=1)
219
Flushing the Queue of Context
219
Figure 42. Flushing JSQR Queue of Context by Setting JADSTP=1 (JQM=0). Case When JADSTP Occurs During an Ongoing Conversion
219
Figure 43. Flushing JSQR Queue of Context by Setting JADSTP=1 (JQM=0)
219
Figure 44. Flushing JSQR Queue of Context by Setting JADSTP=1 (JQM=0). Case When JADSTP Occurs Outside an Ongoing Conversion
220
Figure 45. Flushing JSQR Queue of Context by Setting JADSTP=1 (JQM=1)
221
Figure 46. Flushing JSQR Queue of Context by Setting ADDIS=1 (JQM=0)
221
Figure 47. Flushing JSQR Queue of Context by Setting ADDIS=1 (JQM=1)
222
Figure 48. Example of JSQR Queue of Context When Changing SW and HW Triggers
222
Programmable Resolution (RES) - Fast Conversion Mode
223
End of Conversion, End of Sampling Phase (EOC, JEOC, EOSMP)
223
Table 36. TSAR Timings Depending on Resolution
223
End of Conversion Sequence (EOS, JEOS)
224
Timing Diagrams Example
224
Hardware/Software Triggers)
224
Figure 49. Single Conversions of a Sequence, Software Trigger
224
Figure 50. Continuous Conversion of a Sequence, Software Trigger
225
Figure 51. Single Conversions of a Sequence, Hardware Trigger
225
Figure 52. Continuous Conversions of a Sequence, Hardware Trigger
225
Data Management
226
Data and Alignment
226
Table 37. Offset Computation Versus Data Resolution
226
Figure 53. Right Alignment (Offset Disabled, Unsigned Value)
227
Figure 54. Right Alignment (Offset Enabled, Signed Value)
228
Figure 55. Left Alignment (Offset Disabled, Unsigned Value)
228
Figure 56. Left Alignment (Offset Enabled, Signed Value)
229
ADC Overrun (OVR, OVRMOD)
229
Figure 57. Example of Overrun (OVR)
230
Managing a Sequence of Conversion Without Using the DMA
230
Managing Conversions Without Using the DMA and Without Overrun
230
Managing Conversions Using the DMA
230
DMA One Shot Mode (DMACFG=0)
231
DMA Circular Mode (DMACFG=1)
231
Dynamic Low-Power Features
231
Figure 58. AUTODLY=1, Regular Conversion in Continuous Mode, Software Trigger
233
Figure 59. AUTODLY=1, Regular HW Conversions Interrupted by Injected Conversions (DISCEN=0; JDISCEN=0)
233
Figure 60. AUTODLY=1, Regular HW Conversions Interrupted by Injected Conversions
234
Figure 61. AUTODLY=1, Regular Continuous Conversions Interrupted by Injected Conversions
235
Figure 62. AUTODLY=1 in Auto- Injected Mode (JAUTO=1)
235
Analog Window Watchdog (AWD1EN, JAWD1EN, AWD1SGL, AWD1CH, AWD2CH, AWD3CH, Awd_Htx, Awd_Ltx, Awdx)
236
Table 38. Analog Watchdog Channel Selection
236
Figure 63. Analog Watchdog's Guarded Area
236
Table 39. Analog Watchdog 1 Comparison
237
Table 40. Analog Watchdog 2 and 3 Comparison
237
Adcy_Awdx_Out Signal Output Generation
238
Figure 64. Adcy_Awdx_Out Signal Generation (on All Regular Channels)
238
Figure 65. Adcy_Awdx_Out Signal Generation (Awdx Flag Not Cleared by SW)
239
Figure 66. Adcy_Awdx_Out Signal Generation (on a Single Regular Channel)
239
Figure 67. Adcy_Awdx_Out Signal Generation (on All Injected Channels)
239
Temperature Sensor
240
Figure 68. Temperature Sensor Channel Block Diagram
240
Reading the Temperature
240
VBAT Supply Monitoring
241
Figure 69. VBAT Channel Block Diagram
241
Monitoring the Internal Voltage Reference
242
ADC Interrupts
243
Table 41. ADC Interrupts Per each ADC
243
ADC Registers (for each ADC)
244
ADC Interrupt and Status Register (Adcx_Isr, X=1)
244
ADC Interrupt Enable Register (Adcx_Ier, X=1)
246
ADC Control Register (Adcx_Cr, X=1)
248
ADC Configuration Register (Adcx_Cfgr, X=1)
251
ADC Sample Time Register 1 (Adcx_Smpr1, X=1)
254
ADC Sample Time Register 2 (Adcx_Smpr2, X=1)
256
ADC Watchdog Threshold Register 1 (Adcx_Tr1, X=1)
256
ADC Watchdog Threshold Register 2 (Adcx_Tr2, X = 1)
257
ADC Watchdog Threshold Register 3 (Adcx_Tr3, X=1)
258
ADC Regular Sequence Register 1 (Adcx_Sqr1, X=1)
259
ADC Regular Sequence Register 2 (Adcx_Sqr2, X=1)
260
ADC Regular Sequence Register 3 (Adcx_Sqr3, X=1)
262
ADC Regular Sequence Register 4 (Adcx_Sqr4, X=1)
263
ADC Regular Data Register (Adcx_Dr, X=1)
264
ADC Injected Sequence Register (Adcx_Jsqr, X=1)
265
ADC Offset Register (Adcx_Ofry, X=1) (Y=1
267
ADC Injected Data Register (Adcx_Jdry, X=1, Y= 1
268
ADC Analog Watchdog 2 Configuration Register
268
ADC Analog Watchdog 3 Configuration Register
269
ADC Differential Mode Selection Register (Adcx_Difsel, X=1)
269
ADC Calibration Factors (Adcx_Calfact, X=1)
270
ADC Common Registers
271
ADC Common Status Register (Adcx_Csr, X=1)
271
ADC Common Control Register (Adcx_Ccr, X=1)
273
ADC Register Map
274
Table 42. ADC Global Register Map
274
Table 43. ADC Register Map and Reset Values for each ADC
274
Table 44. ADC Register Map and Reset Values (Master and Slave ADC Common Registers) Offset =0X300, X=1)
276
Digital-To-Analog Converter (DAC1)
278
Introduction
278
DAC1 Main Features
278
DAC Output Buffer Enable
279
Table 45. Dacx Pins
279
Figure 70. DAC1 Block Diagram
279
DAC Channel Enable
280
Single Mode Functional Description
280
DAC Data Format
280
DAC Channel Conversion
280
Figure 71. Data Registers in Single DAC Channel Mode
280
Independent Trigger with Single LFSR Generation
281
Independent Trigger with Single Triangle Generation
281
DAC Output Voltage
281
Figure 72. Timing Diagram for Conversion with Trigger Disabled TEN = 0
281
DAC Trigger Selection
282
Table 46. External Triggers (DAC1)
282
Noise Generation
283
Figure 73. DAC LFSR Register Calculation Algorithm
283
Figure 74. DAC Conversion (SW Trigger Enabled) with LFSR Wave Generation
283
Triangle-Wave Generation
284
Figure 75. DAC Triangle Wave Generation
284
Figure 76. DAC Conversion (SW Trigger Enabled) with Triangle Wave Generation
284
DMA Request
285
DMA Underrun
285
DAC Registers
286
DAC Control Register (DAC_CR)
286
DAC Software Trigger Register (DAC_SWTRIGR)
288
DAC Channel1 12-Bit Right-Aligned Data Holding Register (DAC_DHR12R1)
288
DAC Channel1 12-Bit Left-Aligned Data Holding Register
289
(Dac_Dhr12L1)
289
DAC Channel1 8-Bit Right-Aligned Data Holding Register (DAC_DHR8R1)
289
DAC Channel1 Data Output Register (DAC_DOR1)
289
DAC Status Register (DAC_SR)
290
DAC Register Map
291
Comparator (COMP)
292
Introduction
292
COMP Main Features
292
COMP Functional Description
293
COMP Block Diagram
293
Figure 77. Comparator 2 Block Diagram
293
Figure 78. Comparator 4 Block Diagram
293
Figure 79. Comparator 6 Block Diagram
293
COMP Pins and Internal Signals
294
COMP Reset and Clocks
294
Comparator LOCK Mechanism
295
Comparator Output Blanking Function
295
COMP Interrupts
296
COMP Registers
296
COMP2 Control and Status Register (COMP2_CSR)
296
Figure 80. Comparator Output Blanking
296
COMP4 Control and Status Register (COMP4_CSR)
298
COMP6 Control and Status Register (COMP6_CSR)
299
COMP Register Map
302
Operational Amplifier (OPAMP)
303
OPAMP Introduction
303
OPAMP Main Features
303
OPAMP Functional Description
303
General Description
303
Clock
303
Operational Amplifiers and Comparators Interconnections
304
Using the OPAMP Output as an ADC Input
304
Calibration
304
Figure 81. Comparator and Operational Amplifier Connections
304
Timer Controlled Multiplexer Mode
305
Figure 82. Timer Controlled Multiplexer Mode
305
OPAMP Modes
306
Figure 83. Standalone Mode: External Gain Setting Mode
306
Follower Configuration Mode
306
Figure 84. Follower Configuration
307
Programmable Gain Amplifier Mode
307
Figure 85. PGA Mode, Internal Gain Setting (X2/X4/X8/X16), Inverting Input Not Used
308
Figure 86. PGA Mode, Internal Gain Setting (X2/X4/X8/X16), Inverting Input Used for
308
OPAMP Registers
309
OPAMP2 Control Register (OPAMP2_CSR)
309
OPAMP Register Map
312
Offset Register
312
Touch Sensing Controller (TSC)
313
Introduction
313
TSC Main Features
313
TSC Functional Description
314
TSC Block Diagram
314
Surface Charge Transfer Acquisition Overview
314
Figure 87. TSC Block Diagram
314
Figure 88. Surface Charge Transfer Analog I/O Group Structure
315
Figure 89. Sampling Capacitor Voltage Variation
316
Reset and Clocks
317
Charge Transfer Acquisition Sequence
317
Figure 90. Charge Transfer Acquisition Sequence
317
Spread Spectrum Feature
318
Figure 91. Spread Spectrum Variation Principle
318
Max Count Error
319
Sampling Capacitor I/O and Channel I/O Mode Selection
319
Acquisition Mode
320
I/O Hysteresis and Analog Switch Control
320
TSC Low-Power Modes
321
TSC Interrupts
321
TSC Registers
321
TSC Control Register (TSC_CR)
321
TSC Interrupt Enable Register (TSC_IER)
324
TSC Interrupt Clear Register (TSC_ICR)
325
TSC Interrupt Status Register (TSC_ISR)
325
TSC I/O Hysteresis Control Register (TSC_IOHCR)
326
TSC I/O Analog Switch Control Register
326
(Tsc_Ioascr)
326
TSC I/O Sampling Control Register (TSC_IOSCR)
327
TSC I/O Channel Control Register (TSC_IOCCR)
327
TSC I/O Group Control Status Register (TSC_IOGCSR)
328
TSC I/O Group X Counter Register (Tsc_Iogxcr)
328
TSC Register Map
329
Advanced-Control Timer (TIM1)
331
TIM1 Introduction
331
TIM1 Main Features
332
Figure 92. Advanced-Control Timer Block Diagram
333
TIM1 Functional Description
335
Time-Base Unit
335
Prescaler Description
335
Figure 93. Counter Timing Diagram with Prescaler Division Change from 1 to 2
336
Figure 94. Counter Timing Diagram with Prescaler Division Change from 1 to 4
336
Counter Modes
337
Figure 95. Counter Timing Diagram, Internal Clock Divided by 1
338
Figure 96. Counter Timing Diagram, Internal Clock Divided by 2
338
Figure 97. Counter Timing Diagram, Internal Clock Divided by 4
339
Figure 98. Counter Timing Diagram, Internal Clock Divided by N
339
Figure 99. Counter Timing Diagram, Update Event When ARPE=0 (Timx_Arr Not Preloaded)
340
Figure 100. Counter Timing Diagram, Update Event When ARPE=1 (Timx_Arr Preloaded)
340
Downcounting Mode
341
Figure 101. Counter Timing Diagram, Internal Clock Divided by 1
342
Figure 102. Counter Timing Diagram, Internal Clock Divided by 2
342
Figure 103. Counter Timing Diagram, Internal Clock Divided by 4
343
Figure 104. Counter Timing Diagram, Internal Clock Divided by N
343
Figure 105. Counter Timing Diagram, Update Event When Repetition Counter Is Not Used
344
Center-Aligned Mode (Up/Down Counting)
344
Figure 106. Counter Timing Diagram, Internal Clock Divided by 1, Timx_Arr = 0X6
345
Figure 107. Counter Timing Diagram, Internal Clock Divided by 2
346
Figure 108. Counter Timing Diagram, Internal Clock Divided by 4, Timx_Arr=0X36
346
Figure 109. Counter Timing Diagram, Internal Clock Divided by N
347
Figure 110. Counter Timing Diagram, Update Event with ARPE=1 (Counter Underflow)
347
Repetition Counter
348
Figure 111. Counter Timing Diagram, Update Event with ARPE=1 (Counter Overflow)
348
Figure 112. Update Rate Examples Depending on Mode and Timx_Rcr Register Settings
349
External Trigger Input
350
Figure 113. External Trigger Input Block
350
Clock Selection
351
Figure 114. Control Circuit in Normal Mode, Internal Clock Divided by 1
351
Figure 115. TI2 External Clock Connection Example
352
Figure 116. Control Circuit in External Clock Mode 1
353
Figure 117. External Trigger Input Block
353
Figure 118. Control Circuit in External Clock Mode 2
354
Capture/Compare Channels
355
Figure 119. Capture/Compare Channel (Example: Channel 1 Input Stage)
355
Figure 120. Capture/Compare Channel 1 Main Circuit
356
Figure 121. Output Stage of Capture/Compare Channel (Channel 1, Idem Ch. 2 and 3)
356
Figure 122. Output Stage of Capture/Compare Channel (Channel 4)
357
Figure 123. Output Stage of Capture/Compare Channel (Channel 5, Idem Ch. 6)
357
Input Capture Mode
358
PWM Input Mode
359
Forced Output Mode
359
Figure 124. PWM Input Mode Timing
359
Output Compare Mode
360
PWM Mode
361
Figure 125. Output Compare Mode, Toggle on OC1
361
Figure 126. Edge-Aligned PWM Waveforms (ARR=8)
362
PWM Center-Aligned Mode
362
Figure 127. Center-Aligned PWM Waveforms (ARR=8)
363
Asymmetric PWM Mode
364
Combined PWM Mode
365
Figure 128. Generation of 2 Phase-Shifted PWM Signals with 50% Duty Cycle
365
Combined 3-Phase PWM Mode
366
Figure 129. Combined PWM Mode on Channel 1 and 3
366
Complementary Outputs and Dead-Time Insertion
367
Figure 130. 3-Phase Combined PWM Signals with Multiple Trigger Pulses Per Period
367
Figure 131. Complementary Output with Dead-Time Insertion
368
Figure 132. Dead-Time Waveforms with Delay Greater than the Negative Pulse
368
Figure 133. Dead-Time Waveforms with Delay Greater than the Positive Pulse
369
Re-Directing Ocxref to Ocx or Ocxn
369
Using the Break Function
369
Figure 134. Various Output Behavior in Response to a Break Event on BKIN (OSSI = 1)
372
Figure 135. PWM Output State Following BKIN and BKIN2 Pins Assertion (OSSI=1)
373
Clearing the Ocxref Signal on an External Event
374
Figure 136. PWM Output State Following BKIN Assertion (OSSI=0)
374
Figure 137. Clearing Timx Ocxref
375
6-Step PWM Generation
376
Figure 138. 6-Step Generation, COM Example (OSSR=1)
376
One-Pulse Mode
377
Figure 139. Example of One Pulse Mode
377
Retriggerable One Pulse Mode
378
Encoder Interface Mode
379
Figure 140. Retriggerable One Pulse Mode
379
Figure 141. Example of Counter Operation in Encoder Interface Mode
380
UIF Bit Remapping
381
Figure 142. Example of Encoder Interface Mode with TI1FP1 Polarity Inverted
381
Timer Input XOR Function
382
Interfacing with Hall Sensors
382
Figure 143. Measuring Time Interval between Edges on 3 Signals
382
Figure 144. Example of Hall Sensor Interface
384
Timer Synchronization
385
Slave Mode: Reset Mode
385
Figure 145. Control Circuit in Reset Mode
385
Figure 146. Control Circuit in Gated Mode
386
Slave Mode: Trigger Mode
386
Figure 147. Control Circuit in Trigger Mode
387
Slave Mode: Combined Reset + Trigger Mode
387
Slave Mode: External Clock Mode 2 + Trigger Mode
387
Figure 148. Control Circuit in External Clock Mode 2 + Trigger Mode
388
ADC Synchronization
389
DMA Burst Mode
389
Debug Mode
390
TIM1 Registers
391
TIM1 Control Register 1 (TIM1_CR1)
391
TIM1 Control Register 2 (TIM1_CR2)
392
TIM1 Slave Mode Control Register
395
(Tim1_Smcr)
395
TIM1 Dma/Interrupt Enable Register
397
(Tim1_Dier)
397
TIM1 Status Register (TIM1_SR)
399
TIM1 Event Generation Register (TIM1_EGR)
401
TIM1 Capture/Compare Mode Register 1 (TIM1_CCMR1)
402
Input Capture Mode
402
TIM1 Capture/Compare Mode Register 1 [Alternate]
403
(Tim1_Ccmr1)
403
TIM1 Capture/Compare Mode Register 2 (TIM1_CCMR2)
406
TIM1 Capture/Compare Mode Register 2 [Alternate]
407
(Tim1_Ccmr2)
407
TIM1 Capture/Compare Enable Register
408
(Tim1_Ccer)
408
TIM1 Counter (TIM1_CNT)
412
TIM1 Prescaler (TIM1_PSC)
412
TIM1 Auto-Reload Register (TIM1_ARR)
412
TIM1 Repetition Counter Register (TIM1_RCR)
413
TIM1 Capture/Compare Register 1
413
(Tim1_Ccr1)
413
TIM1 Capture/Compare Register 2
414
(Tim1_Ccr2)
414
(Tim1_Ccr3)
414
TIM1 Capture/Compare Register 4
415
(Tim1_Ccr4)
415
TIM1 Break and Dead-Time Register
415
(Tim1_Bdtr)
415
TIM1 DMA Control Register
418
(Tim1_Dcr)
418
TIM1 DMA Address for Full Transfer
419
(Tim1_Dmar)
419
TIM1 Option Registers (TIM1_OR)
420
TIM1 Capture/Compare Mode Register 3
420
(Tim1_Ccmr3)
420
TIM1 Capture/Compare Register 5
421
(Tim1_Ccr5)
421
TIM1 Capture/Compare Register 6
422
(Tim1_Ccr6)
422
TIM1 Register Map
423
General-Purpose Timer (TIM2)
426
TIM2 Introduction
426
TIM2 Main Features
426
Figure 149. General-Purpose Timer Block Diagram
427
TIM2 Functional Description
428
Time-Base Unit
428
Prescaler Description
428
Figure 150. Counter Timing Diagram with Prescaler Division Change from 1 to 2
429
Figure 151. Counter Timing Diagram with Prescaler Division Change from 1 to 4
429
Counter Modes
430
Figure 152. Counter Timing Diagram, Internal Clock Divided by 1
430
Figure 153. Counter Timing Diagram, Internal Clock Divided by 2
431
Figure 154. Counter Timing Diagram, Internal Clock Divided by 4
431
Figure 155. Counter Timing Diagram, Internal Clock Divided by N
432
Figure 156. Counter Timing Diagram, Update Event When ARPE=0 (Timx_Arr Not Preloaded)
432
Figure 157. Counter Timing Diagram, Update Event When ARPE=1 (Timx_Arr Preloaded)
433
Figure 158. Counter Timing Diagram, Internal Clock Divided by 1
434
Figure 159. Counter Timing Diagram, Internal Clock Divided by 2
434
Figure 160. Counter Timing Diagram, Internal Clock Divided by 4
435
Figure 161. Counter Timing Diagram, Internal Clock Divided by N
435
Figure 162. Counter Timing Diagram, Update Event
436
Figure 163. Counter Timing Diagram, Internal Clock Divided by 1, Timx_Arr=0X6
437
Figure 164. Counter Timing Diagram, Internal Clock Divided by 2
438
Figure 165. Counter Timing Diagram, Internal Clock Divided by 4, Timx_Arr=0X36
438
Figure 166. Counter Timing Diagram, Internal Clock Divided by N
439
Figure 167. Counter Timing Diagram, Update Event with ARPE=1 (Counter Underflow)
439
Clock Selection
440
Figure 168. Counter Timing Diagram, Update Event with ARPE=1 (Counter Overflow)
440
Figure 169. Control Circuit in Normal Mode, Internal Clock Divided by 1
441
Figure 170. TI2 External Clock Connection Example
441
Figure 171. Control Circuit in External Clock Mode 1
442
Figure 172. External Trigger Input Block
443
Capture/Compare Channels
444
Figure 173. Control Circuit in External Clock Mode 2
444
Figure 174. Capture/Compare Channel (Example: Channel 1 Input Stage)
445
Figure 175. Capture/Compare Channel 1 Main Circuit
445
Input Capture Mode
446
Figure 176. Output Stage of Capture/Compare Channel (Channel 1)
446
PWM Input Mode
447
Forced Output Mode
448
Figure 177. PWM Input Mode Timing
448
Output Compare Mode
449
PWM Mode
450
Figure 178. Output Compare Mode, Toggle on OC1
450
PWM Edge-Aligned Mode
451
Figure 179. Edge-Aligned PWM Waveforms (ARR=8)
451
Downcounting Configuration
451
Figure 180. Center-Aligned PWM Waveforms (ARR=8)
452
Asymmetric PWM Mode
453
Figure 181. Generation of 2 Phase-Shifted PWM Signals with 50% Duty Cycle
453
Combined PWM Mode
454
Clearing the Ocxref Signal on an External Event
455
Figure 182. Combined PWM Mode on Channels 1 and 3
455
Figure 183. Clearing Timx Ocxref
456
One-Pulse Mode
457
Figure 184. Example of One-Pulse Mode
457
Particular Case: Ocx Fast Enable
458
18.3.14 Retriggerable One Pulse Mode
458
Encoder Interface Mode
459
Figure 185. Retriggerable One-Pulse Mode
459
Figure 186. Example of Counter Operation in Encoder Interface Mode
460
UIF Bit Remapping
461
Timer Input XOR Function
461
Figure 187. Example of Encoder Interface Mode with TI1FP1 Polarity Inverted
461
Timers and External Trigger Synchronization
462
Slave Mode: Reset Mode
462
Figure 188. Control Circuit in Reset Mode
462
Slave Mode: Gated Mode
462
Figure 189. Control Circuit in Gated Mode
463
Slave Mode: Trigger Mode
463
Figure 190. Control Circuit in Trigger Mode
464
Timer Synchronization
465
Figure 191. Control Circuit in External Clock Mode 2 + Trigger Mode
465
Figure 192. Master/Slave Timer Example
466
Figure 193. Master/Slave Connection Example with 1 Channel Only Timers
466
Using One Timer as Prescaler for Another Timer
466
Using One Timer to Enable Another Timer
467
Figure 194. Gating TIM2 with OC1REF of TIM1
467
Figure 195. Gating TIM2 with Enable of TIM1
468
Using One Timer to Start Another Timer
468
Figure 196. Triggering TIM2 with Update of TIM1
469
Figure 197. Triggering TIM2 with Enable of TIM1
469
DMA Burst Mode
470
Debug Mode
471
TIM2 Registers
472
TIM2 Control Register 1 (TIM2_CR1)
472
TIM2 Control Register 2 (TIM2_CR2)
473
TIM2 Slave Mode Control Register (TIM2_SMCR)
475
TIM2 Dma/Interrupt Enable Register (TIM2_DIER)
478
TIM2 Status Register (TIM2_SR)
479
TIM2 Event Generation Register (TIM2_EGR)
480
TIM2 Capture/Compare Mode Register 1 (TIM2_CCMR1)
481
TIM2 Capture/Compare Mode Register 1 [Alternate] (TIM2_CCMR1)
483
TIM2 Capture/Compare Mode Register 2 (TIM2_CCMR2)
485
TIM2 Capture/Compare Mode Register 2 [Alternate] (TIM2_CCMR2)
486
TIM2 Capture/Compare Enable Register
487
(Tim2_Ccer)
487
TIM2 Counter (TIM2_CNT)
488
TIM2 Counter [Alternate] (TIM2_CNT)
489
TIM2 Prescaler (TIM2_PSC)
489
TIM2 Auto-Reload Register (TIM2_ARR)
489
TIM2 Capture/Compare Register 1 (TIM2_CCR1)
490
TIM2 Capture/Compare Register 2 (TIM2_CCR2)
490
TIM2 Capture/Compare Register 3 (TIM2_CCR3)
491
TIM2 Capture/Compare Register 4 (TIM2_CCR4)
491
TIM2 DMA Control Register (TIM2_DCR)
492
TIM2 DMA Address for Full Transfer (TIM2_DMAR)
492
Timx Register Map
494
General-Purpose Timers (TIM15/TIM16/TIM17)
496
TIM15/TIM16/TIM17 Introduction
496
TIM15 Main Features
496
TIM16/TIM17 Main Features
497
Figure 198. TIM15 Block Diagram
498
Figure 199. TIM16/TIM17 Block Diagram
499
TIM15/TIM16/TIM17 Functional Description
500
Time-Base Unit
500
Figure 200. Counter Timing Diagram with Prescaler Division Change from 1 to 2
501
Figure 201. Counter Timing Diagram with Prescaler Division Change from 1 to 4
501
Counter Modes
502
Figure 202. Counter Timing Diagram, Internal Clock Divided by 1
503
Figure 203. Counter Timing Diagram, Internal Clock Divided by 2
503
Figure 204. Counter Timing Diagram, Internal Clock Divided by 4
504
Figure 205. Counter Timing Diagram, Internal Clock Divided by N
504
Repetition Counter
506
Clock Selection
507
Figure 208. Update Rate Examples Depending on Mode and Timx_Rcr Register Settings
507
Figure 209. Control Circuit in Normal Mode, Internal Clock Divided by 1
508
Figure 210. TI2 External Clock Connection Example
508
Capture/Compare Channels
509
Figure 211. Control Circuit in External Clock Mode 1
509
Figure 212. Capture/Compare Channel (Example: Channel 1 Input Stage)
510
Figure 213. Capture/Compare Channel 1 Main Circuit
510
Input Capture Mode
511
Figure 214. Output Stage of Capture/Compare Channel (Channel 1)
511
Figure 215. Output Stage of Capture/Compare Channel (Channel 2 for TIM15)
511
PWM Input Mode (Only for TIM15)
512
Forced Output Mode
513
Figure 216. PWM Input Mode Timing
513
Output Compare Mode
514
PWM Mode
515
Figure 217. Output Compare Mode, Toggle on OC1
515
Combined PWM Mode (TIM15 Only)
516
Figure 218. Edge-Aligned PWM Waveforms (ARR=8)
516
Complementary Outputs and Dead-Time Insertion
517
Figure 219. Combined PWM Mode on Channel 1 and 2
517
Figure 220. Complementary Output with Dead-Time Insertion
518
Figure 221. Dead-Time Waveforms with Delay Greater than the Negative Pulse
518
Using the Break Function
519
Figure 222. Dead-Time Waveforms with Delay Greater than the Positive Pulse
519
Figure 223. Output Behavior in Response to a Break
522
6-Step PWM Generation
523
Figure 224. 6-Step Generation, COM Example (OSSR=1)
523
One-Pulse Mode
524
Figure 225. Example of One Pulse Mode
524
Retriggerable One Pulse Mode (TIM15 Only)
525
UIF Bit Remapping
526
Figure 226. Retriggerable One Pulse Mode
526
Timer Input XOR Function (TIM15 Only)
527
Figure 227. Measuring Time Interval between Edges on 2 Signals
527
External Trigger Synchronization (TIM15 Only)
528
Figure 228. Control Circuit in Reset Mode
528
Figure 229. Control Circuit in Gated Mode
529
Slave Mode - Combined Reset + Trigger Mode (TIM15 Only)
530
DMA Burst Mode
530
Figure 230. Control Circuit in Trigger Mode
530
Timer Synchronization (TIM15)
532
Using Timer Output as Trigger for Other Timers (TIM16/TIM17)
532
Debug Mode
532
TIM15 Registers
533
TIM15 Control Register 1 (TIM15_CR1)
533
TIM15 Control Register 2 (TIM15_CR2)
534
TIM15 Slave Mode Control Register (TIM15_SMCR)
536
TIM15 Dma/Interrupt Enable Register (TIM15_DIER)
537
TIM15 Status Register (TIM15_SR)
538
TIM15 Event Generation Register (TIM15_EGR)
540
TIM15 Capture/Compare Mode Register 1 (TIM15_CCMR1)
541
Input Capture Mode
541
TIM15 Capture/Compare Mode Register 1 [Alternate]
542
(Tim15_Ccmr1)
542
TIM15 Capture/Compare Enable Register (TIM15_CCER)
545
TIM15 Counter (TIM15_CNT)
548
TIM15 Prescaler (TIM15_PSC)
548
TIM15 Auto-Reload Register (TIM15_ARR)
548
TIM15 Repetition Counter Register (TIM15_RCR)
549
TIM15 Capture/Compare Register 1 (TIM15_CCR1)
549
TIM15 Capture/Compare Register 2 (TIM15_CCR2)
550
TIM15 Break and Dead-Time Register (TIM15_BDTR)
550
TIM15 DMA Control Register (TIM15_DCR)
552
TIM15 DMA Address for Full Transfer (TIM15_DMAR)
553
TIM15 Register Map
553
TIM16/TIM17 Registers
556
Timx Control Register 1 (Timx_Cr1)(X = 16 to 17)
556
Timx Control Register 2 (Timx_Cr2)(X = 16 to 17)
557
Timx Dma/Interrupt Enable Register (Timx_Dier)(X = 16 to 17)
558
Timx Status Register (Timx_Sr)(X = 16 to 17)
559
Timx Event Generation Register (Timx_Egr)(X = 16 to 17)
560
Timx Capture/Compare Mode Register 1
561
(Timx_Ccmr1)(X = 16 to 17)
561
Timx Capture/Compare Mode Register 1 [Alternate] (Timx_Ccmr1)(X = 16 to 17)
562
Timx Capture/Compare Enable Register (Timx_Ccer)(X = 16 to 17)
564
Timx Counter (Timx_Cnt)(X = 16 to 17)
566
Timx Prescaler (Timx_Psc)(X = 16 to 17)
567
Timx Auto-Reload Register (Timx_Arr)(X = 16 to 17)
567
Timx Repetition Counter Register (Timx_Rcr)(X = 16 to 17)
568
Timx Capture/Compare Register 1 (Timx_Ccr1)(X = 16 to 17)
568
Timx Break and Dead-Time Register (Timx_Bdtr)(X = 16 to 17)
569
Timx DMA Control Register (Timx_Dcr)(X = 16 to 17)
571
Timx DMA Address for Full Transfer (Timx_Dmar)(X = 16 to 17)
571
TIM16 Option Register (TIM16_OR)
572
TIM16/TIM17 Register Map
573
Basic Timers (TIM6)
575
TIM6 Introduction
575
TIM6 Main Features
575
Figure 231. Basic Timer Block Diagram
575
TIM6 Functional Description
576
Time-Base Unit
576
Prescaler Description
576
Figure 232. Counter Timing Diagram with Prescaler Division Change from 1 to 2
577
Figure 233. Counter Timing Diagram with Prescaler Division Change from 1 to 4
577
Counting Mode
578
Figure 234. Counter Timing Diagram, Internal Clock Divided by 1
578
Figure 235. Counter Timing Diagram, Internal Clock Divided by 2
579
Figure 236. Counter Timing Diagram, Internal Clock Divided by 4
579
Figure 237. Counter Timing Diagram, Internal Clock Divided by N
580
UIF Bit Remapping
581
Clock Source
581
Debug Mode
582
TIM6 Registers
582
TIM6 Control Register 1 (TIM6_CR1)
582
Figure 240. Control Circuit in Normal Mode, Internal Clock Divided by 1
582
TIM6 Control Register 2 (TIM6_CR2)
584
TIM6 Dma/Interrupt Enable Register (TIM6_DIER)
584
TIM6 Status Register (TIM6_SR)
585
TIM6 Event Generation Register (TIM6_EGR)
585
TIM6 Counter (TIM6_CNT)
585
TIM6 Prescaler (TIM6_PSC)
586
TIM6 Auto-Reload Register (TIM6_ARR)
586
TIM6 Register Map
587
Infrared Interface (IRTIM)
588
Figure 241. IRTIM Internal Hardware Connections with TIM16 and TIM17
588
System Window Watchdog (WWDG)
589
Introduction
589
WWDG Main Features
589
WWDG Functional Description
589
WWDG Block Diagram
590
Enabling the Watchdog
590
Controlling the Down-Counter
590
How to Program the Watchdog Timeout
590
Figure 242. Watchdog Block Diagram
590
Figure 243. Window Watchdog Timing Diagram
591
Debug Mode
592
WWDG Interrupts
592
WWDG Registers
592
WWDG Control Register (WWDG_CR)
592
WWDG Configuration Register (WWDG_CFR)
593
WWDG Status Register (WWDG_SR)
593
WWDG Register Map
594
Independent Watchdog (IWDG)
595
Introduction
595
IWDG Main Features
595
IWDG Functional Description
595
IWDG Block Diagram
595
Figure 244. Independent Watchdog Block Diagram
595
Window Option
596
Configuring the IWDG When the Window Option Is Enabled
596
Configuring the IWDG When the Window Option Is Disabled
596
Hardware Watchdog
597
Register Access Protection
597
Debug Mode
597
IWDG Registers
598
IWDG Key Register (IWDG_KR)
598
IWDG Prescaler Register (IWDG_PR)
599
IWDG Reload Register (IWDG_RLR)
600
IWDG Status Register (IWDG_SR)
601
IWDG Window Register (IWDG_WINR)
602
IWDG Register Map
603
Real-Time Clock (RTC)
604
Introduction
604
RTC Main Features
605
RTC Functional Description
606
RTC Block Diagram
606
Figure 245. RTC Block Diagram
606
Gpios Controlled by the RTC
607
Clock and Prescalers
609
Real-Time Clock and Calendar
609
Programmable Alarms
610
Periodic Auto-Wake-Up
610
RTC Initialization and Configuration
611
Reading the Calendar
612
Resetting the RTC
613
RTC Synchronization
614
RTC Reference Clock Detection
614
RTC Smooth Digital Calibration
615
Verifying the RTC Calibration
616
Re-Calibration On-The-Fly
617
Time-Stamp Function
617
Tamper Detection
618
RTC Backup Registers
618
Tamper Detection Initialization
618
Calibration Clock Output
619
Alarm Output
620
RTC Low-Power Modes
620
RTC Interrupts
620
RTC Registers
621
RTC Time Register (RTC_TR)
621
Real Time Clock (Rtc)
622
RTC Date Register (RTC_DR)
622
RTC Control Register (RTC_CR)
624
RTC Initialization and Status Register (RTC_ISR)
627
RTC Prescaler Register (RTC_PRER)
630
RTC Wake-Up Timer Register (RTC_WUTR)
631
RTC Alarm a Register (RTC_ALRMAR)
632
RTC Alarm B Register (RTC_ALRMBR)
633
RTC Write Protection Register (RTC_WPR)
634
RTC Sub Second Register (RTC_SSR)
634
RTC Shift Control Register (RTC_SHIFTR)
635
RTC Timestamp Time Register (RTC_TSTR)
636
RTC Timestamp Date Register (RTC_TSDR)
637
RTC Time-Stamp Sub Second Register (RTC_TSSSR)
638
RTC Calibration Register (RTC_CALR)
639
RTC Tamper and Alternate Function Configuration Register
640
(Rtc_Tafcr)
640
RTC Alarm a Sub Second Register (RTC_ALRMASSR)
643
RTC Alarm B Sub Second Register (RTC_ALRMBSSR)
644
RTC Backup Registers (Rtc_Bkpxr)
645
RTC Register Map
645
Inter-Integrated Circuit Interface (I2C)
648
Introduction
648
I2C Main Features
648
I2C Implementation
649
I2C Functional Description
649
I2C Block Diagram
650
I2C Pins and Internal Signals
650
Figure 246. Block Diagram
650
I2C Clock Requirements
651
I2C Mode Selection
651
Communication Flow
651
I2C Initialization
652
Noise Filters
652
Figure 247. I²C-Bus Protocol
652
Figure 248. Setup and Hold Timings
654
I2C Reset
656
Figure 249. I2C Initialization Flow
656
I2C Data Transfer
657
Figure 250. Data Reception
657
Figure 251. Data Transmission
658
Hardware Transfer Management
658
I2C Target Mode
659
Figure 252. Target Initialization Flow
661
Figure 253. Transfer Sequence Flow for I2C Target Transmitter, NOSTRETCH = 0
663
Figure 254. Transfer Sequence Flow for I2C Target Transmitter, NOSTRETCH = 1
664
Figure 255. Transfer Bus Diagrams for I2C Target Transmitter (Mandatory Events Only)
665
Figure 256. Transfer Sequence Flow for I2C Target Receiver, NOSTRETCH = 0
666
Figure 257. Transfer Sequence Flow for I2C Target Receiver, NOSTRETCH = 1
667
Figure 258. Transfer Bus Diagrams for I2C Target Receiver
667
I2C Controller Mode
668
Figure 259. Controller Clock Generation
669
Figure 260. Controller Initialization Flow
671
Figure 261. 10-Bit Address Read Access with HEAD10R = 0
671
Figure 262. 10-Bit Address Read Access with HEAD10R = 1
672
Figure 263. Transfer Sequence Flow for I2C Controller Transmitter, N ≤ 255 Bytes
673
Figure 264. Transfer Sequence Flow for I2C Controller Transmitter, N > 255 Bytes
674
Figure 265. Transfer Bus Diagrams for I2C Controller Transmitter
675
Figure 266. Transfer Sequence Flow for I2C Controller Receiver, N ≤ 255 Bytes
677
Figure 267. Transfer Sequence Flow for I2C Controller Receiver, N > 255 Bytes
678
I2C_TIMINGR Register Configuration Examples
679
Figure 268. Transfer Bus Diagrams for I2C Controller Receiver
679
Smbus Specific Features
681
Bus Protocols
681
Figure 269. Timeout Intervals for T
683
Bus Idle Detection
684
Smbus Initialization
684
Timeout Detection
685
Smbus I2C_TIMEOUTR Register Configuration Examples
686
Smbus Target Mode
686
Figure 270. Transfer Sequence Flow for Smbus Target Transmitter N Bytes + PEC
687
Figure 271. Transfer Bus Diagram for Smbus Target Transmitter (SBC = 1)
687
Figure 272. Transfer Sequence Flow for Smbus Target Receiver N Bytes + PEC
689
Smbus Controller Mode
690
Figure 273. Bus Transfer Diagrams for Smbus Target Receiver (SBC = 1)
690
Figure 274. Bus Transfer Diagrams for Smbus Controller Transmitter
691
Wake-Up from Stop Mode on Address Match
693
Figure 275. Bus Transfer Diagrams for Smbus Controller Receiver
693
Error Conditions
694
Bus Error (BERR)
694
Overrun/Underrun Error (OVR)
695
Packet Error Checking Error (PECERR)
695
Timeout Error (TIMEOUT)
695
I2C in Low-Power Modes
696
I2C Interrupts
696
Table 97. I2C Interrupt Requests
696
I2C DMA Requests
697
Transmission Using DMA
697
Reception Using DMA
697
I2C Debug Modes
697
I2C Registers
698
I2C Control Register 1 (I2C_CR1)
698
I2C Control Register 2 (I2C_CR2)
700
I2C Own Address 1 Register (I2C_OAR1)
702
I2C Own Address 2 Register (I2C_OAR2)
703
I2C Timing Register (I2C_TIMINGR)
704
I2C Timeout Register (I2C_TIMEOUTR)
705
I2C Interrupt and Status Register (I2C_ISR)
706
I2C Interrupt Clear Register (I2C_ICR)
708
I2C PEC Register (I2C_PECR)
709
I2C Receive Data Register (I2C_RXDR)
709
I2C Transmit Data Register (I2C_TXDR)
710
I2C Register Map
711
Table 98. I2C Register Map and Reset Values
711
Universal Synchronous/Asynchronous Receiver
712
Transmitter (USART/UART)
712
Introduction
712
USART Main Features
712
USART Extended Features
713
USART Implementation
714
USART Functional Description
714
Table 99. Stm32F3Xx USART Features
714
Figure 276. USART Block Diagram
716
USART Character Description
717
Figure 277. Word Length Programming
718
USART Transmitter
719
Character Transmission
719
Figure 278. Configurable Stop Bits
720
Single Byte Communication
720
Figure 279. TC/TXE Behavior When Transmitting
721
Break Characters
721
Idle Characters
721
USART Receiver
721
Figure 280. Start Bit Detection When Oversampling by 16 or 8
722
Character Reception
723
Break Character
723
Idle Character
723
Overrun Error
724
Selecting the Clock Source and the Proper Oversampling Method
724
Table 100. Noise Detection from Sampled Data
726
Figure 281. Data Sampling When Oversampling by 16
726
Figure 282. Data Sampling When Oversampling by 8
726
Framing Error
727
Configurable Stop Bits During Reception
727
USART Baud Rate Generation
728
Table 101. Error Calculation for Programmed Baud Rates at F
729
Tolerance of the USART Receiver to Clock Deviation
730
USART Auto Baud Rate Detection
731
Table 102. Tolerance of the USART Receiver When BRR [3:0] = 0000
731
Table 103. Tolerance of the USART Receiver When BRR [3:0] Is Different from 0000
731
Multiprocessor Communication Using USART
732
Figure 283. Mute Mode Using Idle Line Detection
733
Modbus Communication Using USART
734
Figure 284. Mute Mode Using Address Mark Detection
734
USART Parity Control
735
Table 104. Frame Formats
735
USART LIN (Local Interconnection Network) Mode
736
Figure 285. Break Detection in LIN Mode (11-Bit Break Length - LBDL Bit Is Set)
737
USART Synchronous Mode
738
Figure 286. Break Detection in LIN Mode Vs. Framing Error Detection
738
Figure 287. USART Example of Synchronous Transmission
739
Figure 288. USART Data Clock Timing Diagram (M Bits = 00)
739
Figure 289. USART Data Clock Timing Diagram (M Bits = 01)
740
Figure 290. RX Data Setup/Hold Time
740
USART Single-Wire Half-Duplex Communication
741
USART Smartcard Mode
741
Figure 291. ISO 7816-3 Asynchronous Protocol
742
Figure 292. Parity Error Detection Using the 1.5 Stop Bits
743
Block Mode (T=1)
744
Direct and Inverse Convention
745
USART Irda SIR ENDEC Block
746
Figure 293. Irda SIR ENDEC- Block Diagram
747
Figure 294. Irda Data Modulation (3/16) - Normal Mode
747
USART Continuous Communication in DMA Mode
748
Transmission Using DMA
748
Figure 295. Transmission Using DMA
749
Figure 296. Reception Using DMA
750
Error Flagging and Interrupt Generation in Multibuffer Communication
750
RS232 Hardware Flow Control and RS485 Driver Enable
750
Using USART
750
Figure 297. Hardware Flow Control between 2 Usarts
750
Figure 298. RS232 RTS Flow Control
751
Figure 299. RS232 CTS Flow Control
752
RS485 Driver Enable
752
Wake-Up from Stop Mode Using USART
752
USART in Low-Power Modes
754
USART Interrupts
754
Table 105. Effect of Low-Power Modes on the USART
754
Table 106. USART Interrupt Requests
754
Figure 300. USART Interrupt Mapping Diagram
755
USART Registers
756
USART Control Register 1 (USART_CR1)
756
USART Control Register 2 (USART_CR2)
759
USART Control Register 3 (USART_CR3)
763
USART Baud Rate Register (USART_BRR)
767
USART Guard Time and Prescaler Register (USART_GTPR)
767
USART Receiver Timeout Register (USART_RTOR)
768
USART Request Register (USART_RQR)
769
USART Interrupt and Status Register (USART_ISR)
770
USART Interrupt Flag Clear Register (USART_ICR)
775
USART Receive Data Register (USART_RDR)
777
USART Transmit Data Register (USART_TDR)
777
USART Register Map
778
Table 107. USART Register Map and Reset Values
778
Serial Peripheral Interface / Integrated Interchip Sound (SPI/I2S)
780
Introduction
780
SPI Main Features
780
I2S Main Features
781
SPI/I2S Implementation
781
Table 108. Stm32F301X6/8 and Stm32F318X8 SPI/I2S Implementation
781
SPI Functional Description
782
General Description
782
Figure 301. SPI Block Diagram
782
Communications between One Master and One Slave
783
Full-Duplex Communication
783
Figure 302. Full-Duplex Single Master/ Single Slave Application
783
Half-Duplex Communication
783
Figure 303. Half-Duplex Single Master/ Single Slave Application
784
Simplex Communications
784
Standard Multislave Communication
785
Figure 304. Simplex Single Master/Single Slave Application
785
Multimaster Communication
786
Figure 305. Master and Three Independent Slaves
786
Slave Select (NSS) Pin Management
787
Figure 306. Multimaster Application
787
Figure 307. Hardware/Software Slave Select Management
788
Communication Formats
788
Clock Phase and Polarity Controls
788
Data Frame Format
789
Figure 308. Data Clock Timing Diagram
789
Configuration of SPI
790
Figure 309. Data Alignment When Data Length Is Not Equal to 8-Bit or 16-Bit
790
Procedure for Enabling SPI
791
Data Transmission and Reception Procedures
791
RXFIFO and TXFIFO
791
Sequence Handling
792
Procedure for Disabling the SPI
792
Data Packing
793
Figure 310. Packing Data in FIFO for Transmission and Reception
794
Communication Using DMA (Direct Memory Addressing)
794
Packing with DMA
795
Communication Diagrams
796
Figure 311. Master Full-Duplex Communication
797
Figure 312. Slave Full-Duplex Communication
798
Figure 313. Master Full-Duplex Communication with CRC
799
Figure 314. Master Full-Duplex Communication in Packed Mode
800
SPI Status Flags
801
SPI Error Flags
802
NSS Pulse Mode
803
TI Mode
803
Figure 315. NSSP Pulse Generation in Motorola SPI Master Mode
803
Figure 316. TI Mode Transfer
804
CRC Calculation
804
CRC Principle
804
CRC Transfer Managed by CPU
805
CRC Transfer Managed by DMA
805
SPI Interrupts
806
Table 109. SPI Interrupt Requests
806
I2S Functional Description
807
I2S General Description
807
Figure 317. I2S Block Diagram
807
I2S Full Duplex
808
Figure 318. I2S Full-Duplex Block Diagram
808
Supported Audio Protocols
809
Figure 319. I 2 S Philips Protocol Waveforms (16/32-Bit Full Accuracy)
810
Figure 320. I 2 S Philips Standard Waveforms (24-Bit Frame)
810
Figure 321. Transmitting 0X8Eaa33
810
Figure 322. Receiving 0X8Eaa33
811
Figure 323. I
811
Figure 324. Example of 16-Bit Data Frame Extended to 32-Bit Channel Frame
811
Figure 325. MSB Justified 16-Bit or 32-Bit Full-Accuracy Length
812
Figure 326. MSB Justified 24-Bit Frame Length
812
Figure 327. MSB Justified 16-Bit Extended to 32-Bit Packet Frame
812
Figure 328. LSB Justified 16-Bit or 32-Bit Full-Accuracy
813
Figure 329. LSB Justified 24-Bit Frame Length
813
Figure 330. Operations Required to Transmit 0X3478Ae
813
Figure 331. Operations Required to Receive 0X3478Ae
814
Figure 332. LSB Justified 16-Bit Extended to 32-Bit Packet Frame
814
Figure 333. Example of 16-Bit Data Frame Extended to 32-Bit Channel Frame
814
Start-Up Description
815
Figure 334. PCM Standard Waveforms (16-Bit)
815
Figure 335. PCM Standard Waveforms (16-Bit Extended to 32-Bit Packet Frame)
815
Figure 336. Start Sequence in Master Mode
816
Clock Generator
817
Figure 337. Audio Sampling Frequency Definition
817
Figure 338. I
817
I 2 S Master Mode
819
Table 110. Audio-Frequency Precision Using Standard 8 Mhz HSE
819
I 2 S Slave Mode
821
Transmission Sequence
822
I2S Status Flags
823
I2S Error Flags
824
DMA Features
825
I2S Interrupts
825
Table 111. I2S Interrupt Requests
825
SPI and I2S Registers
826
SPI Control Register 1 (Spix_Cr1)
826
SPI Control Register 2 (Spix_Cr2)
828
SPI Status Register (Spix_Sr)
830
SPI Data Register (Spix_Dr)
832
SPI CRC Polynomial Register (Spix_Crcpr)
832
SPI Rx CRC Register (Spix_Rxcrcr)
832
SPI Tx CRC Register (Spix_Txcrcr)
833
Spix_I2S Configuration Register (Spix_I2Scfgr)
833
Spix_I2S Prescaler Register (Spix_I2Spr)
835
SPI/I2S Register Map
836
Table 112. SPI/I2S Register Map and Reset Values
836
Debug Support (DBG)
837
Overview
837
Figure 339. Block Diagram of STM32 MCU and Cortex
837
Reference Arm Documentation
838
SWJ Debug Port (Serial Wire and JTAG)
838
Mechanism to Select the JTAG-DP or the SW-DP
839
Pinout and Debug Port Pins
839
Figure 340. SWJ Debug Port
839
SWJ Debug Port Pins
840
Flexible SWJ-DP Pin Assignment
840
Internal Pull-Up and Pull-Down on JTAG Pins
840
Table 113. SWJ Debug Port Pins
840
Table 114. Flexible SWJ-DP Pin Assignment
840
Using Serial Wire and Releasing the Unused Debug Pins as Gpios
842
Stm32F3Xx JTAG TAP Connection
842
ID Codes and Locking Mechanism
843
MCU Device ID Code
843
Figure 341. JTAG TAP Connections
843
Boundary Scan TAP
844
M4F Tap
844
Cortex ® -M4F JEDEC-106 ID Code
844
JTAG Debug Port
844
Table 115. JTAG Debug Port Data Registers
844
Table 116. 32-Bit Debug Port Registers Addressed
845
SW Debug Port
846
SW Protocol Introduction
846
SW Protocol Sequence
846
Table 117. Packet Request (8-Bits)
846
SW-DP State Machine (Reset, Idle States, ID Code)
847
Table 118. ACK Response (3 Bits)
847
Table 119. DATA Transfer (33 Bits)
847
DP and AP Read/Write Accesses
848
SW-DP Registers
848
Table 120. SW-DP Registers
848
SW-AP Registers
849
AHB-AP (AHB Access Port) - Valid for both JTAG-DP and SW-DP
849
Core Debug
850
Table 121. Cortex
850
Table 122. Core Debug Registers
850
Capability of the Debugger Host to Connect under System Reset
851
FPB (Flash Patch Breakpoint)
851
DWT (Data Watchpoint Trigger)
851
ITM (Instrumentation Trace Macrocell)
852
General Description
852
Time Stamp Packets, Synchronization, and Overflow Packets
852
Table 123. Main ITM Registers
853
Arm® Arm® MCU Debug Component (DBGMCU)
854
Debug Support for Low-Power Modes
854
854
854
Debug Support for Timers, Watchdog I
854
Debug MCU Configuration Register
854
Debug MCU APB1 Freeze Register (DBGMCU_APB1_FZ)
856
Debug MCU APB2 Freeze Register (DBGMCU_APB2_FZ)
857
TPUI TRACE Pin Assignment
858
Table 124. Asynchronous TRACE Pin Assignment
858
Figure 342. TPIU Block Diagram
858
TPUI Formatter
859
Table 125. Flexible TRACE Pin Assignment
859
TPUI Frame Synchronization Packets
860
Transmission of the Synchronization Frame Packet
860
28.15.10 Synchronous Mode
860
28.15.11 Asynchronous Mode
860
28.15.12 TRACECLKIN Connection Inside the Stm32F3Xx
861
28.15.13 TPIU Registers
862
Table 126. Important TPIU Registers
862
28.15.14 Example of Configuration
863
DBG Register Map
863
Table 127. DBG Register Map and Reset Values
863
Device Electronic Signature
864
Unique Device ID Register (96 Bits)
864
Flash Memory Size Data Register
865
Important Security Notice
866
Revision History
867
Table 128. Document Revision History
867
Advertisement
Advertisement
Related Products
ST STM32F31xx
ST STM32F30xx
ST STM32F301 6 Series
ST STM32F318 8 Series
st STM32F429I-DISCO
ST STM32F06
ST STM32F413ZGT6
ST STM32F207VG
ST STM32F43 Series
ST STM32F74 Series
ST Categories
Motherboard
Computer Hardware
Microcontrollers
Control Unit
Controller
More ST Manuals
Login
Sign In
OR
Sign in with Facebook
Sign in with Google
Upload manual
Upload from disk
Upload from URL