Stm32l4 Manual
Stm32l4 Manual
Reference manual
STM32L4+ Series advanced Arm®-based
32-bit MCUs
Introduction
This reference manual targets application developers. It provides complete information on
how to use the STM32L4+ Series microcontrollers memory and peripherals.
The STM32L4+ Series are families of microcontrollers with different memory sizes,
packages and peripherals.
For ordering information, mechanical and electrical device characteristics, refer to the
corresponding datasheets.
For information on the Arm® Cortex®-M4 core, refer to the Cortex®-M4 Technical Reference
Manual.
Related documents
• Cortex®-M4 Technical Reference Manual, available from: http://infocenter.arm.com
• STM32L4S5xx STM32L4S7xx STM32L4S9xx datasheet
• STM32L4R5xx STM32L4R7xx STM32L4R9xx datasheet
• STM32L4Q5xx datasheet
• STM32L4P5xx datasheet
• STM32F3, STM32F4, STM32L4 and STM32L4+ Series Cortex®-M4 (PM0214)
Contents
1 Documentation conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
1.1 General information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
1.2 List of abbreviations for registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
1.3 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
1.4 Availability of peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
51.4.13 RS232 Hardware flow control and RS485 Driver Enable . . . . . . . . . 1827
51.4.14 LPUART low-power management . . . . . . . . . . . . . . . . . . . . . . . . . . . 1829
51.5 LPUART interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1832
51.6 LPUART registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1834
51.6.1 LPUART control register 1 [alternate] (LPUART_CR1) . . . . . . . . . . . 1834
51.6.2 LPUART control register 1 [alternate] (LPUART_CR1) . . . . . . . . . . . 1837
51.6.3 LPUART control register 2 (LPUART_CR2) . . . . . . . . . . . . . . . . . . . 1840
51.6.4 LPUART control register 3 (LPUART_CR3) . . . . . . . . . . . . . . . . . . . 1842
51.6.5 LPUART baud rate register (LPUART_BRR) . . . . . . . . . . . . . . . . . . 1845
51.6.6 LPUART request register (LPUART_RQR) . . . . . . . . . . . . . . . . . . . . 1846
51.6.7 LPUART interrupt and status register [alternate] (LPUART_ISR) . . . 1846
51.6.8 LPUART interrupt and status register [alternate] (LPUART_ISR) . . . 1851
51.6.9 LPUART interrupt flag clear register (LPUART_ICR) . . . . . . . . . . . . 1854
51.6.10 LPUART receive data register (LPUART_RDR) . . . . . . . . . . . . . . . . 1855
51.6.11 LPUART transmit data register (LPUART_TDR) . . . . . . . . . . . . . . . . 1855
51.6.12 LPUART prescaler register (LPUART_PRESC) . . . . . . . . . . . . . . . . 1856
51.6.13 LPUART register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1857
List of tables
Table 1. STM32L4Rxxx and STM32L4Sxxx memory map and peripheral register boundary
addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Table 2. STM32L4P5xx and STM32L4Q5xx memory map and peripheral register boundary
addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Table 3. SRAM2 organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Table 4. Boot modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Table 5. Memory mapping versus boot mode/physical remap . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Table 6. Flash module - 2 Mbytes dual-bank organization
(64 bits read width) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Table 7. Flash module - 2 Mbytes single-bank organization
(128 bits read width) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Table 8. Flash module - 1 Mbyte dual-bank organization
(64 bits read width) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Table 9. Flash module - 1 Mbyte single-bank organization
(128 bits read width) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Table 10. Flash module - 512 Kbytes dual-bank organization
(64 bits read width) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Table 11. Flash module - 512 Kbytes single-bank organization
(128 bits read width) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Table 12. Number of wait states according to CPU clock (HCLK) frequency . . . . . . . . . . . . . . . . . . 122
Table 13. Option byte format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Table 14. Option byte organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Table 15. Flash memory read protection status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Table 16. Access status versus protection level and execution modes . . . . . . . . . . . . . . . . . . . . . . 145
Table 17. PCROP protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Table 18. WRP protection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Table 19. Flash interrupt request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Table 20. Flash interface - register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Table 21. Segment accesses according to the Firewall state. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Table 22. Segment granularity and area ranges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Table 23. Firewall register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Table 24. Range 1 boost mode configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Table 25. PVM features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Table 26. Low-power mode summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Table 27. Functionalities depending on the working mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
Table 28. Low-power run . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Table 29. Sleep. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
Table 30. Low-power sleep. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Table 31. Stop 0 mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Table 32. Stop 1 mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Table 33. Stop 2 mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Table 34. Standby mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Table 35. Shutdown mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Table 36. PWR register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Table 37. Clock source frequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Table 38. RCC register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
Table 39. CRS features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
Table 40. Effect of low-power modes on CRS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
Table 188. Filter maximum output resolution (peak data values from filter output)
for some FOSR values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 850
Table 189. Integrator maximum output resolution (peak data values from integrator
output) for some IOSR values and FOSR = 256 and Sinc3 filter type (largest data) . . . . 851
Table 190. DFSDM interrupt requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 859
Table 191. DFSDM register map and reset values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 880
Table 192. LTDC implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 890
Table 193. LTDC pins and signal interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 891
Table 194. Clock domain for each register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 892
Table 195. Pixel data mapping versus color format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 897
Table 196. LTDC interrupt requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 901
Table 197. LTDC register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 921
Table 198. Location of color components in the LTDC interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . 929
Table 199. Multiplicity of the payload size in pixels for each data type . . . . . . . . . . . . . . . . . . . . . . . 930
Table 200. Contention detection timeout counters configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 942
Table 201. List of events of different categories of the PRESP_TO counter . . . . . . . . . . . . . . . . . . . 943
Table 202. PRESP_TO counter configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 946
Table 203. Frame requirement configuration registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 958
Table 204. RGB components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 960
Table 205. Slew-rate and delay tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 962
Table 206. Custom lane configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 963
Table 207. Custom timing parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 963
Table 208. DSI wrapper interrupt requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 967
Table 209. Error causes and recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 968
Table 210. DSIHOST register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1040
Table 211. Acquisition sequence summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1048
Table 212. Spread spectrum deviation versus AHB clock frequency . . . . . . . . . . . . . . . . . . . . . . . . 1050
Table 213. I/O state depending on its mode and IODEF bit value . . . . . . . . . . . . . . . . . . . . . . . . . . 1051
Table 214. Effect of low-power modes on TSC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1053
Table 215. Interrupt control bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1053
Table 216. TSC register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1062
Table 217. RNG internal input/output signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1065
Table 218. RNG interrupt requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1072
Table 219. RNG configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1073
Table 220. RNG register map and reset map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1077
Table 221. RNG internal input/output signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1079
Table 222. RNG interrupt requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1087
Table 223. RNG configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1088
Table 224. RNG register map and reset map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1093
Table 225. AES internal input/output signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1095
Table 226. CTR mode initialization vector definition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1112
Table 227. GCM last block definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1114
Table 228. GCM mode IVI bitfield initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1115
Table 229. Initialization of AES_IVRx registers in CCM mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1123
Table 230. Key endianness in AES_KEYRx registers (128- or 256-bit key length) . . . . . . . . . . . . . 1128
Table 231. AES interrupt requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1131
Table 232. Processing latency for ECB, CBC and CTR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1131
Table 233. Processing latency for GCM and CCM (in clock cycles). . . . . . . . . . . . . . . . . . . . . . . . . 1131
Table 234. AES register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1142
Table 235. HASH internal input/output signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1146
Table 236. Hash processor outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1149
Table 237. HASH interrupt requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1156
List of figures
Figure 146. Alternate trigger: 4 injected channels (each ADC) in discontinuous mode . . . . . . . . . . . . 679
Figure 147. Alternate + regular simultaneous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680
Figure 148. Case of trigger occurring during injected conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680
Figure 149. Interleaved single channel CH0 with injected sequence CH11, CH12 . . . . . . . . . . . . . . . 681
Figure 150. Two Interleaved channels (CH1, CH2) with injected sequence CH11, CH12
- case 1: Master interrupted first . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681
Figure 151. Two Interleaved channels (CH1, CH2) with injected sequence CH11, CH12
- case 2: Slave interrupted first . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681
Figure 152. DMA Requests in regular simultaneous mode when MDMA=0b00 . . . . . . . . . . . . . . . . . 682
Figure 153. DMA requests in regular simultaneous mode when MDMA=0b10 . . . . . . . . . . . . . . . . . . 683
Figure 154. DMA requests in interleaved mode when MDMA=0b10 . . . . . . . . . . . . . . . . . . . . . . . . . . 683
Figure 155. Temperature sensor channel block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685
Figure 156. VBAT channel block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 686
Figure 157. VREFINT channel block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687
Figure 158. Dual-channel DAC block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727
Figure 159. Data registers in single DAC channel mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729
Figure 160. Data registers in dual DAC channel mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729
Figure 161. Timing diagram for conversion with trigger disabled TEN = 0 . . . . . . . . . . . . . . . . . . . . . 730
Figure 162. DAC LFSR register calculation algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733
Figure 163. DAC conversion (SW trigger enabled) with LFSR wave generation . . . . . . . . . . . . . . . . 733
Figure 164. DAC triangle wave generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734
Figure 165. DAC conversion (SW trigger enabled) with triangle wave generation . . . . . . . . . . . . . . . 734
Figure 166. DAC Sample and hold mode phase diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737
Figure 167. DCMI block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 767
Figure 168. Top-level block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 767
Figure 169. DCMI signal waveforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 768
Figure 170. Timing diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 770
Figure 171. Frame capture waveforms in snapshot mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 772
Figure 172. Frame capture waveforms in continuous grab mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773
Figure 173. Coordinates and size of the window after cropping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 773
Figure 174. Data capture waveforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 774
Figure 175. Pixel raster scan order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 775
Figure 176. PSSI block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791
Figure 177. Top-level block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791
Figure 178. Data enable in receive mode waveform diagram (CKPOL=0) . . . . . . . . . . . . . . . . . . . . . 795
Figure 179. Data enable waveform diagram in transmit mode (CKPOL=0). . . . . . . . . . . . . . . . . . . . . 795
Figure 180. Ready in receive mode waveform diagram (CKPOL=0). . . . . . . . . . . . . . . . . . . . . . . . . . 796
Figure 181. Bidirectional PSSI_DE/PSSI_RDY waveform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 797
Figure 182. Bidirectional PSSI_DE/PSSI_RDY connection diagram . . . . . . . . . . . . . . . . . . . . . . . . . 797
Figure 183. Comparator block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 806
Figure 184. Window mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 808
Figure 185. Comparator hysteresis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 809
Figure 186. Comparator output blanking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 809
Figure 187. Standalone mode: external gain setting mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 819
Figure 188. Follower configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 820
Figure 189. PGA mode, internal gain setting (x2/x4/x8/x16), inverting input not used . . . . . . . . . . . . 821
Figure 190. PGA mode, internal gain setting (x2/x4/x8/x16), inverting input used for
filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 822
Figure 191. Single DFSDM block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 833
Figure 192. Input channel pins redirection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837
Figure 193. Channel transceiver timing diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 840
Figure 194. Clock absence timing diagram for SPI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 841
Figure 195. Clock absence timing diagram for Manchester coding . . . . . . . . . . . . . . . . . . . . . . . . . . . 842
Figure 196. First conversion for Manchester coding (Manchester synchronization) . . . . . . . . . . . . . . 844
Figure 197. DFSDM_CHyDATINR registers operation modes and assignment . . . . . . . . . . . . . . . . . 848
Figure 198. Example: Sinc3 filter response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 850
Figure 199. LTDC block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 891
Figure 200. LCD-TFT synchronous timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 894
Figure 201. Layer window programmable parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 897
Figure 202. Blending two layers with background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 900
Figure 203. Interrupt events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 901
Figure 204. DSI Host block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 926
Figure 205. DSI Host architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 927
Figure 206. Flow to update the LTDC interface configuration using shadow registers . . . . . . . . . . . . 932
Figure 207. Immediate update procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 933
Figure 208. Configuration update during the trasmission of a frame . . . . . . . . . . . . . . . . . . . . . . . . . . 933
Figure 209. Adapted command mode usage flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 935
Figure 210. 24 bpp APB pixel to byte organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 940
Figure 211. 18 bpp APB pixel to byte organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 940
Figure 212. 16 bpp APB pixel to byte organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 941
Figure 213. 12 bpp APB pixel to byte organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 941
Figure 214. 8 bpp APB pixel to byte organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 941
Figure 215. Timing of PRESP_TO after a bus turn-around . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 944
Figure 216. Timing of PRESP_TO after a Read Request (HS or LP) . . . . . . . . . . . . . . . . . . . . . . . . . 945
Figure 217. Timing of PRESP_TO after a Write Request (HS or LP) . . . . . . . . . . . . . . . . . . . . . . . . . 946
Figure 218. Effect of Prep mode at 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 947
Figure 219. Command transmission periods within the image area . . . . . . . . . . . . . . . . . . . . . . . . . . 948
Figure 220. Transmission of commands on the last line of a frame. . . . . . . . . . . . . . . . . . . . . . . . . . . 949
Figure 221. LPSIZE for Non-Burst with sync pulses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 950
Figure 222. LPSIZE for Burst or Non-Burst with sync events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 951
Figure 223. VLPSIZE for Non-Burst with sync pulses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 952
Figure 224. VLPSIZE for Non-Burst with sync events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 952
Figure 225. VLPSIZE for Burst mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 952
Figure 226. Location of LPSIZE and VLPSIZE in the image area . . . . . . . . . . . . . . . . . . . . . . . . . . . . 954
Figure 227. Clock lane and data lanes in HS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 956
Figure 228. Clock lane in HS and data lanes in LP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 956
Figure 229. Clock lane and data lanes in LP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 956
Figure 230. Command transmission by the generic interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 957
Figure 231. Vertical color bar mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 959
Figure 232. Horizontal color bar mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 959
Figure 233. RGB888 BER testing pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 960
Figure 234. Vertical pattern (103x15) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 961
Figure 235. Horizontal pattern (103x15) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 961
Figure 236. PLL block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 965
Figure 237. Error sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 968
Figure 238. Video packet transmission configuration flow diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . 979
Figure 239. Programming sequence to send a test pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 981
Figure 240. Frame configuration registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 982
Figure 241. TSC block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1046
Figure 242. Surface charge transfer analog I/O group structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1047
Figure 243. Sampling capacitor voltage variation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1048
Figure 244. Charge transfer acquisition sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1049
Figure 245. Spread spectrum variation principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1050
Figure 246. RNG block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1065
Figure 299. Counter timing diagram, internal clock divided by 4, TIMx_ARR=0x36 . . . . . . . . . . . . . 1210
Figure 300. Counter timing diagram, internal clock divided by N. . . . . . . . . . . . . . . . . . . . . . . . . . . . 1211
Figure 301. Counter timing diagram, update event with ARPE=1 (counter underflow) . . . . . . . . . . . 1211
Figure 302. Counter timing diagram, Update event with ARPE=1 (counter overflow) . . . . . . . . . . . . 1212
Figure 303. Update rate examples depending on mode and TIMx_RCR register settings . . . . . . . . 1213
Figure 304. External trigger input block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1214
Figure 305. TIM1 ETR input circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1214
Figure 306. TIM8 ETR input circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1214
Figure 307. Control circuit in normal mode, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . 1215
Figure 308. TI2 external clock connection example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1216
Figure 309. Control circuit in external clock mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1217
Figure 310. External trigger input block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1217
Figure 311. Control circuit in external clock mode 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1218
Figure 312. Capture/compare channel (example: channel 1 input stage) . . . . . . . . . . . . . . . . . . . . . 1219
Figure 313. Capture/compare channel 1 main circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1220
Figure 314. Output stage of capture/compare channel (channel 1, idem ch. 2 and 3) . . . . . . . . . . . 1220
Figure 315. Output stage of capture/compare channel (channel 4). . . . . . . . . . . . . . . . . . . . . . . . . . 1221
Figure 316. Output stage of capture/compare channel (channel 5, idem ch. 6) . . . . . . . . . . . . . . . . 1221
Figure 317. PWM input mode timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1223
Figure 318. Output compare mode, toggle on OC1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1225
Figure 319. Edge-aligned PWM waveforms (ARR=8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1226
Figure 320. Center-aligned PWM waveforms (ARR=8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1227
Figure 321. Generation of 2 phase-shifted PWM signals with 50% duty cycle . . . . . . . . . . . . . . . . . 1229
Figure 322. Combined PWM mode on channel 1 and 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1230
Figure 323. 3-phase combined PWM signals with multiple trigger pulses per period . . . . . . . . . . . . 1231
Figure 324. Complementary output with dead-time insertion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1232
Figure 325. Dead-time waveforms with delay greater than the negative pulse . . . . . . . . . . . . . . . . . 1232
Figure 326. Dead-time waveforms with delay greater than the positive pulse. . . . . . . . . . . . . . . . . . 1233
Figure 327. Break and Break2 circuitry overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1235
Figure 328. Various output behavior in response to a break event on BRK (OSSI = 1) . . . . . . . . . . 1237
Figure 329. PWM output state following BRK and BRK2 pins assertion (OSSI=1) . . . . . . . . . . . . . . 1238
Figure 330. PWM output state following BRK assertion (OSSI=0) . . . . . . . . . . . . . . . . . . . . . . . . . . 1239
Figure 331. Output redirection (BRK2 request not represented) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1240
Figure 332. Clearing TIMx OCxREF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1241
Figure 333. 6-step generation, COM example (OSSR=1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1242
Figure 334. Example of one pulse mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1243
Figure 335. Retriggerable one pulse mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1245
Figure 336. Example of counter operation in encoder interface mode. . . . . . . . . . . . . . . . . . . . . . . . 1246
Figure 337. Example of encoder interface mode with TI1FP1 polarity inverted. . . . . . . . . . . . . . . . . 1247
Figure 338. Measuring time interval between edges on 3 signals . . . . . . . . . . . . . . . . . . . . . . . . . . . 1248
Figure 339. Example of Hall sensor interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1250
Figure 340. Control circuit in reset mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1251
Figure 341. Control circuit in Gated mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1252
Figure 342. Control circuit in trigger mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1253
Figure 343. Control circuit in external clock mode 2 + trigger mode . . . . . . . . . . . . . . . . . . . . . . . . . 1254
Figure 344. General-purpose timer block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1304
Figure 345. Counter timing diagram with prescaler division change from 1 to 2 . . . . . . . . . . . . . . . . 1306
Figure 346. Counter timing diagram with prescaler division change from 1 to 4 . . . . . . . . . . . . . . . . 1306
Figure 347. Counter timing diagram, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1307
Figure 348. Counter timing diagram, internal clock divided by 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1308
Figure 349. Counter timing diagram, internal clock divided by 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1308
Figure 350. Counter timing diagram, internal clock divided by N. . . . . . . . . . . . . . . . . . . . . . . . . . . . 1309
Figure 351. Counter timing diagram, Update event when ARPE=0 (TIMx_ARR not preloaded). . . . 1309
Figure 352. Counter timing diagram, Update event when ARPE=1 (TIMx_ARR preloaded). . . . . . . 1310
Figure 353. Counter timing diagram, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1311
Figure 354. Counter timing diagram, internal clock divided by 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1311
Figure 355. Counter timing diagram, internal clock divided by 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1312
Figure 356. Counter timing diagram, internal clock divided by N. . . . . . . . . . . . . . . . . . . . . . . . . . . . 1312
Figure 357. Counter timing diagram, Update event when repetition counter
is not used . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1313
Figure 358. Counter timing diagram, internal clock divided by 1, TIMx_ARR=0x6 . . . . . . . . . . . . . . 1314
Figure 359. Counter timing diagram, internal clock divided by 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1315
Figure 360. Counter timing diagram, internal clock divided by 4, TIMx_ARR=0x36 . . . . . . . . . . . . . 1315
Figure 361. Counter timing diagram, internal clock divided by N. . . . . . . . . . . . . . . . . . . . . . . . . . . . 1316
Figure 362. Counter timing diagram, Update event with ARPE=1 (counter underflow). . . . . . . . . . . 1316
Figure 363. Counter timing diagram, Update event with ARPE=1 (counter overflow) . . . . . . . . . . . . 1317
Figure 364. Control circuit in normal mode, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . 1318
Figure 365. TI2 external clock connection example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1318
Figure 366. Control circuit in external clock mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1319
Figure 367. External trigger input block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1320
Figure 368. Control circuit in external clock mode 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1321
Figure 369. Capture/Compare channel (example: channel 1 input stage) . . . . . . . . . . . . . . . . . . . . 1322
Figure 370. Capture/Compare channel 1 main circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1322
Figure 371. Output stage of Capture/Compare channel (channel 1) . . . . . . . . . . . . . . . . . . . . . . . . . 1323
Figure 372. PWM input mode timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1325
Figure 373. Output compare mode, toggle on OC1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1327
Figure 374. Edge-aligned PWM waveforms (ARR=8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1328
Figure 375. Center-aligned PWM waveforms (ARR=8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1329
Figure 376. Generation of 2 phase-shifted PWM signals with 50% duty cycle . . . . . . . . . . . . . . . . . 1330
Figure 377. Combined PWM mode on channels 1 and 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1332
Figure 378. Clearing TIMx OCxREF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1333
Figure 379. Example of one-pulse mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1334
Figure 380. Retriggerable one-pulse mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1336
Figure 381. Example of counter operation in encoder interface mode . . . . . . . . . . . . . . . . . . . . . . . 1337
Figure 382. Example of encoder interface mode with TI1FP1 polarity inverted . . . . . . . . . . . . . . . . 1338
Figure 383. Control circuit in reset mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1339
Figure 384. Control circuit in gated mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1340
Figure 385. Control circuit in trigger mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1341
Figure 386. Control circuit in external clock mode 2 + trigger mode . . . . . . . . . . . . . . . . . . . . . . . . . 1342
Figure 387. Master/Slave timer example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1342
Figure 388. Gating TIM2 with OC1REF of TIM3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1343
Figure 389. Gating TIM2 with Enable of TIM3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1344
Figure 390. Triggering TIM2 with update of TIM3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1345
Figure 391. Triggering TIM2 with Enable of TIM3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1345
Figure 392. Triggering TIM3 and TIM2 with TIM3 TI1 input. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1346
Figure 393. TIM15 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1377
Figure 394. TIM16/TIM17 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1378
Figure 395. Counter timing diagram with prescaler division change from 1 to 2 . . . . . . . . . . . . . . . . 1380
Figure 396. Counter timing diagram with prescaler division change from 1 to 4 . . . . . . . . . . . . . . . . 1380
Figure 397. Counter timing diagram, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1382
Figure 398. Counter timing diagram, internal clock divided by 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1382
Figure 399. Counter timing diagram, internal clock divided by 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1383
Figure 400. Counter timing diagram, internal clock divided by N. . . . . . . . . . . . . . . . . . . . . . . . . . . . 1383
Figure 401. Counter timing diagram, update event when ARPE=0 (TIMx_ARR not
preloaded). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1384
Figure 402. Counter timing diagram, update event when ARPE=1 (TIMx_ARR
preloaded). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1384
Figure 403. Update rate examples depending on mode and TIMx_RCR register settings . . . . . . . . 1386
Figure 404. Control circuit in normal mode, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . 1387
Figure 405. TI2 external clock connection example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1387
Figure 406. Control circuit in external clock mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1388
Figure 407. Capture/compare channel (example: channel 1 input stage) . . . . . . . . . . . . . . . . . . . . . 1389
Figure 408. Capture/compare channel 1 main circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1389
Figure 409. Output stage of capture/compare channel (channel 1). . . . . . . . . . . . . . . . . . . . . . . . . . 1390
Figure 410. Output stage of capture/compare channel (channel 2 for TIM15) . . . . . . . . . . . . . . . . . 1390
Figure 411. PWM input mode timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1392
Figure 412. Output compare mode, toggle on OC1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1394
Figure 413. Edge-aligned PWM waveforms (ARR=8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1395
Figure 414. Combined PWM mode on channel 1 and 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1396
Figure 415. Complementary output with dead-time insertion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1397
Figure 416. Dead-time waveforms with delay greater than the negative pulse. . . . . . . . . . . . . . . . . 1397
Figure 417. Dead-time waveforms with delay greater than the positive pulse. . . . . . . . . . . . . . . . . . 1398
Figure 418. Break circuitry overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1400
Figure 419. Output behavior in response to a break . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1402
Figure 420. Output redirection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1404
Figure 421. Example of one pulse mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1406
Figure 422. Retriggerable one pulse mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1407
Figure 423. Measuring time interval between edges on 2 signals . . . . . . . . . . . . . . . . . . . . . . . . . . . 1409
Figure 424. Control circuit in reset mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1410
Figure 425. Control circuit in gated mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1411
Figure 426. Control circuit in trigger mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1412
Figure 427. Basic timer block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1464
Figure 428. Counter timing diagram with prescaler division change from 1 to 2 . . . . . . . . . . . . . . . . 1466
Figure 429. Counter timing diagram with prescaler division change from 1 to 4 . . . . . . . . . . . . . . . . 1466
Figure 430. Counter timing diagram, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1467
Figure 431. Counter timing diagram, internal clock divided by 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1468
Figure 432. Counter timing diagram, internal clock divided by 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1468
Figure 433. Counter timing diagram, internal clock divided by N. . . . . . . . . . . . . . . . . . . . . . . . . . . . 1469
Figure 434. Counter timing diagram, update event when ARPE = 0 (TIMx_ARR not
preloaded). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1469
Figure 435. Counter timing diagram, update event when ARPE=1 (TIMx_ARR
preloaded). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1470
Figure 436. Control circuit in normal mode, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . 1471
Figure 437. Low-power timer block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1478
Figure 438. Glitch filter timing diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1481
Figure 439. LPTIM output waveform, single counting mode configuration . . . . . . . . . . . . . . . . . . . . 1483
Figure 440. LPTIM output waveform, Single counting mode configuration
and Set-once mode activated (WAVE bit is set) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1483
Figure 441. LPTIM output waveform, Continuous counting mode configuration . . . . . . . . . . . . . . . . 1484
Figure 442. Waveform generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1485
Figure 443. Encoder mode counting sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1489
Figure 444. Low-power timer block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1504
Figure 445. Glitch filter timing diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1507
Figure 446. LPTIM output waveform, single counting mode configuration
when repetition register content is different than zero (with PRELOAD = 1) . . . . . . . . . 1509
Figure 447. LPTIM output waveform, Single counting mode configuration
1 Documentation conventions
a. Arm is a registered trademark of Arm Limited (or its subsidiaries) in the US and/or elsewhere.
b. This is an exhaustive list of all abbreviations applicable to STM microcontrollers, some of them may not be
used in the current document.
1.3 Glossary
This section gives a brief definition of acronyms and abbreviations used in this document:
• Word: data of 32-bit length.
• Half-word: data of 16-bit length.
• Byte: data of 8-bit length.
• 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.
• Option bytes: product configuration bits stored in the Flash memory.
• OBL: option byte loader.
• AHB: advanced high-performance bus.
• APB: advanced peripheral bus.
Cortex®-M4
DMA1 DMA2 DMA2D LCD-TFT SDMMC1 GFXMMU
with FPU
D-bus
S-bus
I-bus
ICode
ACCEL
FLASH
DCode 2 MB
SRAM1
SRAM2
SRAM3
GFXMMU
AHB1
peripherals
AHB2
peripherals
FSMC
OCTOSPI1
OCTOSPI2
BusMatrix-S
MSv38490V1
Cortex®-M4
DMA1 DMA2 DMA2D LCD-TFT SDMMC1 SDMMC2
with FPU
D-bus
S-bus
I-bus
ICode
ACCEL
FLASH
DCode 2 MB
SRAM1
SRAM2
SRAM3
AHB1
peripherals
AHB2
peripherals
FSMC
OCTOSPI1
OCTOSPI2
BusMatrix-S
MSv61196V1
2.1.1 I-bus
This bus connects the instruction bus of the Cortex®-M4 core to the BusMatrix. This bus is
used by the core to fetch instructions. The target of this bus is a memory containing code
(either internal Flash memory, internal SRAM or external memories through the FMC or
OCTOSPIs).
2.1.2 D-bus
This bus connects the data bus of the Cortex®-M4 core to the BusMatrix. This bus is used
by the core for literal load and debug access. The target of this bus is a memory containing
code (either internal Flash memory, internal SRAM or external memories through the FMC
or OCTOSPIs).
2.1.3 S-bus
This bus connects the system bus of the Cortex®-M4 core to the BusMatrix. This bus is
used by the core to access data located in a peripheral or SRAM area. The targets of this
bus are the internal SRAM, the AHB1 peripherals including the APB1 and APB2
peripherals, the AHB2 peripherals and the external memories through the OCTOSPI or the
FMC.
The SRAM2 is also accessible on this bus to allow continuous mapping with SRAM1 and
SRAM3.
2.1.4 DMA-bus
This bus connects the AHB master interface of the DMA to the BusMatrix.The targets of this
bus are the SRAM1,SRAM2 and SRAM3, the AHB1 peripherals including the APB1 and
APB2 peripherals, the AHB2 peripherals and the external memories through the OCTOSPI
or the FMC.
2.1.5 DMA2D-bus
This bus connects the AHB master interface of the DMA2D to the BusMatrix. The targets of
this bus are the SRAM1, SRAM2 and SRAM3 and external memories through the OCTOSPI
or the FMC.
2.1.10 BusMatrix
The BusMatrix manages the access arbitration between masters. The arbitration uses a
Round Robin algorithm.
AHB/APB bridges
The two AHB/APB bridges provide full synchronous connections between the AHB and the
two APB buses, allowing flexible selection of the peripheral frequency.
Refer to Section 2.2.2: Memory map and register boundary addresses on page 92 for the
address mapping of the peripherals connected to this bridge.
After each device reset, all peripheral clocks are disabled (except for the SRAM1/2 and
Flash memory interface). Before using a peripheral you have to enable its clock in the
RCC_AHBxENR and the RCC_APBxENR registers.
Note: When a 16- or 8-bit access is performed on an APB register, the access is transformed into
a 32-bit access: the bridge duplicates the 16- or 8-bit data to feed the 32-bit vector.
2.2.1 Introduction
Program memory, data memory, registers and I/O ports are organized within the same linear
4-Gbyte address space.
The bytes are coded in memory in Little Endian format. The lowest numbered byte in a word
is considered the word’s least significant byte and the highest numbered byte the most
significant.
The addressable memory space is divided into eight main blocks, of 512 Mbytes each.
0x5FFF FFFF
Reserved
6 Reserved 0x5006 0C00
AHB2
0x4800 0000
0xC000 0000 Reserved
0x4002 4400
FMC and AHB1
5 OCTOSPI 0x4002 0000
registers Reserved
0x4001 6400
0xA000 0000 APB2
0x4001 0000
OctoSPI bank1 Reserved
0x4000 9800
4 0x9000 0000
APB1
FMC bank3 0x4000 0000
0x5FFF FFFF
Reserved
6 Reserved 0x5006 2C00
AHB2
0x4800 0000
0xC000 0000 Reserved
0x4002 BC00
FMC and AHB1
5 OCTOSPI 0x4002 0000
registers Reserved
0x4001 7400
0xA000 0000 APB2
0x4001 0000
OCTOSPI bank1 Reserved
0x4000 9800
4 0x9000 0000
APB1
FMC bank3 0x4000 0000
All the memory map areas that are not allocated to on-chip memories and peripherals are
considered “Reserved” (highlighted in gray). For the detailed mapping of available memory
and register areas, refer to the following table.
The following table gives the boundary addresses of the peripherals available in the
devices.
Table 1. STM32L4Rxxx and STM32L4Sxxx memory map and peripheral register boundary
addresses
Size
Bus Boundary address Peripheral Peripheral register map
(bytes)
Table 1. STM32L4Rxxx and STM32L4Sxxx memory map and peripheral register boundary
addresses (continued)
Size
Bus Boundary address Peripheral Peripheral register map
(bytes)
Table 1. STM32L4Rxxx and STM32L4Sxxx memory map and peripheral register boundary
addresses (continued)
Size
Bus Boundary address Peripheral Peripheral register map
(bytes)
Table 1. STM32L4Rxxx and STM32L4Sxxx memory map and peripheral register boundary
addresses (continued)
Size
Bus Boundary address Peripheral Peripheral register map
(bytes)
Table 1. STM32L4Rxxx and STM32L4Sxxx memory map and peripheral register boundary
addresses (continued)
Size
Bus Boundary address Peripheral Peripheral register map
(bytes)
Table 1. STM32L4Rxxx and STM32L4Sxxx memory map and peripheral register boundary
addresses (continued)
Size
Bus Boundary address Peripheral Peripheral register map
(bytes)
0x4000 4800 - 0x4000 4BFF 1 KB USART3 Section 50.7.15: USART register map
0x4000 4400 - 0x4000 47FF 1 KB USART2 Section 50.7.15: USART register map
0x4000 4000 - 0x4000 43FF 1 KB Reserved -
0x4000 3C00 - 0x4000 3FFF 1 KB SPI3 Section 52.6.8: SPI register map
0x4000 3800 - 0x4000 3BFF 1 KB SPI2 Section 52.6.8: SPI register map
0x4000 3400 - 0x4000 37FF 1 KB Reserved -
0x4000 3000 - 0x4000 33FF 1 KB IWDG Section 44.4.6: IWDG register map
0x4000 2C00 - 0x4000 2FFF 1 KB WWDG Section 45.5.4: WWDG register map
APB1
0x4000 2800 - 0x4000 2BFF 1 KB RTC Section 46.6.21: RTC register map
0x4000 1800 - 0x4000 23FF 4 KB Reserved -
0x4000 1400 - 0x4000 17FF 1 KB TIM7 Section 40.4.9: TIMx register map
0x4000 1000 - 0x4000 13FF 1 KB TIM6 Section 40.4.9: TIMx register map
0x4000 0C00- 0x4000 0FFF 1 KB TIM5 Section 38.4.26: TIMx register map
0x4000 0800 - 0x4000 0BFF 1 KB TIM4 Section 38.4.26: TIMx register map
0x4000 0400 - 0x4000 07FF 1 KB TIM3 Section 38.4.26: TIMx register map
0x4000 0000 - 0x4000 03FF 1 KB TIM2 Section 38.4.26: TIMx register map
Table 2. STM32L4P5xx and STM32L4Q5xx memory map and peripheral register boundary
addresses
Size
Bus Boundary address Peripheral Peripheral register map
(bytes)
Table 2. STM32L4P5xx and STM32L4Q5xx memory map and peripheral register boundary
addresses (continued)
Size
Bus Boundary address Peripheral Peripheral register map
(bytes)
Table 2. STM32L4P5xx and STM32L4Q5xx memory map and peripheral register boundary
addresses (continued)
Size
Bus Boundary address Peripheral Peripheral register map
(bytes)
Table 2. STM32L4P5xx and STM32L4Q5xx memory map and peripheral register boundary
addresses (continued)
Size
Bus Boundary address Peripheral Peripheral register map
(bytes)
Table 2. STM32L4P5xx and STM32L4Q5xx memory map and peripheral register boundary
addresses (continued)
Size
Bus Boundary address Peripheral Peripheral register map
(bytes)
Table 2. STM32L4P5xx and STM32L4Q5xx memory map and peripheral register boundary
addresses (continued)
Size
Bus Boundary address Peripheral Peripheral register map
(bytes)
A mapping formula shows how to reference each word in the alias region to a corresponding
bit in the bit-band region. The mapping formula is:
bit_word_addr = bit_band_base + (byte_offset x 32) + (bit_number × 4)
where:
– bit_word_addr is the address of the word in the alias memory region that maps to
the targeted bit
– bit_band_base is the starting address of the alias region
– byte_offset is the number of the byte in the bit-band region that contains the
targeted bit
– bit_number is the bit position (0-7) of the targeted bit
Example
The following example shows how to map bit 2 of the byte located at SRAM1 address
0x20000300 to the alias region:
0x22006008 = 0x22000000 + (0x300*32) + (2*4)
Writing to address 0x22006008 has the same effect as a read-modify-write operation on bit
2 of the byte at SRAM1 address 0x20000300.
Reading address 0x22006008 returns the value (0x01 or 0x00) of bit 2 of the byte at SRAM1
address 0x20000300 (0x01: bit set; 0x00: bit reset).
For more information on bit-banding, refer to the Cortex®-M4 programming manual (see
Related documents on page 1).
The write protection can be enabled in SYSCFG SRAM2 write protection register
(SYSCFG_SWPR) in the SYSCFG block. This is a register with write ‘1’ once mechanism,
which means by writing ‘1’ on a bit it will setup the write protection for that page of SRAM
and it can be removed/cleared by a system reset only.
(program/erase) controlled through the Flash registers Refer to Section 3: Embedded Flash
memory (FLASH) for more details.
The values on both BOOT0 pin (coming from the pin or the option bit) and nBOOT1 bit are
latched upon reset release. It is up to the user to set nBOOT1 and BOOT0 to select the
required boot mode.
The BOOT0 pin or user option bit (depending on the nSWBOOT0 bit value in the
FLASH_OPTR register), and nBOOT1 bit are also re-sampled when exiting from Standby
mode. Consequently, they must be kept in the required Boot mode configuration in Standby
mode. After this startup delay has elapsed, the CPU fetches the top-of-stack value from
address 0x0000 0000, then starts code execution from the boot memory at 0x0000 0004.
Depending on the selected boot mode, main Flash memory, system memory or SRAM1 is
accessible as follows:
• Boot from main Flash memory: the main Flash memory is aliased in the boot memory
space (0x0000 0000), but still accessible from its original memory space
(0x0800 0000). In other words, the Flash memory contents can be accessed starting
from address 0x0000 0000 or 0x0800 0000.
• Boot from system memory: the system memory is aliased in the boot memory space
(0x0000 0000), but still accessible from its original memory space (0x1FFF 0000).
• Boot from the embedded SRAM1: the SRAM1 is aliased in the boot memory space
(0x0000 0000), but it is still accessible from its original memory space (0x2000 0000).
PH3/BOOT0 GPIO is configured in:
• Input mode during the complete reset phase if the option bit nSWBOOT0 is set into the
FLASH_OPTR register and then switches automatically in analog mode after reset is
released (BOOT0 pin).
• Input mode from the reset phase to the completion of the option byte loading if the bit
nSWBOOT0 is cleared into the FLASH_OPTR register (BOOT0 value coming from the
option bit). It switches then automatically to the analog mode even if the reset phase is
not complete.
Note: When the device boots from SRAM, in the application initialization code, you have to
relocate the vector table in SRAM using the NVIC exception table and the offset register.
When booting from the main Flash memory, the application software can either boot from
bank 1 or from bank 2. By default, boot from bank 1 is selected.
To select boot from Flash memory bank 2, set the BFB2 bit in the user option bytes. When
this bit is set and the boot pins are in the boot from main Flash memory configuration, the
device boots from system memory, and the boot loader jumps to execute the user
application programmed in Flash memory bank 2. For further details, please refer to
AN2606.
Physical remap
Once the boot pins mode is selected, the application software can modify the memory
accessible in the code area (in this way the code can be executed through the ICode bus in
place of the System bus). This modification is performed by programming the SYSCFG
memory remap register (SYSCFG_MEMRMP) in the SYSCFG controller.
The following memories can thus be remapped:
• Main Flash memory
• System memory
• Embedded SRAM1 (192 Kbytes for STM32L4Rxxx and STM32L4Sxxx devices and
128 Kbytes for STM32L4P5xx and STM32L4Q5xx devices)
• FSMC bank 1 (NOR/PSRAM 1 and 2)
• OctoSPI (OCTOSPI1 or OSCTOSPI2) memory
3.1 Introduction
The Flash memory interface manages CPU AHB ICode and DCode accesses to the Flash
memory. It implements the erase and program Flash memory operations and the read and
write protection mechanisms.
The Flash memory interface accelerates code execution with a system of instruction
prefetch and cache lines.
Main memory - - -
- - -
- - -
- - -
0x080F E000 - 0x080F FFFF 8K Page 127
Table 12. Number of wait states according to CPU clock (HCLK) frequency
HCLK (MHz)
Wait states (WS)
(Latency)
VCORE Range 1 VCORE Range 2
After reset, the CPU clock frequency is 4 MHz and 0 wait state (WS) is configured in the
FLASH_ACR register.
When changing the CPU frequency, the following software sequences must be applied in
order to tune the number of wait states needed to access the Flash memory:
Instruction prefetch
The Cortex®-M4 fetches the instruction over the ICode bus and the literal pool
(constant/data) over the DCode bus. The prefetch block aims at increasing the efficiency of
ICode bus accesses.
In case of Single-bank mode (DBANK option bit is reset), each Flash memory read
operation provides 128 bits from either four instructions of 32 bits or eight instructions of
16 bits depending on the launched program. This 128-bits current instruction line is saved in
a current buffer, and in case of sequential code, at least four CPU cycles are needed to
execute the previous read instruction line.
When in Dual-bank mode (DBANK option bit is set), each Flash memory read operation
provides 64 bits from either two instructions of 32 bits or four instructions of 16 bits
depending on the launched program. This 64-bits current instruction line is saved in a
current buffer, and in case of sequential code, at least two CPU cycles are needed to
execute the previous read instruction line.
Prefetch on the ICode bus can be used to read the next sequential instruction line from the
Flash memory while the current instruction line is being requested by the CPU.
Prefetch is enabled by setting the PRFTEN bit in the Flash access control register
(FLASH_ACR). This feature is useful if at least one wait state is needed to access the Flash
memory.
Figure 5 shows the execution of sequential 16-bit instructions with and without prefetch
when 3 WS are needed to access the Flash memory.
@ F D E
WAIT
1 1 1 1 WITH PREFETCH
@ F D E
2 2 2 2
@ F D E
3 3 3 3
@ F D E
4 4 4 4
@ F D E
5 5 5 5
@ F D E
6 6 6 6
@ F D
7 7 7 Cortex-M4 pipeline
@ F
8 8 @ F D E
6 6 6 6
ins 1 ins 2 ins 3 ins 4 ins 5 ins 6 ins 7 ins 8
AHB protocol
fetch fetch fetch fetch fetch fetch fetch fetch
@: address requested
F: Fetch stage
Read ins 1, 2, 3, 4 Gives ins 1, 2, 3, 4 Gives ins 5, 6, 7, 8 D: Decode stage
E: Execute stage
Read ins 5, 6, 7, 8 Read ins 9, 10, ...
MS33467V1
When the code is not sequential (branch), the instruction may not be present in the currently
used instruction line or in the prefetched instruction line. In this case (miss), the penalty in
terms of number of cycles is at least equal to the number of wait states.
a write/erase operation is performed to the other bank (refer to Section 3.3.8: Read-while-
write (RWW) available only in Dual-bank mode (DBANK=1)). The Flash erase and
programming is only possible in the voltage scaling range 1. The VOS[1:0] bits in the
PWR_CR1 must be programmed to 01b.
On the contrary, during a program/erase operation to the Flash memory, any attempt to read
the same Flash memory bank will stall the bus. The read operation will proceed correctly
once the program/erase operation has completed.
Page erase
To erase a page, follow the procedure below:
1. Check that no Flash memory operation is ongoing by checking the BSY bit in the Flash
status register (FLASH_SR).
2. Check and clear all error programming flags due to a previous programming. If not,
PGSERR is set.
3. In Dual-bank mode (DBANK option bit is set), set the PER bit and select the page to
erase (PNB) with the associated bank (BKER) in the Flash control register
(FLASH_CR). In Single-bank mode (DBANK option bit is reset), set the PER bit and
select the page to erase (PNB). The BKER bit in the Flash control register
(FLASH_CR) must be kept cleared.
4. Set the STRT bit in the FLASH_CR register.
5. Wait for the BSY bit to be cleared in the FLASH_SR register.
Note: The internal oscillator HSI16 (16 MHz) is enabled automatically when STRT bit is set, and
disabled automatically when STRT bit is cleared, except if the HSI16 is previously enabled
with HSION in RCC_CR register.
If the page erase is part of write-protected area (by WRP or PCROP), WRPERR is set and
the page erase request is aborted.
Mass erase
To perform a Mass erase, follow the procedure below:
1. Check that no Flash memory operation is ongoing by checking the BSY bit in the
FLASH_SR register.
2. Check and clear all error programming flags due to a previous programming. If not,
PGSERR is set.
3. Set the MER1 bit and MER2 in the Flash control register (FLASH_CR).
4. Set the STRT bit in the FLACH_CR register.
5. Wait for the BSY bit to be cleared in the Flash status register (FLASH_SR).
Note: The internal oscillator HSI16 (16 MHz) is enabled automatically when STRT bit is set, and
disabled automatically when STRT bit is cleared, except if the HSI16 is previously enabled
with HSION in RCC_CR register.
When DBANK=0, if only the MERA or the MERB bit is set, PGSERR is set and no erase
operation is performed.
If the bank to erase or if one of the banks to erase contains a write-protected area (by WRP
or PCROP), WRPERR is set and the mass erase request is aborted (for both banks if both
are selected).
Standard programming
The Flash memory programming sequence in standard mode is as follows:
1. Check that no Flash main memory operation is ongoing by checking the BSY bit in the
Flash status register (FLASH_SR).
2. Check and clear all error programming flags due to a previous programming. If not,
PGSERR is set.
3. Set the PG bit in the Flash control register (FLASH_CR).
4. Perform the data write operation at the desired memory address, inside main memory
block or OTP area. Only double word can be programmed.
– Write a first word in an address aligned with double word
– Write the second word
5. Wait until the BSY bit is cleared in the FLASH_SR register.
6. Check that EOP flag is set in the FLASH_SR register (meaning that the programming
operation has succeed), and clear it by software.
7. Clear the PG bit in the FLASH_SR register if there no more programming request
anymore.
Note: When the Flash interface has received a good sequence (a double word), programming is
automatically launched and BSY bit is set. The internal oscillator HSI16 (16 MHz) is enabled
automatically when PG bit is set, and disabled automatically when PG bit is cleared, except
if the HSI16 is previously enabled with HSION in RCC_CR register.
If the user needs to program only one word, double word must be completed with the erase
value 0xFFFF FFFF to launch automatically the programming.
ECC is calculated from the double word to program.
Fast programming for a row (64 double words if DBANK=1) or for half row (64
double words if DBANK=0)
This mode allows to program a row (64 double words if DBANK=1) or half row (64 double
words if DBANK=0), and to reduce the page programming time by eliminating the need for
verifying the Flash locations before they are programmed and to avoid rising and falling time
of high voltage for each double word. During fast programming, the CPU clock frequency
(HCLK) must be at least 8 MHz.
Only the main memory can be programmed in fast programming mode.
The Flash main memory programming sequence in standard mode is as follows:
1. In Single-bank mode (DBANK=0), perform a mass erase. If not, PGSERR is set. The
Fast programing can be performed only if the code is executed from RAM or from
Programming errors
Several kind of errors can be detected. In case of error, the Flash operation (programming
or erasing) is aborted.
• PROGERR: Programming error
In standard programming: PROGERR is set if the word to write is not previously erased
(except if the value to program is full zero).
• SIZERR: Size programming error
In standard programming or in fast programming: only double word can be
programmed and only 32-bit data can be written. SIZERR is set if a byte or an half-
word is written.
• PGAERR: Alignment programming error
PGAERR is set if one of the following conditions occurs:
– In standard programming: the first word to be programmed is not aligned with a
double word address, or the second word doesn’t belong to the same double word
address.
– In fast programming: the data to program does not belong to the same row than
the previous programmed double words, or the address to program is not greater
than the previous one.
• PGSERR: Programming sequence error
PGSERR is set if one of the following conditions occurs:
– In the standard programming sequence or the fast programming sequence: a data
is written when PG and FSTPG are cleared.
– In the standard programming sequence or the fast programming sequence:
MER1, MER2, and PER are not cleared when PG or FSTPG is set.
– In the fast programming sequence: the Mass erase is not performed before setting
FSTPG bit.
– In the mass erase sequence: PG, FSTPG, and PER are not cleared when MER1
or MER2 is set.
– In the page erase sequence: PG, FSTPG, MER1 and MER2 are not cleared when
PER is set.
– PGSERR is set also if PROGERR, SIZERR, PGAERR, WRPERR, MISSERR,
FASTERR or PGSERR is set due to a previous programming error.
– When DBANK=0, in the case that only either MER1 or MER2 is set, PGSERR is
set (bank mass erase is not allowed).
• WRPERR: Write protection error
WRPERR is set if one of the following conditions occurs:
– Attempt to program or erase in a write protected area (WRP) or in a PCROP area.
– Attempt to perform a bank erase when one page or more is protected by WRP or
PCROP.
– The debug features are connected or the boot is executed from SRAM or from
System Flash when the read protection (RDP) is set to Level 1.
– Attempt to modify the option bytes when the read protection (RDP) is set to
Level 2.
• MISSERR: Fast programming data miss error
In fast programming: all the data must be written successively. MISSERR is set if the
previous data programmation is finished and the next data to program is not written yet.
• FASTERR: Fast programming error
In fast programming: FASTERR is set if one of the following conditions occurs:
– When FSTPG bit is set for more than 7ms which generates a time-out detection.
– When the fast programming has been interrupted by a MISSERR, PGAERR,
WRPERR or SIZERR.
If an error occurs during a program or erase operation, one of the following error flags is set
in the FLASH_SR register:
PROGERR, SIZERR, PGAERR, PGSERR, MISSERR (Program error flags),
WRPERR (Protection error flag)
In this case, if the error interrupt enable bit ERRIE is set in the Flash status register
(FLASH_SR), an interrupt is generated and the operation error flag OPERR is set in the
FLASH_SR register.
Note: If several successive errors are detected (for example, in case of DMA transfer to the Flash
memory), the error flags cannot be cleared until the end of the successive write requests.
Read from bank 1 while page erasing in bank 2 (or vice versa)
While executing a program code from bank 1, it is possible to perform a page erase
operation on bank 2 (and vice versa). Follow the procedure below:
1. Check that no Flash memory operation is ongoing by checking the BSY bit in the Flash
status register (FLASH_SR) (BSY is active when erase/program operation is on going
in bank 1 or bank 2).
2. Set PER bit, PSB to select the page and BKER to select the bank in the Flash control
register (FLASH_CR).
3. Set the STRT bit in the FLASH_CR register.
4. Wait for the BSY bit to be cleared (or use the EOP interrupt).
Read from bank 1 while mass erasing bank 2 (or vice versa)
While executing a program code from bank 1, it is possible to perform a mass erase
operation on bank 2 (and vice versa). Follow the procedure below:
1. Check that no Flash memory operation is ongoing by checking the BSY bit in the Flash
status register (FLASH_SR) (BSY is active when erase/program operation is on going
in bank 1 or bank 2).
2. Set MER1 or MER2 to in the Flash control register (FLASH_CR).
3. Set the STRT bit in the FLASH_CR register.
4. Wait for the BSY bit to be cleared (or use the EOP interrupt).
The organization of these bytes inside the information block is as shown in Table 14.
The option bytes can be read from the memory locations listed in Table 14 or from the
Option byte registers:
• Flash option register (FLASH_OPTR)
• Flash PCROP1 Start address register (FLASH_PCROP1SR)
• Flash PCROP1 End address register (FLASH_PCROP1ER)
• Flash WRP1 area A address register (FLASH_WRP1AR)
• Flash WRP1 area B address register (FLASH_WRP1BR)
• Flash PCROP2 Start address register (FLASH_PCROP2SR)
• Flash PCROP2 End address register (FLASH_PCROP2ER)
• Flash WRP2 area A address register (FLASH_WRP2AR)
• Flash WRP2 area B address register (FLASH_WRP2BR).
Table 14. Option byte organization
BANK Address [63:56] [55:48] [47:40] [39:32] [31:24] [23:16] [15:8] [7:0]
1FF01000 Unused
Unused and Unused and
1FF01008 PCROP2_STRT[15] PCROP2_STRT[15]
PCROP2_STRT[16] PCROP2_STRT[16]
Unused and Unused and
1FF01010 PCROP2_END[15] PCROP2_END[15]
Bank 2 PCROP2_END[16] PCROP2_END[16]
WRP1A WRP1B WRP1A WRP1B
1FF01018 Unused Unused Unused Unused
_END _STRT _END _STRT
WRP2A WRP2B WRP2A WRP2B
1FF01020 Unused Unused Unused Unused
_END _STRT _END _STRT
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
n nSW SRAM2 SRAM2 n WWDG IWGD_ IWDG_ IWDG_
Res. Res. Res. Res. DBANK DB1M BFB2
BOOT0 BOOT0 _RST _PE BOOT1 _SW STDBY STOP SW
r r r r r r r r r r r r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
nRST_ nRST_ nRST_
Res. Res. BOR_LEV[2:0] RDP[7:0]
SHDW STDBY STOP
r r r r r r r r r r r r r r
Bit 22 DBANK:
0: Single-bank mode with 128 bits data read width
1: Dual-bank mode with 64 bits data
This bit can be written only when PCROP1/2 is disabled.
Bit 21 DB1M:
For STM32L4Rxxx and STM32L4Sxxx devices:
Dual-bank on 1-Mbyte Flash memory devices
0: 1 Mbyte single Flash contiguous address in Bank1
1: 1 Mbyte dual-bank Flash with contiguous addresses
For STM32L4P5xx and STM32L4Q5xx devices:
Dual-bank on 512 Kbytes Flash memory devices
0: 512 Kbytes single Flash contiguous address in Bank1
1: 512 Kbytes Dual-bank Flash with contiguous addresses
Bit 20 BFB2: Dual-bank boot
0: Dual-bank boot disable
1: Dual-bank boot enable
Bit 19 WWDG_SW: Window watchdog selection
0: Hardware window watchdog
1: Software window watchdog
Bit 18 IWDG_STDBY: Independent watchdog counter freeze in Standby mode
0: Independent watchdog counter is frozen in Standby mode
1: Independent watchdog counter is running in Standby mode
Bit 17 IWDG_STOP: Independent watchdog counter freeze in Stop mode
0: Independent watchdog counter is frozen in Stop mode
1: Independent watchdog counter is running in Stop mode
Bit 16 IDWG_SW: Independent watchdog selection
0: Hardware independent watchdog
1: Software independent watchdog
Bit 15 Reserved, must be kept at reset value.
Bit 14 nRST_SHDW:
0: Reset generated when entering the Shutdown mode
1: No reset generated when entering the Shutdown mode
Bit 13 nRST_STDBY
0: Reset generated when entering the Standby mode
1: No reset generate when entering the Standby mode
Bit 12 nRST_STOP
0: Reset generated when entering the Stop mode
1: No reset generated when entering the Stop mode
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PCROP
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 1_STRT
[16:0]
rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PCROP1_STRT[16:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PCRO
PCROP
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. P1_EN
_RDP
D
rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PCROP1_END[16:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. WRP1A_END[7:0]
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. WRP1A_STRT[7:0]
rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. WRP1B_END[7:0]
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. WRP1B_STRT[7:0]
rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PCROP
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 2_STRT
[16:0]
rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PCROP2_STRT[16:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PCRO
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. P2_EN
D[16:0]
rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PCROP2_END[16:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. WRP2A_END[23:16]
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. WRP2A_STRT[7:0]
rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. WRP2B_END[23:16]
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. WRP2B_STRT[7:0]
rw rw rw rw rw rw rw rw
corrupted data from the Flash when the memory organization is changed, any access
(either CPU or DMAs) to Flash memory should be avoided before reprogramming.
• Disable Instruction/data caches and/or prefetch if they are enabled (reset PRFTEN and
ICEN/DCEN bits in the FLASH_ACR register).
• Flush instruction and data cache by setting the DCRST/ICRST bits in the FLASH_ACR
register.
• Set the DBANK option bit and clear all the WRP write protection (follow user option
modification and option bytes loader procedure).
– Once OBL is done with DBANK=0, perform a mass erase.
– Start a new programing of code in 64 bits mode with DBANK=0 memory mapping.
– Set the new WRP/PCROP with DBANK=0 scheme if needed.
– Set PRFTEN and ICEN/DCEN if needed.
The new software is ready to be run using the bank configuration.
The System memory area is read accessible whatever the protection level. It is never
accessible for program/erase operation.
Level 0: no protection
Read, program and erase operations into the Flash main memory area are possible. The
option bytes, the SRAM2 and the backup registers are also accessible by all operations.
Level 2: No debug
In this level, the protection level 1 is guaranteed. In addition, the Cortex®-M4 debug port, the
boot from RAM (boot RAM mode) and the boot from System memory (bootloader mode) are
no more available. In user execution mode (boot FLASH mode), all operations are allowed
on the Flash Main memory. On the contrary, only read operations can be performed on the
option bytes.
Option bytes cannot be programmed nor erased. Thus, the level 2 cannot be removed at all:
it is an irreversible operation. When attempting to modify the options bytes, the protection
error flag WRPERR is set in the Flash_SR register and an interrupt can be generated.
Note: The debug feature is also disabled under reset.
STMicroelectronics is not able to perform analysis on defective parts on which the level 2
protection has been set.
Note: Full Mass Erase or Partial Mass Erase is performed only when Level 1 is active and Level 0
requested. When the protection level is increased (0->1, 1->2, 0->2) there is no mass erase.
To validate the protection level change, the option bytes must be reloaded through the
OBL_LAUNCH bit in Flash control register.
Level 1
RDP ≠ 0xAA
RDP ≠ 0xCC
default
Level 2 Level 0
RDP = 0xCC Write options including RDP = 0xAA
RDP = 0xCC
RDP = 0xAA
Options write (RDP level increase) includes: Other(s) option(s) modified
- Options page erase
- New options program
Options write (RDP level decrease) includes Options write (RDP level identical) includes
- Full Mass erase or Partial Mass erase to not - Options page erase
erase PCROP pages if PCROP_RDP is cleared - New options program
- Backup registers and SRAM2 erase
- Options page erase
- New options program MSv61195V1
Table 16. Access status versus protection level and execution modes
Debug/ BootFromRam/
User execution (BootFromFlash)
Area
Protection BootFromLoader(1)
level
Read Write Erase Read Write Erase
1 Yes No No Yes No No
System
memory (2)
2 Yes No No N/A N/A N/A
Table 16. Access status versus protection level and execution modes (continued)
Debug/ BootFromRam/
User execution (BootFromFlash)
Area
Protection BootFromLoader(1)
level
Read Write Erase Read Write Erase
1. When the protection level 2 is active, the Debug port, the boot from RAM and the boot from system memory are disabled.
2. The system memory is only read-accessible, whatever the protection level (0, 1 or 2) and execution mode.
3. The Flash main memory is erased when the RDP option byte is programmed with all level protections disabled (0xAA).
4. OTP can only be written once.
5. The backup registers are erased when RDP changes from level 1 to level 0.
6. The SRAM2 is erased when RDP changes from level 1 to level 0.
For example, to protect by PCROP from the address 0x0806 2F80 (included) to the address
0x0807 0004 (included):
• if boot in Flash is done in Bank 1, FLASH_PCROP1SR and FLASH_PCROP1ER
registers must be programmed with:
– PCROP1_STRT = 0xC5F0.
– PCROP1_END = 0xE000.
• If the two banks are swapped, the protection must apply to bank 2, and
FLASH_PCROP2SR and FLASH_PCROP2ER register must be programmed with:
– PCROP2_STRT = 0xC5F0.
– PCROP2_END = 0xE000.
Any read access performed through the D-bus to a PCROP protected area will trigger
RDERR flag error.
Any PCROP protected address is also write protected and any write access to one of these
addresses will trigger WRPERR.
Any PCROP area is also erase protected. Consequently, any erase to a page in this zone is
impossible (including the page containing the start address and the end address of this
zone). Moreover, a software mass erase cannot be performed if one zone is PCROP
protected.
For previous example, due to erase by page, all pages from page 0x62 to 0x70 are
protected in case of page erase. (All addresses from 0x0806 2000 to 0x080 70FFF cannot
be erased).
Deactivation of PCROP can only occurs when the RDP is changing from level 1 to level 0. If
the user options modification tries to clear PCROP or to decrease the PCROP area, the
options programming is launched but PCROP area stays unchanged. On the contrary, it is
possible to increase the PCROP area.
When option bit PCROP_RDP is cleared, when the RDP is changing from level 1 to level 0,
Full Mass Erase is replaced by Partial Mass Erase in order to keep the PCROP area (refer
to Changing the Read protection level). In this case, PCROP1/2_STRT and
PCROP1/2_END are also not erased.
Note: It is recommended to align PCROP area with page granularity when using PCROP_RDP, or
to leave free the rest of the page where PCROP zone starts or ends.
PCROPx_offset_strt >
No PCROP area.
PCROPx_offset_end
The area between PCROPx_offset_strt and
PCROPx_offset_end is
PCROPx_offset_strt < protected.
PCROPx_offset_end It is possible to write:
– PCROPx_offset_strt with a lower value
– PCROPx_offset_end with a higher value.
1. When DBANK=1, the minimum PCROP area size is 2xdouble words: PCROPx_offset_strt and
PCROPx_offset_end.
When DBANK=0, the minimum PCROP area size is 2x(2xdouble words): PCROPx_offset_strt and
PCROPx_offset_end.
When DBANK=1, it is the user’s responsibility to make sure no overlapping occurs on the PCROP zones.
WRPxy_STRT =
Page WRPxy is protected.
WRPxy_END
WRPxy_STRT >
No WRP area.
WRPxy_END
WRPxy_STRT < – The pages from WRPxy_STRT to WRPxy_END are
WRPxy_END protected.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SLEEP RUN_ PRFTE
Res. DCRST ICRST DCEN ICEN Res. Res. Res. Res. LATENCY [3:0
_PD PD N
rw rw rw rw rw rw rw rw rw rw rw
--
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PDKEYR[31:16]
w w w w w w w w w w w w w w w w
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PDKEYR[15:0]
w w w w w w w w w w w w w w w w
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
KEYR[31:16]
w w w w w w w w w w w w w w w w
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
KEYR[15:0]
w w w w w w w w w w w w w w w w
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
OPTKEYR[31:16]
w w w w w w w w w w w w w w w w
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OPTKEYR[15:0]
w w w w w w w w w w w w w w w w
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PEMPT
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. BSY
Y
rc_w1 r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OPTV RD FAST MISS PGS SIZ PGA WRP PROG OP
Res. Res. Res. Res. Res. EOP
ERR ERR ERR ERR ERR ERR ERR ERR ERR ERR
rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
OPT OBL_ RD ERR EOP OPT
LOCK Res. Res. Res. Res. Res. Res. Res. FSTPG STRT
LOCK LAUNCH ERRIE IE IE STRT
rs rs rc_w1 rw rw rw rw rs rs
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
MER2 Res. Res. Res. BKER PNB[7:0] MER1 PER PG
rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
ECCD ECCC SYSF_ BK
ECCD ECCC ECCD2 Res. Res. Res. Res. ADDR_ECC[20:16]
2 IE ECC _ECC
rc_w1 rc_w1 rc_w1 rc_w1 rw r r r r r r r
ADDR_ECC[15:0]
r r r r r r r r r r r r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
n nSW SRAM2 SRAM2 nBOOT WWDG IWGD_ IWDG_ IWDG_
Res. Res. Res. Res. DBANK DB1M BFB2
BOOT0 BOOT0 _RST _PE 1 _SW STDBY StOP SW
rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
nRST_ nRST_ nRST_
Res. Res. BOR_LEV[2:0] RDP[7:0]
SHDW STDBY STOP
rw rw rw rw rw rw rw rw rw rw rw rw rw rw
Bit 21 DB1M:
For STM32L4Rxxx and STM32L4Sxxx devices:
Dual-bank on 1 Mbyte Flash memory devices
0: 1 Mbyte single Flash contiguous address in Bank 1
1: 1 Mbyte dual-bank Flash with contiguous addresses
When DB1M is set, a hard fault is generated when the requested address goes
over 1 Mbyte.
For STM32L4P5xx and STM32L4Q5xx devices:
Dual-bank on 512 Kbytes Flash memory devices
0: 512 Kbytes single Flash contiguous address in bank1
1: 512 Kbytes dual-bank Flash with contiguous addresses
When DB1M is set, a hard fault is generated when the requested address goes
over 512 Kbytes.
Bit 20 BFB2: Dual-bank boot
0: Dual-bank boot disable
1: Dual-bank boot enable
Bit 19 WWDG_SW: Window watchdog selection
0: Hardware window watchdog
1: Software window watchdog
Bit 18 IWDG_STDBY: Independent watchdog counter freeze in Standby mode
0: Independent watchdog counter is frozen in Standby mode
1: Independent watchdog counter is running in Standby mode
Bit 17 IWDG_STOP: Independent watchdog counter freeze in Stop mode
0: Independent watchdog counter is frozen in Stop mode
1: Independent watchdog counter is running in Stop mode
Bit 16 IDWG_SW: Independent watchdog selection
0: Hardware independent watchdog
1: Software independent watchdog
Bit 15 Reserved, must be kept cleared
Bit 14 nRST_SHDW
0: Reset generated when entering the Shutdown mode
1: No reset generated when entering the Shutdown mode
Bit 13 nRST_STDBY
0: Reset generated when entering the Standby mode
1: No reset generate when entering the Standby mode
Bit 12 nRST_STOP
0: Reset generated when entering the Stop mode
1: No reset generated when entering the Stop mode
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PCROP
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
1_STRT
rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PCROP1_STRT[16:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PCRO
PCROP
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. P1_EN
_RDP
D
rs rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PCROP1_END[16:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. WRP1A_END[7:0]
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. WRP1A_STRT[7:0]
rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. WRP2A_END[7:0]
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. WRP2A_STRT[7:0]
rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PCRO
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. P2_ST
RT
rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PCROP2_STRT[16:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PCRO
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. P2_EN
D
rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PCROP2_END[16:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. WRP1B_END[7:0]
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. WRP1B_STRT[7:0]
rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. WRP2B_END[7:0]
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. WRP2B_STRT[7:0]
rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. LVEN
rw
Offset Register
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
SLEEP_PD
RUN_PD
PRFTEN
DCRST
ICRST
DCEN
ICEN
LATENCY
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
FLASH_ACR
0x00 [3:0]
Reset value 0 0 0 0 1 1 0 0 0 0 0
FLASH_
PDKEYR[31:0]
PDKEYR
0x04
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
FLASH_KEYR KEYR[31:0]
0x08
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
FLASH_OPT
OPTKEYR[31:0]
KEYR
0x0C
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
PROGERR
OPTVERR
FASTERR
WRPERR
PGSERR
PGAERR
PEMPTY
MISERR
SIZERR
RDERR
OPERR
EOP
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
FLASH_SR BSY
0x10
Reset value X 0 0 0 0 0 0 0 0 0 0 0 0
OBL_LAUNCH
OPTLOCK
OPTSTRT
RDERRIE
FSTPG
ERRIE
EOPIE
MER2
MER1
LOCK
BKER
STRT
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
PER
PG
FLASH_CR PNB[7:0]
0x14
Reset value 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
SYSF_ECC
BK_ECC
ECCCIE
ECCD2
ECCC2
ECCD
ECCC
Res.
Res.
Res.
Res.
FLASH_ECCR ADDR_ECC[20:0]
0x18
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
nRST_SHDW
SRAM2_RST
IWDG_STOP
IWDG_STBY
nRST_STOP
nRST_STDB
WWDG_SW
nSWBOOT0
SRAM2_PE
IWDG_SW
.nBOOT0
nBOOT1
DBANK
DB1M
BFB2
BOR_
Res.
Res.
Res.
Res.
Res.
Res.
FLASH_OPTR RDP[7:0]
LEV[2:0]
0x20
Reset value X X X X X X X X X X X X X X X X X X X X X X X X X X
FLASH_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
PCROP1_STRT[16:0]
PCROP1SR
0x24
Reset value 1 X X X X X X X X X X X X X X X X
PCROP_RDP.
FLASH_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
PCROP1_END[16:0]
PCROP1ER
0x28
Reset value x 0 X X X X X X X X X X X X X X X X
FLASH_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
WRP1A_END[7:0] WRP1A_STRT[7:0]
WRP1AR
0x2C
Reset value X X X X X X X X X X X X X X X X
Table 20. Flash interface - register map and reset values (continued)
Offset Register
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
FLASH_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
WRP2A_END[7:0] WRP2A_STRT[7:0]
WRP2AR
0x30
Reset value X X X X X X X X X X X X X X X X
FLASH_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
PCROP2_STRT[16:0]
PCROP2SR
0x44
Reset value 1 X X X X X X X X X X X X X X X X
FLASH_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
PCROP2_END[16:0]
PCROP2ER
0x48
Reset value 0 X X X X X X X X X X X X X X X X
FLASH_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
WRP1B_END[7:0] WRP1B_STRT[7:0]
WRP1BR
0x4C
Reset value X X X X X X X X X X X X X X X X
FLASH_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
WRP2B_END[7:0] WRP2B_STRT[7:0]
WRP2BR
0x50
Reset value X X X X X X X X X X X X X X X X
LVEN
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
FLASH_CFGR
0x130
Reset value 0
4 Firewall (FW)
4.1 Introduction
The Firewall is made to protect a specific part of code or data into the Non-Volatile Memory,
and/or to protect the Volatile data into the SRAM1 from the rest of the code executed
outside the protected area.
I
N
AHB Slave T
AHB Master 1 E
CORTEX M4 R FLASH
F
A
B C
U E
S
DMA A
T
R
I
X
SRAM 1
AHB Slave
MsV43402V1
Debug consideration
In debug mode, if the Firewall is opened, the accesses by the debugger to the protected
segments are not blocked. For this reason, the Read out level 2 protection must be active in
conjunction with the Firewall implementation.
If the debug is needed, it is possible to proceed in the following way:
• A dummy code having the same API as the protected code may be developed during
the development phase of the final user code. This dummy code may send back
coherent answers (in terms of function and potentially timing if needed), as the
protected code should do in production phase.
• In the development phase, the protected code can be given to the customer-end under
NDA agreement and its software can be developed in level 0 protection. The customer-
end code needs to embed an IAP located in a write protected segment in order to allow
future code updates when the production parts will be Level 2 ROP.
Write protection
In order to offer a maximum security level, the following points need to be respected:
• It is mandatory to keep a write protection on the part of the code enabling the Firewall.
This activation code should be located outside the segments protected by the Firewall.
• The write protection is also mandatory on the code segment protected by the Firewall.
• The page including the reset vector must be write-protected.
Interrupts management
The code protected by the Firewall must not be interruptible. It is up to the user code to
disable any interrupt source before executing the code protected by the Firewall. If this
constraint is not respected, if an interrupt comes while the protected code is executed
(Firewall opened), the Firewall will be closed as soon as the interrupt subroutine is
executed. When the code returns back to the protected code area, a Firewall alarm will raise
since the “call gate” sequence will not be applied and a reset will be generated.
Concerning the interrupt vectors and the first user page in the Flash memory:
• If the first user page (including the reset vector) is protected by the Firewall, the NVIC
vector should be reprogrammed outside the protected segment.
• If the first user page is not protected by the Firewall, the interrupt vectors may be kept
at this location.
There is no interrupt generated by the Firewall.
Code segment
This segment is located into the Flash memory. It should contain the code to execute which
requires the Firewall protection. The segment must be reached using the “call gate” entry
sequence to open the Firewall. A system reset is generated if the “call gate” entry sequence
is not respected (refer to Opening the Firewall) and if the Firewall is enabled using the
FWDIS bit in the system configuration register. The length of the segment and the segment
base address must be configured before enabling the Firewall (refer to Section 4.3.5:
Firewall initialization).
The Volatile data segment is a bit different from the two others. The segment can be:
• Shared (VDS bit in the register)
It means that the area and the data located into this segment can be shared between
the protected code and the user code executed in a non-protected area. The access is
allowed whether the Firewall is opened or closed or disabled.
The VDS bit gets priority over the VDE bit, this last bit value being ignored in such a
case. It means that the Volatile data segment can execute parts of code located there
without any need to open the Firewall before executing the code.
• Execute
The VDE bit is considered as soon as the VDS bit = 0 in the FW_CR register. If the
VDS bit = 1, refer to the description above on the Volatile data segment sharing. If VDS
= 0 and VDE = 1, the Volatile data segment is executable. To avoid a system reset
generation from the Firewall, the “call gate” sequence should be applied on the Volatile
data segment to open the Firewall as an entry point for the code execution.
Segments properties
Each segment has a specific length register to define the segment size to be protected by
the Firewall: CSL register for the Code segment length register, NVDSL for the Non-volatile
data segment length register, and VDSL register for the Volatile data segment length
register. Granularity and area ranges for each of the segments are presented in Table 22.
Firewall disable
(reset)
Illegal accesses to
the protected Enable the firewall Protected code jumps
segments (FWDIS = 0) to an unprotected
segment and FPA = 0
Firewall Firewall
closed opened
MS32390V4
rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. LENG[21:16]
rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw
rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. LENG[21:16]
rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw
ADD
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
[17:16]
rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw
LENG
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
[17:16]
rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. VDE VDS FPA
rw rw rw
This register is protected in the same way as the Non-volatile data segment (refer to
Section 4.3.5: Firewall initialization).
0xC
0x20
0x18
0x14
0x10
4.4.8
0x1C
Offset
RM0432
FW_CR
FW_CSL
FW_VDSL
FW_CSSA
Register
Reset Value
Reset Value
Reset Value
Reset Value
Reset Value
Reset Value
Reset Value
Reset Value
Reset Value
FW_NVDSL
FW_VDSSA
FW_NVDSSA
Res. Res. Res. Res. Res. Res. Res. Res. Res. 31
Res. Res. Res. Res. Res. Res. Res. Res. Res. 30
Res. Res. Res. Res. Res. Res. Res. Res. Res. 29
Res. Res. Res. Res. Res. Res. Res. Res. Res. 28
Res. Res. Res. Res. Res. Res. Res. Res. Res. 27
Res. Res. Res. Res. Res. Res. Res. Res. Res. 26
Res. Res. Res. Res. Res. Res. Res. Res. Res. 25
Firewall register map
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
RM0432 Rev 6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
14
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
VDE Res. Res. Res. Res. Res. Res. Res. Res. 2
0
VDS Res. Res. Res. Res. Res. Res. Res. Res. 1
0
FPA Res. Res. Res. Res. Res. Res. Res. Res. 0
Firewall (FW)
181/2301
181
Power control (PWR) RM0432
VDDA domain
1 x A/D converter
VDDA 2 x comparators
2 x D/A converters
VSSA 2 x operational amplifiers
Voltage reference buffer
VDDUSB
USB transceivers
VSS
VDDIO2 domain
VDDIO2 VDDIO2
I/O ring
VSS PG[15:2]
VDD domain
VDDIO1 I/O ring
2 x VDD12
Flash memory
Low voltage detector
Backup domain
LSE crystal 32 K osc
VBAT
BKP registers
RCC BDCR register
RTC
MSv43404V2
VDDA domain
1 x A/D converter
VDDA 2 x comparators
2 x D/A converters
VSSA 2 x operational amplifiers
Voltage reference buffer
VDDUSB
USB transceivers
VSS
VDDIO2 domain
VDDIO2 VDDIO2
I/O ring
VSS PG[15:2]
VDDDSI DSI
voltage regulator
VCAPDSI
VDD12DSI DSI PHY
VDD domain
VDDIO1 I/O ring
Backup domain
LSE crystal 32 K osc
VBAT
BKP registers
RCC BDCR register
RTC
MSv43405V2
When the backup domain is supplied by VBAT (analog switch connected to VBAT because
VDD is not present), the following functions are available:
• PC13, PC14 and PC15 can be controlled only by RTC or LSE (refer to Section 46.3:
RTC functional description)
• PA0/RTC_TAMP2 and PE6/RTC_TAMP3 when they are configured by the RTC as
tamper pins
preserved (depending on RRS[1:0] bits in the PWR_CR3 register). The main regulator
(MR) is off and the low-power regulator (LPR) provides the supply only to SRAM2. The
core, digital peripherals (except Standby circuitry and backup domain) and SRAM1 are
powered off.
Note: For STM32L4Rxxx and STM32L4Sxxx devices it is only possible to preserve the full
SRAM2 content depending on RRS bit in the PWR_CR3 register. For STM32L4P5xx and
STM32L4Q5xx devices it is possible to preserve the full (64 Kbytes) or partial (4 Kbytes)
SRAM2 content depending on RRS[1:0] bits in the PWR_CR3 register.
• In Standby mode, both regulators are powered off. The contents of the registers,
SRAM1, SRAM2 and SRAM3 is lost except for the Standby circuitry and the backup
domain.
• In Shutdown mode, both regulators are powered off. When exiting from Shutdown
mode, a power-on reset is generated. Consequently, the contents of the registers,
SRAM1, SRAM2 and SRAM3 is lost, except for the backup domain.
VDD
PMOS
Switch VCORE
VDD12
Vsmps
Voltage regulator
Ref
MSv44809V1
A switch, controlled by the chosen GPIO, is inserted between the SMPS output and VDD12.
In Range1, the main regulator operates in two modes following the R1MODE bit in the
PWR_CR5 register:
• Main regulator Range 1 normal mode: provides a typical output voltage at 1.2 V. It is
used when the system clock frequency is up to 80 MHz. The Flash access time for read
access is minimum, write and erase operations are possible.
• Main regulator Range 1 boost mode: provides a typical output voltage at 1.28 V. It is
used when the system clock frequency is up to 120 MHz. The Flash access time for
read access is minimum, write and erase operations are possible. To optimize the
power consumption it is recommended to select the range1 boost mode when the
system clock frequency is greater than 80 MHz. See Table 24.
VDD
VBOR0 (rising edge)
hysteresis
VBOR0 (falling edge)
Temporization
tRSTTEMPO
Reset
MS31444V5
1. The reset temporization tRSTTEMPO is present only for the BOR lowest threshold (VBOR0).
V DD
PVD output
MS31445V2
The independent supplies (VDDA, VDDIO2 and VDDUSB) are not considered as present by
default, and a logical and electrical isolation is applied to ignore any information coming
from the peripherals supplied by these dedicated supplies.
• If these supplies are shorted externally to VDD, the application should assume they are
available without enabling any Peripheral Voltage Monitoring.
• If these supplies are independent from VDD, the Peripheral Voltage Monitoring (PVM)
can be enabled to confirm whether the supply is present or not.
The following sequence must be done before using the USB OTG peripheral:
1. If VDDUSB is independent from VDD:
a) Enable the PVM1 by setting PVME1 bit in the Power control register 2
(PWR_CR2).
b) Wait for the PVM1 wakeup time
c) Wait until PVMO1 bit is cleared in the Power status register 2 (PWR_SR2).
d) Optional: Disable the PVM1 for consumption saving.
2. Set the USV bit in the Power control register 2 (PWR_CR2) to remove the VDDUSB
power isolation.
The following sequence must be done before using any I/O from PG[15:2]:
MS33361V2
LPMS=”000” +
SLEEPDEEP bit
Stop 0 ON
+ WFI or Return
HSI16 when
from ISR or WFE
Any EXTI line STOPWUCK=1 in
LPMS=”001” + (configured in the RCC_CFGR
SLEEPDEEP bit EXTI registers) MSI with the
Stop 1 + WFI or Return Specific frequency before
from ISR or WFE peripherals entering the Stop
events mode when
LPMS=”010” +
STOPWUCK=0.
SLEEPDEEP bit
Stop 2 + WFI or Return
from ISR or WFE
LPMS=”011”+
WKUP pin edge,
Set RRS[1:0] bits
Standby with RTC event,
to “10” +
SRAM2 external reset in
SLEEPDEEP bit ON
4 Kbytes(2) NRST pin, IWDG
+ WIFI or Return
reset
from ISR or WFE
All clocks OFF except OFF
LPMS=”011”+ LSI and LSE
Set RSS bit for
STM32L4Rxxx
and
STM32L4Sxxx
devices and set WKUP pin edge,
Standby with RSS[1:0] bits to RTC event, MSI from 1 MHz
SRAM2 “01” for external reset in up to 8 MHz
64 Kbytes STM32L4P5xx NRST pin,
and IWDG reset
STM32L4Q5xx
devices +
SLEEPDEEP bit
+ WFI or Return
from ISR or WFE
LPMS=”011” + WKUP pin edge,
Clear RRS bit + RTC event,
Standby SLEEPDEEP bit external reset in OFF OFF
+ WFI or Return NRST pin,
from ISR or WFE IWDG reset
Low-power sleep
Low-power run
Wakeup capability
Wakeup capability
Wakeup capability
Wakeup capability
Peripheral Run Sleep VBAT
- - - -
CPU Y - Y - - - - - - - - - -
(2) (2) (2) (2)
Flash memory (2 Mbytes) O O O O - - - - - - - - -
SRAM1
(192 Kbytes for
STM32L4Rxxx and
STM32L4Sxxx) Y Y(3) Y Y(3) Y - Y - - - - - -
(128 Kbytes for
STM32L4P5xx and
STM32L4Q5xx)
SRAM2 (64 Kbytes) Y Y(3) Y Y(3) Y - Y - O(4) - - - -
SRAM3
(384 Kbytes for
STM32L4Rxxx and
STM32L4Sxxx) Y Y(3) Y Y(3) Y - Y - - - - - -
(128 Kbytes for
STM32L4P5xx and
STM32L4Q5xx)
FSMC O O O O - - - - - - - - -
OCTOSPIx (x=1,2) O O O O - - - - - - - - -
Backup registers Y Y Y Y Y - Y - Y - Y - Y
Brown-out reset (BOR) Y Y Y Y Y Y Y Y Y Y - - -
Programmable voltage
O O O O O O O O - - - - -
detector (PVD)
Peripheral voltage monitor
O O O O O O O O - - - - -
(PVMx; x=1,2,3,4)
DMA O O O O - - - - - - - - -
DMA2D O O O O - - - - - - - - -
Oscillator HSI16 O O O O (5) (5)
- - - - - - -
Oscillator HSI48 O O - - - - - - - - - - -
Low-power sleep
Low-power run
Wakeup capability
Wakeup capability
Wakeup capability
Wakeup capability
Peripheral Run Sleep VBAT
- - - -
Low-power UART O O O
O O O O (7) (7) O(7) (7) - - - - -
(LPUART1)
O O
I2Cx (x=1,2,4) O O O O (8) (8) - - - - - - -
O O O O
I2C3 O O O O (8) (8) (8) (8) - - - - -
SPIx (x=1,2,3) O O O O - - - - - - - - -
CAN1 O O O O - - - - - - - - -
SDMMC1 O O O O - - - - - - - - -
SDMMC2 O O O O - - - - - - - - -
SAIx (x=1,2) O O O O - - - - - - - - -
DFSDM1 O O O O - - - - - - - - -
ADCx (x=1,2) O O O O - - - - - - - - -
DACx (x=1,2) O O O O O - - - - - - - -
VREFBUF O O O O O - - - - - - - -
OPAMPx (x=1,2) O O O O O - - - - - - - -
COMPx (x=1,2) O O O O O O O O - - - - -
Low-power sleep
Low-power run
Wakeup capability
Wakeup capability
Wakeup capability
Wakeup capability
Peripheral Run Sleep VBAT
- - - -
Temperature sensor O O O O - - - - - - - - -
Timers (TIMx) O O O O - - - - - - - - -
Low-power timer 1
O O O O O O O O - - - - -
(LPTIM1)
Low-power timer 2
O O O O O O O(9) O(9) - - - - -
(LPTIM2)
Independent watchdog
O O O O O O O O O O - - -
(IWDG)
SysTick timer O O O O - - - - - - - - -
Touch sensing controller
O O O O - - - - - - - - -
(TSC)
Random number generator
O(10) O(10) - - - - - - - - - - -
(RNG)
AES hardware accelerator O O O O - - - - - - - - -
Public key accelerator
O O O O - - - - - - - - -
(PKA)
HASH hardware accelerator O O O O - - - - - - - - -
CRC calculation unit O O O O - - - - - - - - -
5 5
GPIOs O O O O O O O O (11) (13)
pins pins -
(12) (12)
1. Legend: Y = Yes (Enable). O = Optional (Disable by default. Can be enabled by software). - = Not available. wakeup
highlighted in gray.
2. The Flash can be configured in Power-down mode. By default, it is not in Power-down mode.
3. The SRAM clock can be gated on or off.
4. For STM32L4Rxxx and STM32L4Sxxx, SRAM2 content is preserved when the bit RRS is set in PWR_CR3 register. For
STM32L4P5xx and STM32L4Q5xx, 4 Kbytes or full SRAM2 content is preserved depending on RRS[1:0] bits configuration
in PWR_CR3 register.
5. Some peripherals with wakeup from Stop capability can request HSI16 to be enabled. In this case, HSI16 is woken up by
the peripheral, and only feeds the peripheral which requested it. HSI16 is automatically put off when the peripheral does not
need it anymore.
6. PSSI is available only on STM32L4P5xx and STM32L4Q5xx devices.
7. UART and LPUART reception is functional in Stop mode, and generates a wakeup interrupt on Start, address match or
received frame event.
8. I2C address detection is functional in Stop mode, and generates a wakeup interrupt in case of address match.
9. Only for STM32L4P5xx and STM32L4Q5xx devices.
Debug mode
By default, the debug connection is lost if the application puts the MCU in Stop 0, Stop1,
Stop 2, Standby or Shutdown mode while the debug features are used. This is due to the
fact that the Cortex®-M4 core is no longer clocked.
However, by setting some configuration bits in the DBGMCU_CR register, the software can
be debugged even when using the low-power modes extensively. For more details, refer to
Section 57.16.1: Debug support for low-power modes.
1. Optional: Jump into the SRAM and power-down the Flash by setting the RUN_PD bit in
the Flash access control register (FLASH_ACR).
2. Decrease the system clock frequency below 2 MHz.
3. Force the regulator in low-power mode by setting the LPR bit in the PWR_CR1 register.
Refer to Table 28: Low-power run on how to enter the Low-power run mode.
IRQ channel pending bit (in the NVIC interrupt clear pending register) have to be
cleared.
Only NVIC interrupts with sufficient priority will wakeup and interrupt the MCU.
- When SEVONPEND = 1 in the Cortex®-M4 System Control register.
By enabling an interrupt in the peripheral control register and optionally in the
NVIC. When the MCU resumes from WFE, the peripheral interrupt pending bit and
when enabled the NVIC peripheral IRQ channel pending bit (in the NVIC interrupt
clear pending register) have to be cleared.
All NVIC interrupts will wakeup the MCU, even the disabled ones. Only enabled
NVIC interrupts with sufficient priority will wakeup and interrupt the MCU.
– Event
Configuring a EXTI line in event mode. When the CPU resumes from WFE, it is
not necessary to clear the EXTI peripheral interrupt pending bit or the NVIC IRQ
channel pending bit as the pending bits corresponding to the event line is not set.
It may be necessary to clear the interrupt flag in the peripheral.
From Standby modes, and Shutdown modes the MCU exit low-power mode through an
external reset (NRST pin), an IWDG reset, a rising edge on one of the enabled WKUPx pins
or a RTC event occurs (see Figure 456: RTC block diagrams).
After waking up from Standby or Shutdown mode, program execution restarts in the same
way as after a Reset (boot pin sampling, option bytes loading, reset vector is fetched, etc.).
Refer to Table 31: Stop 0 mode for details on how to enter the Stop 0 mode.
If Flash memory programming is ongoing, the Stop 0 mode entry is delayed until the
memory access is finished.
If an access to the APB domain is ongoing, The Stop 0 mode entry is delayed until the APB
access is finished.
In Stop 0 mode, the following features can be selected by programming individual control
bits:
• Independent watchdog (IWDG): the IWDG is started by writing to its Key register or by
hardware option. Once started, it cannot be stopped except by a Reset. See
Section 44.3: IWDG functional description.
• real-time clock (RTC): this is configured by the RTCEN bit in the Backup domain
control register (RCC_BDCR)
• Internal RC oscillator (LSI): this is configured by the LSION bit in the Control/status
register (RCC_CSR).
• External 32.768 kHz oscillator (LSE): this is configured by the LSEON bit in the Backup
domain control register (RCC_BDCR).
Several peripherals can be used in Stop 0 mode and can add consumption if they are
enabled and clocked by LSI or LSE, or when they request the HSI16 clock: LPTIM1,
LPTIM2, I2Cx (x=1,2,3,4) U(S)ARTx(x=1,2...5), LPUART.
The DACx (x=1,2), the OPAMPs and the comparators can be used in Stop 0 mode, the
PVMx (x=1,2,3,4) and the PVD as well. If they are not needed, they must be disabled by
software to save their power consumptions.
The ADCx (x=1,2,3), temperature sensor and VREFBUF buffer can consume power during
the Stop 0 mode, unless they are disabled before entering this mode.
Note: The comparators outputs, the LPUART outputs and the LPTIM1 outputs are forced to low
speed (OSPEEDy=00) during the Stop 2 mode.
Refer to Table 33: Stop 2 mode for details on how to exit Stop 2 mode.
When exiting Stop 2 mode by issuing an interrupt or a wakeup event, the HSI16 oscillator is
selected as system clock if the bit STOPWUCK is set in Clock configuration register
(RCC_CFGR). The MSI oscillator is selected as system clock if the bit STOPWUCK is
cleared. The wakeup time is shorter when HSI16 is selected as wakeup system clock. The
MSI selection allows wakeup at higher frequency, up to 48 MHz.
When exiting the Stop 2 mode, the MCU is in Run mode (Range 1 or Range 2 depending on
VOS bit in PWR_CR1).
SRAM2 content is preserved). The PLL, the HSI16, the MSI and the HSE oscillators are
also switched off.
SRAM1 and register contents are lost except for registers in the Backup domain and
Standby circuitry (see Figure 9). SRAM2 content can be partially (only for STM32L4P5xx
and STM32L4Q5xx) or fully preserved depending on RRS[1:0] bits configuration in
PWR_CR3 register. In this case the Low-power regulator is ON and provides the supply to
SRAM2 only.
The BOR is always available in Standby mode. The consumption is increased when
thresholds higher than VBOR0 are used.
Refer to Table 34: Standby mode for more details on how to exit Standby mode.
When exiting Standby mode, I/O’s that were configured with pull-up or pull-down during
Standby through registers PWR_PUCRx or PWR_PDCRx will keep this configuration upon
exiting Standby mode until the bit APC of PWR_CR3 register has been cleared. Once the bit
APC is cleared, they will be either configured to their reset values or to the pull-up/pull-down
state according the GPIOx_PUPDR registers. The content of the PWR_PUCRx or
PWR_PDCRx registers however is not lost and can be re-used for a sub-sequent entering
into Standby mode.
Some I/Os (listed in Section 8.3.1: General-purpose I/O (GPIO)) are used for JTAG/SW
debug and have internal pull-up or pull-down activated after reset so will be configured at
this reset value as well when exiting Standby mode.
For IO’s, with a pull-up or pull-down pre-defined after reset (some JTAG/SW IO’s) or with
GPIOx_PUPDR programming done after exiting from Standby, in case those programming
is different from the PWR_PUCRx or PWR_PDCRx programmed value during Standby, both
a pull-down and pull-up will be applied until the bit APC is cleared, releasing the
PWR_PUCRx or PWR_PDCRx programmed value.
will be configured in floating state or to their pull-up pull-down reset value (for some I/Os
listed in Section 8.3.1: General-purpose I/O (GPIO)).
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. LPR Res. Res. Res. VOS[1:0] DBP Res. Res. Res. RRSTP Res. LPMS[2:0]
rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. USV IOSV Res. PVME4 PVME3 PVME2 PVME1 PLS[2:0] PVDE
rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DSIPD EWUP EWUP EWUP EWUP EWUP
EIWUL Res. Res. ENULP APC RRS[1:0] Res. Res. Res.
EN 5 4 3 2 1
rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
EXT_S
Res. Res. MPS_O Res. Res. Res. VBRS VBE Res. Res. Res. WP5 WP4 WP3 WP2 WP1
N
rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
EXT_S
WUFI Res. MPS_R Res. Res. Res. Res. SBF Res. Res. Res. WUF5 WUF4 WUF3 WUF2 WUF1
DY
r r r r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
REGLP REGLP
PVMO4 PVMO3 PVMO2 PVMO1 PVDO VOSF Res. Res. Res. Res. Res. Res. Res. Res.
F S
r r r r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CWUF CWUF CWUF CWUF CWUF
Res. Res. Res. Res. Res. Res. Res. CSBF Res. Res. Res.
5 4 3 2 1
w w w w w w
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PU15 Res. PU13 PU12 PU11 PU10 PU9 PU8 PU7 PU6 PU5 PU4 PU3 PU2 PU1 PU0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. PD14 Res. PD12 PD11 PD10 PD9 PD8 PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PU15 PU14 PU13 PU12 PU11 PU10 PU9 PU8 PU7 PU6 PU5 PU4 PU3 PU2 PU1 PU0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PD15 PD14 PD13 PD12 PD11 PD10 PD9 PD8 PD7 PD6 PD5 Res. PD3 PD2 PD1 PD0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PU15 PU14 PU13 PU12 PU11 PU10 PU9 PU8 PU7 PU6 PU5 PU4 PU3 PU2 PU1 PU0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PD15 PD14 PD13 PD12 PD11 PD10 PD9 PD8 PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PU15 PU14 PU13 PU12 PU11 PU10 PU9 PU8 PU7 PU6 PU5 PU4 PU3 PU2 PU1 PU0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PD15 PD14 PD13 PD12 PD11 PD10 PD9 PD8 PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PU15 PU14 PU13 PU12 PU11 PU10 PU9 PU8 PU7 PU6 PU5 PU4 PU3 PU2 PU1 PU0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PD15 PD14 PD13 PD12 PD11 PD10 PD9 PD8 PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PU15 PU14 PU13 PU12 PU11 PU10 PU9 PU8 PU7 PU6 PU5 PU4 PU3 PU2 PU1 PU0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PD15 PD14 PD13 PD12 PD11 PD10 PD9 PD8 PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PU15 PU14 PU13 PU12 PU11 PU10 PU9 PU8 PU7 PU6 PU5 PU4 PU3 PU2 PU1 PU0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PD15 PD14 PD13 PD12 PD11 PD10 PD9 PD8 PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
Bits 31:16
Reserved, must be kept at reset value.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PU15 PU14 PU13 PU12 PU11 PU10 PU9 PU8 PU7 PU6 PU5 PU4 PU3 PU2 PU1 PU0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PD15 PD14 PD13 PD12 PD11 PD10 PD9 PD8 PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. PU11 PU10 PU9 PU8 PU7 PU6 PU5 PU4 PU3 PU2 PU1 PU0
rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. PD11 PD10 PD9 PD8 PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0
rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. R1MODE Res. Res. Res. Res. Res. Res. Res. Res.
rw
0x02C
0x00C
Offset
5.4.27
236/2301
PWR_SR2
PWR_SR1
PWR_CR4
PWR_CR3
PWR_CR2
PWR_CR1
PWR_SCR
Register
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
PWR_PDCRB
PWR_PUCRB
PWR_PDCRA
PWR_PUCRA
PWR_PDCRC
PWR_PUCRC
Power control (PWR)
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 31
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 30
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 29
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 28
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 27
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 26
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 25
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 24
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 23
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 22
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 21
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 20
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 19
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 18
RM0432 Rev 6
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 17
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 16
PWR register map and reset value table
0
0
0
0
0
0
0
0
PD15 PU15 PD15 PU15 Res. PU15 Res. PVMO4 WUFI Res. EIWUL Res. Res. 15
0
0
0
0
0
0
0
PD14 PU14 PD14 PU14 PD14 Res. Res. PVMO3 Res. Res. Res. Res. LPR 14
0
0
0
0
0
0
0
0
PD13 PU13 PD13 PU13 Res. PU13 Res. PVMO2 EXT_SMPS_RDY(1) EXT_SMPS_ON(1) Res. Res. Res. 13
0
0
0
0
0
0
0
1
PD12 PU12 PD12 PU12 PD12 PU12 Res. PVMO1 Res. Res. DSIPDEN. Res. Res. 12
0
0
0
0
0
0
0
1
PD11 PU11 PD11 PU11 PD11 PU11 Res. PVDO Res. Res. Res. Res.
Table 36. PWR register map and reset values
ENULP(1) 11
0
0
0
0
0
0
0
1
0
0
PD10 PU10 PD10 PU10 PD10 PU10 Res. VOSF Res. Res. APC USV 10
[1:0]
VOS
0
0
0
0
0
0
0
0
1
0
1
PD9 PU9 PD9 PU9 PD9 PU9 Res. REGLPF Res. VBRS IOSV 9
RRS(1)
0
0
0
0
0
0
0
0
0
0
1
0
PD8 PU8 PD8 PU8 PD8 PU8 CSBF REGLPS SBF VBE Res. DBP 8
0
0
0
0
0
0
0
PD7 PU7 PD7 PU7 PD7 PU7 Res. Res. Res. Res. Res. PVME4 Res. 7
0
0
0
0
0
0
0
PD6 PU6 PD6 PU6 PD6 PU6 Res. Res. Res. Res. Res. PVME3 Res. 6
0
0
0
0
0
0
0
PD5 PU5 PD5 PU5 PD5 PU5 Res. Res. Res. Res. Res. PVME2 Res. 5
0
0
0
0
0
0
0
0
0
0
0
PD4 PU4 Res. PU4 PD4 PU4 CWUF5 Res. WUF5 WP5 EWUP5 PVME1 RRSTP 4
0
0
0
0
0
0
0
0
0
0
0
PD3 PU3 PD3 PU3 PD3 PU3 CWUF4 Res. WUF4 WP4 EWUP4 Res. 3
0
0
0
0
0
0
0
0
0
0
0
0
PD2 PU2 PD2 PU2 PD2 PU2 CWUF3 Res. WUF3 WP3 EWUP3 2
0
0
0
0
0
0
0
0
0
0
0
0
PLS [2:0]
PD1 PU1 PD1 PU1 PD1 PU1 CWUF2 Res. WUF2 WP2 EWUP2 1
[2:0]
LPMS
0
0
0
0
0
0
0
0
0
0
0
0
PD0 PU0 PD0 PU0 PD0 PU0 CWUF1 Res. WUF1 WP1 EWUP1 PVDE 0
RM0432
0x080
0x064
0x060
0x058
0x054
0x050
0x048
0x044
0x040
0x038
0x05C
0x04C
0x03C
Offset
RM0432
PWR_CR5
Register
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
PWR_PDCRI
PWR_PUCRI
PWR_PDCRF
PWR_PUCRF
PWR_PDCRE
PWR_PUCRE
PWR_PDCRH
PWR_PUCRH
PWR_PDCRD
PWR_PUCRD
PWR_PDCRG
PWR_PUCRG
Availability of peripherals.
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 31
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 30
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 29
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 28
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 27
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 26
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 25
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 24
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 23
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 22
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 21
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 20
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 19
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 18
RM0432 Rev 6
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 17
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 16
0
0
0
0
0
0
0
0
0
0
Res. Res. Res. PD15 PU15 PD15 PU15 PD15 PU15 PD15 PU15 PD15 PU15 15
0
0
0
0
0
0
0
0
0
0
Res. Res. Res. PD14 PU14 PD14 PU14 PD14 PU14 PD14 PU14 PD14 PU14 14
0
0
0
0
0
0
0
0
0
0
Res. Res. Res. PD13 PU13 PD13 PU13 PD13 PU13 PD13 PU13 PD13 PU13 13
0
0
0
0
0
0
0
0
0
0
Res. Res. Res. PD12 PU12 PD12 PU12 PD12 PU12 PD12 PU12 PD12 PU12 12
0
0
0
0
0
0
0
0
0
0
0
0
Res. PD11 PU11 PD11 PU11 PD11 PU11 PD11 PU11 PD11 PU11 PD11 PU11 11
0
0
0
0
0
0
0
0
0
0
0
0
Res. PD10 PU10 PD10 PU10 PD10 PU10 PD10 PU10 PD10 PU10 PD10 PU10 10
0
0
0
0
0
0
0
0
0
0
0
0
Res. PD9 PU9 PD9 PU9 PD9 PU9 PD9 PU9 PD9 PU9 PD9 PU9 9
0
0
0
0
0
0
0
0
0
0
0
1
0
R1MODE PD8 PU8 PD8 PU8 PD8 PU8 PD8 PU8 PD8 PU8 PD8 PU8 8
0
0
0
0
0
0
0
0
0
0
0
0
Res. PD7 PU7 PD7 PU7 PD7 PU7 PD7 PU7 PD7 PU7 PD7 PU7 7
0
0
0
0
0
0
0
0
0
0
0
0
Res. PD6 PU6 PD6 PU6 PD6 PU6 PD6 PU6 PD6 PU6 PD6 PU6 6
0
0
0
0
0
0
0
0
0
0
0
0
Res. PD5 PU5 PD5 PU5 PD5 PU5 PD5 PU5 PD5 PU5 PD5 PU5 5
0
0
0
0
0
0
0
0
0
0
0
0
Res. PD4 PU4 PD4 PU4 PD4 PU4 PD4 PU4 PD4 PU4 PD4 PU4 4
1. The availability of this bit/bitfield depends on product part numbers. For additional information refer to Section 1.4:
0
0
0
0
0
0
0
0
0
0
0
0
Res. PD3 PU3 PD3 PU3 PD3 PU3 PD3 PU3 PD3 PU3 PD3 PU3 3
0
0
0
0
0
0
0
0
0
0
0
0
Res. PD2 PU2 PD2 PD2 PD2 PU2 PD2 PU2 PD2 PU2 PD2 PU2 2
0
0
0
0
0
0
0
0
0
0
0
0
Res. PD1 PU1 PD1 PU1 PD1 PU1 PD1 PU1 PD1 PU1 PD1 PU1 1
0
0
0
0
0
0
0
0
0
0
0
0
Res. PD0 PU0 PD0 PU0 PD0 PU0 PD0 PU0 PD0 PU0 PD0 PU0 0
Power control (PWR)
237/2301
237
Reset and clock control (RCC) RM0432
6.1 Reset
There are three types of reset, defined as system reset, power reset and backup domain
reset.
VDD
VDD / VDDA
RPU
RPU System reset
External
Filter System reset
reset NRST
WWDG reset
IWDG reset
Pulse Firewall reset
generator Software reset
(min 20 μs) Low-power manager reset
Option byte loader reset
BOR reset
MSv40966V1
MS33432V1
Software reset
The SYSRESETREQ bit in Cortex®-M4 Application Interrupt and Reset Control Register
must be set to force a software reset on the device (refer to the STM32F3, STM32F4,
STM32L4 and STM32L4+ Series Cortex®-M4 (PM0214)).
1. Software reset, triggered by setting the BDRST bit in the Backup domain control
register (RCC_BDCR).
2. VDD or VBAT power on, if both supplies have previously been powered off.
A backup domain reset only affects the LSE oscillator, the RTC, the Backup registers and
the RCC Backup domain control register.
6.2 Clocks
Four different clock sources can be used to drive the system clock (SYSCLK):
• HSI16 (high speed internal)16 MHz RC oscillator clock
• MSI (multispeed internal) RC oscillator clock
• HSE oscillator clock, from 4 to 48 MHz
• PLL clock
The MSI is used as system clock source after startup from Reset, configured at 4 MHz.
The devices have the following additional clock sources:
• 32 kHz low speed internal RC (LSI RC) which drives the independent watchdog and
optionally the RTC used for Auto-wakeup from Stop and Standby modes.
• 32.768 kHz low speed external crystal (LSE crystal) which optionally drives the real-
time clock (RTCCLK).
• RC 48 MHz internal clock sources (HSI48) to potentially drive the USB FS, the
SDMMC and the RNG.
Each clock source can be switched on or off independently when it is not used, to optimize
power consumption.
Several prescalers can be used to configure the AHB frequency, the APB1 and APB2
domains. The maximum frequency of the AHB, the APB1 and the APB2 domains is
120 MHz.
All the peripheral clocks are derived from their bus clock (HCLK, PCLK1 or PCLK2) except:
• The 48 MHz clock, used for USB OTG FS, SDMMC and RNG. This clock is derived
(selected by software) from one of the four following sources:
– main PLL VCO (PLL48M1CLK)
– PLLSAI1 VCO (PLL48M2CLK)
– MSI clock
– HSI48 internal oscillator
When the MSI clock is auto-trimmed with the LSE, it can be used by the USB OTG FS
device.
When available, the HSI48 48 MHz clock can be coupled to the clock recovery system
allowing adequate clock connection for the USB OTG FS (Crystal less solution).
• The ADCs clock which is derived (selected by software) from one of the following
sources:
– system clock (SYSCLK)
– PLLSAI1 VCO (PLLADC1CLK)
• The U(S)ARTs clocks which are derived (selected by software) from one of the four
following sources:
– system clock (SYSCLK)
– HSI16 clock
– LSE clock
– APB1 or APB2 clock (PCLK1 or PCLK2 depending on which APB is mapped the
U(S)ART)
The wakeup from Stop mode is supported only when the clock is HSI16 or LSE.
• The I2Cs clocks which are derived (selected by software) from one of the three
following sources:
– system clock (SYSCLK)
– HSI16 clock
– APB1 clock (PCLK1)
The wakeup from Stop mode is supported only when the clock is HSI16.
• The SAI1 and SAI2 clocks which are derived (selected by software) from one of the
following sources:
– an external clock mapped on SAI1_EXTCLK for SAI1 and SAI2_EXTCLK for SAI2
– PLLSAI1 VCO (PLLSAI1CLK)
– PLLSAI2 VCO (PLLSAI2CLK)
– main PLL VCO (PLLSAI3CLK)
– HSI16 clock
• The DFSDM audio clock which is derived (selected by software) from one of the
following sources:
– SAI1 clock
– HSI clock
– MSI clock
• The LTDC clock. The LTDC clock is generated from a specific PLL (PLLSAI2).
• The DSI clock. To generate the DSI clocks, the high-speed external crystal (HSE) must
be available.
– The DSI lanebyteclk clock: DSI Lane byte clock (high-speed clock divided by 8)
which is output from the DSI-PHY or from a specific output of PLLSAI2 (frequency
lower than 62.5 MHz) in the case when the DSI-PHY is off.
– The DSI host rxclkesc clock. The DSI RX escape mode clock is output from DSI-
PHY (generated from DP0/DN0 even if the DSI-PHY is not clocked).
• The OctoSPI kernel clock which is derived (selected by software) from one of the
following sources:
– System clock,
– PLL48M1CLK
– MSI clock
• The low-power timers (LPTIMx) clock which are derived (selected by software) from
one of the five following sources:
– LSI clock
– LSE clock
– HSI16 clock
– APB1 clock (PCLK1)
– External clock mapped on LPTIMx_IN1
The functionality in Stop mode (including wakeup) is supported only when the clock is
LSI or LSE, or in external clock mode.
• The RTC clock which is derived (selected by software) from one of the three following
sources:
– LSE clock
– LSI clock
– HSE clock divided by 32
The functionality in Stop mode (including wakeup) is supported only when the clock is
LSI or LSE.
• The IWDG clock which is always the LSI clock.
The RCC feeds the Cortex® System Timer (SysTick) external clock with the AHB clock
(HCLK) divided by 8. The SysTick can work either with this clock or directly with the Cortex®
clock (HCLK), configurable in the SysTick Control and Status Register.
FCLK acts as Cortex®-M4 free-running clock. For more details refer to the STM32F3,
STM32F4, STM32L4 and STM32L4+ Series Cortex®-M4 programming manual (PM0214).
to IWDG
LSI RC 32 kHz
LSCO
to RTC
OSC32_OUT
LSE OSC
/32
32.768 kHz
OSC32_IN
LSE to PWR
LSI
MSI to AHB bus, core, memory and DMA
MCO HSI16
/ 1→16 HSE AHB PRESC HCLK FCLK Cortex free running clock
SYSCLK / 1,2,..512
PLLCLK to Cortex system timer
HSI48 /8
Clock
source APB1 PRESC PCLK1
control / 1,2,4,8,16 to APB1 peripherals
OSC_OUT HSE OSC
4-48 MHz
HSE x1 or x2
to TIMx
OSC_IN Clock MSI x=2..7
SYSCLK
detector HSI16 LSE
HSI16 to USARTx
SYSCLK x=2..5
HSI RC to LPUART1
16 MHz
HSI16
MSI RC SYSCLK to I2Cx
100 kHz – 48 MHz x=1,2,3,4
RC 48 MHz LSI
LSE to LPTIMx
HSI16 x=1,2
MSI
PLL HSI16 MSI
/M
HSE OCTOSPI clock
/P PLLSAI3CLK
SDMMC clock
HSI16 MSI
48 MHz clock to USB, RNG
SYSCLK
to ADC
DSIHOST
≤ 20 MHz rxclkesc clock
HSE DSI
PLL DSI - PHY ≤ 62.5 MHz
≤ 62.5 MHz DSIHOST
MSI byte lane clock
/M
PLLSAI2 HSI16
/P PLLSAI2CLK DFSDM
PLLDSICLK audio clock
/Q
PLLLCDCLK HSI16 to SAI1
/R
1. For full details about the internal and external clock source characteristics, please refer to the “Electrical
characteristics” section in your device datasheet.
2. The ADC clock can be derived from the AHB clock of the ADC bus interface, divided by a programmable
factor (1, 2 or 4). When the programmable factor is ‘1’, the AHB prescaler must be equal to ‘1’.
DSIHOST
PLLDSICLK
(from PLLSAI2/Q) Peripheral
62.5 MHz clock enable
High max DSIHOST lane byte clock
Speed 62.5 MHz
62.5 MHz max
DSI clock control bits (IDF, ODF, NDIV, TXECKDIV and TOCKDIV)
are configured by DSIHOST registers.
MSv43406V1
to IWDG
LSI RC 32 kHz
LSCO
to RTC
OSC32_OUT
LSE OSC
/32
32.768 kHz
OSC32_IN
LSE to PWR
LSI
MSI to AHB bus, core, memory and DMA
MCO HSI16
/ 1→16 HSE AHB PRESC HCLK FCLK Cortex free running clock
SYSCLK / 1,2,..512
PLLCLK to Cortex system timer
HSI48 /8
Clock
source APB1 PRESC PCLK1
control / 1,2,4,8,16 to APB1 peripherals
OSC_OUT HSE OSC
4-48 MHz
HSE x1 or x2
to TIMx
OSC_IN Clock MSI x=2..7
SYSCLK
detector HSI16 LSE
HSI16 to USARTx
SYSCLK X=2..5
HSI RC to LPUART1
16 MHz
HSI16
MSI RC SYSCLK to I2Cx
100 kHz – 48 MHz x=1,2,3,4
RC 48 MHz LSI
LSE to LPTIMx
HSI16 x=1,2
MSI
PLL HSI16 MSI
/M to OCTOSPIx
HSE
/P PLLSAI3CLK x=1,2
to SDMMCx
x=1,2
HSI16 MSI
48 MHz clock to USB, RNG
SYSCLK to ADCx
X=1,2
MSI
/M
PLLSAI2 HSI16
/P PLLSAI2CLK DFSDM
audio clock
/Q
PLLLCDCLK HSI16 to SAI1
/R
OSC_IN OSC_OUT
External clock
GPIO
External
source
OSC_IN OSC_OUT
Crystal/Ceramic
resonators
CL1 CL2
Load
capacitors
Calibration
RC oscillator frequencies can vary from one chip to another due to manufacturing process
variations, this is why each device is factory calibrated by ST for 1 % accuracy at TA=25°C.
After reset, the factory calibration value is loaded in the HSICAL[7:0] bits in the Internal
clock sources calibration register (RCC_ICSCR).
If the application is subject to voltage or temperature variations this may affect the RC
oscillator speed. You can trim the HSI16 frequency in the application using the
HSITRIM[6:0] in the Internal clock sources calibration register (RCC_ICSCR).
For more details on how to measure the HSI16 frequency variation, refer to Section 6.2.17:
Internal/external clock measurement with TIM15/TIM16/TIM17.
The HSIRDY flag in the Clock control register (RCC_CR) indicates if the HSI16 RC is stable
or not. At startup, the HSI16 RC output clock is not released until this bit is set by hardware.
The HSI16 RC can be switched on and off using the HSION bit in the Clock control register
(RCC_CR).
The HSI16 signal can also be used as a backup source (Auxiliary clock) if the HSE crystal
oscillator fails. Refer to Section 6.2.10: Clock security system (CSS) on page 252.
Software calibration
The MSI RC oscillator frequency can vary from one chip to another due to manufacturing
process variations, this is why each device is factory calibrated by ST for 1 % accuracy at an
ambient temperature, TA, of 25 °C. After reset, the factory calibration value is loaded in the
MSICAL[7:0] bits in the Internal clock sources calibration register (RCC_ICSCR). If the
application is subject to voltage or temperature variations, this may affect the RC oscillator
speed. You can trim the MSI frequency in the application by using the MSITRIM[7:0] bits in
the RCC_ICSCR register. For more details on how to measure the MSI frequency variation
please refer to Section 6.2.17: Internal/external clock measurement with
TIM15/TIM16/TIM17.
can use the USB SOF signal, the LSE or an external signal to automatically and quickly
adjust the oscillator frequency on-fly. It is disabled as soon as the system enters Stop or
Standby mode. When the CRS is not used, the HSI48 RC oscillator runs on its default
frequency which is subject to manufacturing process variations.
For more details on how to configure and use the CRS peripheral please refer to Section 7:
Clock recovery system (CRS).
The HSI48RDY flag in the Clock recovery RC register (RCC_CRRCR) indicates whether the
HSI48 RC oscillator is stable or not. At startup, the HSI48 RC oscillator output clock is not
released until this bit is set by hardware.
The HSI48 can be switched on and off using the HSI48ON bit in the Clock recovery RC
register (RCC_CRRCR).
6.2.5 PLL
The device embeds 3 PLLs: PLL, PLLSAI1, PLLSAI2. Each PLL provides up to three
independent outputs. The internal PLLs can be used to multiply the HSI16, HSE or MSI
output clock frequency. The PLLs input frequency must be between 4 and 16 MHz. The
selected clock source is divided by a programmable factor PLLM from 1 to 8 to provide a
clock frequency in the requested input range. Refer to Figure 16: Clock tree for
STM32L4Rxxx and STM32L4Sxxx devicesand PLL configuration register
(RCC_PLLCFGR).
The PLLs configuration (selection of the input clock and multiplication factor) must be done
before enabling the PLL. Once the PLL is enabled, these parameters cannot be changed.
To modify the PLL configuration, proceed as follows:
1. Disable the PLL by setting PLLON to 0 in Clock control register (RCC_CR).
2. Wait until PLLRDY is cleared. The PLL is now fully stopped.
3. Change the desired parameter.
4. Enable the PLL again by setting PLLON to 1.
5. Enable the desired PLL outputs by configuring PLLPEN, PLLQEN, PLLREN in PLL
configuration register (RCC_PLLCFGR).
An interrupt can be generated when the PLL is ready, if enabled in the Clock interrupt
enable register (RCC_CIER).
The same procedure is applied for changing the configuration of the PLLSAI1 or PLLSAI2:
1. Disable the PLLSAI1/PLLSAI2 by setting PLLSAI1ON/PLLSAI2ON to 0 in Clock control
register (RCC_CR).
2. Wait until PLLSAI1RDY/PLLSAI2RDY is cleared. The PLLSAI1/PLLSAI2 is now fully
stopped.
3. Change the desired parameter.
4. Enable the PLLSAI1/PLLSAI2 again by setting PLLSAI1ON/PLLSAI2ON to 1.
5. Enable the desired PLL outputs by configuring PLLSAI1PEN/PLLSAI2PEN,
PLLSAI1QEN/PLLSAI2QEN, PLLSAI1REN/PLLSAI2REN in PLLSAI1 configuration
register (RCC_PLLSAI1CFGR) and PLLSAI2 configuration register
(RCC_PLLSAI2CFGR).
The PLL output frequency must not exceed 120 MHz.
The enable bit of each PLL output clock (PLLPEN, PLLQEN, PLLREN, PLLSAI1PEN,
PLLSAI1QEN, PLLSAI1REN, PLLSAI2PEN and PLLSAI2REN) can be modified at any time
without stopping the corresponding PLL. PLLREN cannot be cleared if PLLCLK is used as
system clock.
Distribution of the external 32 kHz clock (LSE) outside the RTC block could be disabled by
setting LSESYSDIS bit in Backup domain control register (RCC_BDCR) to reduce power
consumption. Propagation is stopped regardless the use of LSE by other peripherals. This
feature is present only on STM32L4P5xx and STM32L4Q5xx devices.
TIM 15
TI1_RMP
GPIO TI1
LSE
MS33433V1
The input capture channel of the Timer 15 can be a GPIO line or an internal clock of the
MCU. This selection is performed through the TI1_RMP bit in the TIM15_OR register. The
possibilities are the following ones:
• TIM15 Channel1 is connected to the GPIO. Refer to the alternate function mapping in
the device datasheets.
• TIM15 Channel1 is connected to the LSE.
TIM16
TI1_RMP[1:0]
GPIO
LSI
LSE TI1
RTC wakeup interrupt
MSI
HSE/32
MCO
NC
MSv63428V1
The input capture channel of the Timer 16 can be a GPIO line or an internal clock of the
MCU. This selection is performed through the TI1_RMP[1:0] bits in the TIM16_OR register.
The possibilities are the following ones:
• TIM16 Channel1 is connected to the GPIO. Refer to the alternate function mapping in
the device datasheets.
• TIM16 Channel1 is connected to the LSI clock.
• TIM16 Channel1 is connected to the LSE clock.
• TIM16 Channel1 is connected to the RTC wakeup interrupt signal. In this case the RTC
interrupt should be enabled.
• TIM16 Channel1 is connected to the MSI clock.
• TIM16 Channel1 is connected to the HSE/32 clock.
• TIM16 Channel1 is connected to the MCO clock.
TIM17
TI1_RMP[1:0]
GPIO
TI1
MSI
HSE/32
MCO
MS33435V1
The input capture channel of the Timer 17 can be a GPIO line or an internal clock of the
MCU. This selection is performed through the TI1_RMP[1:0] bits in the TIM17_OR register.
The possibilities are the following ones:
• TIM17 Channel1 is connected to the GPIO. Refer to the alternate function mapping in
the device datasheets.
• TIM17 Channel1 is connected to the MSI Clock.
• TIM17 Channel1 is connected to the HSE/32 Clock.
• TIM17 Channel1 is connected to the microcontroller clock output (MCO), this selection
is controlled by the MCOSEL[3:0] bits of the Clock configuration register (RCC_CFGR).
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PLLSAI PLLSAI PLLSAI PLLSAI PLLRD CSS HSE HSE HSE
Res. Res. PLLON Res. Res. Res. Res.
2RDY 2ON 1RDY 1ON Y ON BYP RDY ON
r rw r rw r rw rs rw r rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
HSIAS HSIRD HSIKER MSIRG MSIPL MSI
Res. Res. Res. Res. HSION MSIRANGE[3:0] MSION
FS Y ON SEL LEN RDY
rw r rw rw rw rw rw rw rs rw r rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. HSITRIM[6:0] HSICAL[7:0]
rw rw rw rw rw rw rw r r r r r r r r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
MSITRIM[7:0] MSICAL[7:0]
rw rw rw rw rw rw rw rw r r r r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. MCOPRE[2:0] MCOSEL[3:0] Res. Res. Res. Res. Res. Res. Res. Res.
rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
STOP
Res. PPRE2[2:0] PPRE1[2:0] HPRE[3:0] SWS[1:0] SW[1:0]
WUCK
rw rw rw rw rw rw rw rw rw rw rw r r rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PLLRE PLLQE PLLPE
PLLPDIV[4:0] PLLR[1:0] Res. PLLQ[1:0] Res. Res. PLLP
N N N
rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. PLLN[6:0] PLLM[3:0] Res. Res. PLLSRC[1:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw
Bits 22:21 PLLQ[1:0]: Main PLL division factor for PLL48M1CLK (48 MHz clock).
Set and cleared by software to control the frequency of the main PLL output clock
PLL48M1CLK. This output can be selected for USB, RNG, SDMMC (48 MHz clock). These
bits can be written only if PLL is disabled.
PLL48M1CLK output clock frequency = VCO frequency / PLLQ with PLLQ = 2, 4, 6, or 8
00: PLLQ = 2
01: PLLQ = 4
10: PLLQ = 6
11: PLLQ = 8
Caution: The software has to set these bits correctly not to exceed 120 MHz on
this domain.
Bit 20 PLLQEN: Main PLL PLL48M1CLK output enable
Set and reset by software to enable the PLL48M1CLK output of the main PLL.
In order to save power, when the PLL48M1CLK output of the PLL is not used, the value of
PLLQEN should be 0.
0: PLL48M1CLK output disable
1: PLL48M1CLK output enable
Bits 19:18 Reserved, must be kept at reset value.
Bit 17 PLLP: Main PLL division factor for PLLSAI3CLK (SAI1 and SAI2 clock) or SDMMC clock.
Set and cleared by software to control the frequency of the main PLL output clock
PLLSAI3CLK. This output can be selected for SAI1 or SAI2 or SDMMC. These bits can be
written only if PLL is disabled.
When the PLLPDIV[4:0] is set to “00000”PLLSAI3CLK output clock frequency = VCO
frequency / PLLP with PLLP =7, or 17
0: PLLP = 7
1: PLLP = 17
Caution: The software has to set these bits correctly not to exceed 120 MHz on
this domain.
Bit 16 PLLPEN: Main PLL PLLSAI3CLK output enable
Set and reset by software to enable the PLLSAI3CLK output of the main PLL.
In order to save power, when the PLLSAI3CLK output of the PLL is not used, the value of
PLLPEN should be 0.
0: PLLSAI3CLK output disable
1: PLLSAI3CLK output enable
Bit 15 Reserved, must be kept at reset value.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PLLSAI PLLSAI PLLSAI PLLSAI
PLLSAI1PDIV[4:0] PLLSAI1R[1:0] Res. PLLSAI1Q[1:0] Res. Res.
1REN 1QEN 1P 1PEN
rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. PLLSAI1N[6:0] PLLSAI1M[3:0] Res. Res. Res. Res.
rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PLLSAI PLLSAI PLLSAI PLLSAI
PLLSAI2PDIV[4:0] PLLSAI2R[1:0] Res. PLLSAI2Q Res. Res.
2REN 2QEN 2P 2PEN
rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. PLLSAI2N[6:0] PLLSAI2M[3:0] Res. Res. Res. Res.
rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PLLSAI PLLSAI
HSI48 LSECS PLL HSE HSI MSI LSE LSI
Res. Res. Res. Res. Res. Res. 2RDYI 1RDYI
RDYIE SIE RDYIE RDYIE RDYIE RDYIE RDYIE RDYIE
E E
rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
HSI48 LSECS PLLSAI PLLSAI PLL HSE HSI MSI LSE LSI
Res. Res. Res. Res. Res. CSSF
RDYF SF 2RDYF 1RDYF RDYF RDYF RDYF RDYF RDYF RDYF
r r r r r r r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
HSI48 LSECS PLLSAI PLLSAI PLL HSER HSIRD MSIRD LSERD LSIRDY
Res. Res. Res. Res. Res. CSSC
RDYC SC 2RDYC 1RDYC RDYC DYC YC YC YC C
w w w w w w w w w w
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
GFXMM DMA2 TSCR
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
URST DRST ST
rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CRCR FLASH DMAMU DMA2 DMA1
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
ST RST X1RST RST RST
rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
SDMM SDMM OSPIM RNGR HASH AESR
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
C2RST C1RST RST ST RST ST
rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PKAR ADCR OTGFS GPIOIR GPIOH GPIOG GPIOF GPIOE GPIOD GPIOC GPIOB GPIOA
DCMIRST Res. Res. Res.
ST ST RST ST RST RST RST RST RST RST RST RST
rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OSPI2 OSPI1R FMCR
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
RST ST ST
rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
LPTIM1 OPAMP DAC1 PWRR CAN1R CRSRS I2C3R I2C2R I2C1R UART5 UART4 USART3 USART2
Res. Res. Res.
RST RST RST ST ST T ST ST ST RST RST RST RST
rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SPI3RS SPI2RS TIM7R TIM6R TIM5R TIM4RS TIM3RS TIM2R
Res. Res. Res. Res. Res. Res. Res. Res.
T T ST ST ST T T ST
rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LPTIM2 I2C4 LPUART
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
RST RST 1RST
rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DSIRS LTDCR DFSD SAI2R SAI1R TIM17 TIM16 TIM15
Res. Res. Res. Res. Res. Res. Res. Res.
T ST M1RST ST ST RST RST RST
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
USART TIM8R SPI1R TIM1R SYSCF
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
1RST ST ST ST GRST
rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
GFXM DMA2D TSCE
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
MUEN EN N
rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
FLASH DMAM DMA2E DMA1
Res. Res. Res. CRCEN Res. Res. Res. Res. Res. Res. Res. Res.
EN UX1EN N EN
rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
SDMM SDMM OSPIM RNG HASHE
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. AESEN
C2EN C1EN EN EN N
rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DCMIE OTGFS GPIOIE GPIOH GPIOG GPIOF GPIOE GPIOD GPIOC GPIOB GPIOA
PKAEN ADCEN Res. Res. Res.
N EN N EN EN EN EN EN EN EN EN
rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OSPI2 OSPI1E FMCE
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
EN N N
rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
LPTIM1 OPAMP DAC1 PWRE CAN1E I2C3E I2C2E I2C1E UART5E UART4E USART3 USART2
Res. Res. CRSEN Res.
EN EN EN N N N N N N N EN EN
rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
WWD RTCA TIM7E TIM2E
SPI3EN SPI2EN Res. Res. Res. Res. Res. Res. TIM6EN TIM5EN TIM4EN TIM3EN
GEN PBEN N N
rw rw rs rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LPTIM2 LPUAR
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. I2C4EN
EN T1EN
rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
LTDCE DFSD SAI2E SAI1E TIM17E TIM16E TIM15E
Res. Res. Res. Res. DSIEN Res. Res. Res. Res.
N M1EN N N N N N
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
USART TIM8E SPI1E TIM1E SYSCF
Res. Res. Res. Res. FWEN Res. Res. Res. Res. Res. Res.
1EN N N N GEN
rw rw rw rw rs rw
6.4.22 AHB1 peripheral clocks enable in Sleep and Stop modes register
(RCC_AHB1SMENR)
Address offset: 0x68
Reset value: 0x0007 1307
Access: no wait state, word, half-word and byte access
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
GFXM
DMA2D TSCS
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. MUSM
SMEN MEN
EN
rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DMAM
SRAM1 FLASH DMA2S DMA1
Res. Res. Res. CRCSMEN Res. Res. Res. Res. Res. Res. Res. UX1S
SMEN SMEN MEN SMEN
MEN
rw rw rw rw rw
Bit 2 DMAMUX1SMEN: DMAMUX1 clock enable during Sleep and Stop modes.
Set and cleared by software.
0: DMAMUX1 clocks disabled by the clock gating(1) during Sleep and Stop modes
1: DMAMUX1 clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 1 DMA2SMEN: DMA2 clocks enable during Sleep and Stop modes
Set and cleared by software during Sleep mode.
0: DMA2 clocks disabled by the clock gating(1) during Sleep and Stop modes
1: DMA2 clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 0 DMA1SMEN: DMA1 clocks enable during Sleep and Stop modes
Set and cleared by software.
0: DMA1 clocks disabled by the clock gating(1) during Sleep and Stop modes
1: DMA1 clocks enabled by the clock gating(1) during Sleep and Stop modes
1. This register only configures the clock gating, not the clock source itself. Most of the peripherals are clocked by a single
clock (AHB or APB clock), which is always disabled in Stop mode. In this case setting the bit has no effect in Stop mode.
6.4.23 AHB2 peripheral clocks enable in Sleep and Stop modes register
(RCC_AHB2SMENR)
Address offset: 0x6C
Reset value: 0x0057 77FF
Access: no wait state, word, half-word and byte access
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
SDMM SDMM
OSPIM RNGS HASHS AESSM
Res. Res. Res. Res. Res. Res. Res. Res. C2SME C1SME Res. Res.
SMEN MEN MEN EN
N N
rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PKASM DCMIS ADCS OTGFS SRAM3 SRAM2 GPIOIS GPIOH GPIOG GPIOF GPIOE GPIOD GPIOC GPIOB GPIOA
Res.
EN MEN MEN SMEN SMEN SMEN MEN SMEN SMEN SMEN SMEN SMEN SMEN SMEN SMEN
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
Bit 18 RNGSMEN: Random Number Generator clocks enable during Sleep and Stop modes
Set and cleared by software.
0: Random Number Generator clocks disabled by the clock gating during Sleep and Stop
modes
1: Random Number Generator clocks enabled by the clock gating during Sleep and Stop
modes
Bit 17 HASHSMEN: HASH clock enable during Sleep and Stop modes
Set and cleared by software
0: HASH clocks disabled by the clock gating(1) during Sleep and Stop modes
1: HASH clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 16 AESSMEN: AES accelerator clocks enable during Sleep and Stop modes
Set and cleared by software.
0: AES clocks disabled by the clock gating(1) during Sleep and Stop modes
1: AES clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 15 PKASMEN: PKA clocks enable during Sleep and Stop modes
Set and cleared by software.
0: PKA clocks disabled by the clock gating(1) during Sleep and Stop modes
1: PKA clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 14 DCMISMEN: DCMI or PSSI clock enable during Sleep and Stop modes. (DCMI or PSSI
depending on which interface is active)
Set and cleared by software
0: DCMI/PSSI clocks disabled by the clock gating(1) during Sleep and Stop modes
1: DCMI/PSSI clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 13 ADCSMEN: ADC clocks enable during Sleep and Stop modes
Set and cleared by software.
0: ADC clocks disabled by the clock gating(1) during Sleep and Stop modes
1: ADC clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 12 OTGFSSMEN: OTG full speed clocks enable during Sleep and Stop modes
Set and cleared by software.
0: USB OTG full speed clocks disabled by the clock gating(1) during Sleep and Stop modes
1: USB OTG full speed clocks enabled by the clock gating(1) during Sleep and Stop modes
Bits 11 Reserved, must be kept at reset value.
Bit 10 SRAM3SMEN: SRAM2 interface clocks enable during Sleep and Stop modes
Set and cleared by software.
0: SRAM3 interface clocks disabled by the clock gating(1) during Sleep and Stop modes
1: SRAM3 interface clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 9 SRAM2SMEN: SRAM2 interface clocks enable during Sleep and Stop modes
Set and cleared by software.
0: SRAM2 interface clocks disabled by the clock gating(1) during Sleep and Stop modes
1: SRAM2 interface clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 8 GPIOISMEN: IO port I clocks enable during Sleep and Stop modes
Set and cleared by software
0: IO port I clocks disabled by the clock gating(1) during Sleep and Stop modes
1: IO port I clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 7 GPIOHSMEN: IO port H clocks enable during Sleep and Stop modes
Set and cleared by software.
0: IO port H clocks disabled by the clock gating(1) during Sleep and Stop modes
1: IO port H clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 6 GPIOGSMEN: IO port G clocks enable during Sleep and Stop modes
Set and cleared by software.
0: IO port G clocks disabled by the clock gating(1) during Sleep and Stop modes
1: IO port G clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 5 GPIOFSMEN: IO port F clocks enable during Sleep and Stop modes
Set and cleared by software.
0: IO port F clocks disabled by the clock gating(1) during Sleep and Stop modes
1: IO port F clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 4 GPIOESMEN: IO port E clocks enable during Sleep and Stop modes
Set and cleared by software.
0: IO port E clocks disabled by the clock gating(1) during Sleep and Stop modes
1: IO port E clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 3 GPIODSMEN: IO port D clocks enable during Sleep and Stop modes
Set and cleared by software.
0: IO port D clocks disabled by the clock gating(1) during Sleep and Stop modes
1: IO port D clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 2 GPIOCSMEN: IO port C clocks enable during Sleep and Stop modes
Set and cleared by software.
0: IO port C clocks disabled by the clock gating(1) during Sleep and Stop modes
1: IO port C clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 1 GPIOBSMEN: IO port B clocks enable during Sleep and Stop modes
Set and cleared by software.
0: IO port B clocks disabled by the clock gating(1) during Sleep and Stop modes
1: IO port B clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 0 GPIOASMEN: IO port A clocks enable during Sleep and Stop modes
Set and cleared by software.
0: IO port A clocks disabled by the clock gating(1) during Sleep and Stop modes
1: IO port A clocks enabled by the clock gating(1) during Sleep and Stop modes
1. This register only configures the clock gating, not the clock source itself. Most of the peripherals are clocked by a single
clock (AHB or APB clock), which is always disabled in Stop mode. In this case setting the bit has no effect in Stop mode.
6.4.24 AHB3 peripheral clocks enable in Sleep and Stop modes register
(RCC_AHB3SMENR)
Address offset: 0x70
Reset value: 0x00000 0301
Access: no wait state, word, half-word and byte access
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OCTOS OSPI1S FMCS
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
PI2 MEN MEN
rw rw rw
6.4.25 APB1 peripheral clocks enable in Sleep and Stop modes register 1
(RCC_APB1SMENR1)
Address: 0x78
Reset value: 0xF3FECC3F
Access: no wait state, word, half-word and byte access
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
LPTIM1 OPAMP DAC1 PWRS CAN1S CRSS I2C3S I2C2S I2C1S UART5S UART4S USART3 USART2
Res. Res. Res.
SMEN SMEN SMEN MEN MEN MEN MEN MEN MEN MEN MEN SMEN SMEN
rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RTCA
SPI3S SPI2S WWDG TIM7S TIM6SM TIM5SM TIM4SM TIM3SM TIM2S
Res. Res. PBSM Res. Res. Res. Res.
MEN MEN SMEN MEN EN EN EN EN MEN
EN
rw rw rw rw rw rw rw rw rw rw
Bit 31 LPTIM1SMEN: Low power timer 1 clocks enable during Sleep and Stop modes
Set and cleared by software.
0: LPTIM1 clocks disabled by the clock gating(1) during Sleep and Stop modes
1: LPTIM1 clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 30 OPAMPSMEN: OPAMP interface clocks enable during Sleep and Stop modes
Set and cleared by software.
0: OPAMP interface clocks disabled by the clock gating(1) during Sleep and Stop modes
1: OPAMP interface clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 29 DAC1SMEN: DAC1 interface clocks enable during Sleep and Stop modes
Set and cleared by software.
0: DAC1 interface clocks disabled by the clock gating(1) during Sleep and Stop modes
1: DAC1 interface clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 28 PWRSMEN: Power interface clocks enable during Sleep and Stop modes
Set and cleared by software.
0: Power interface clocks disabled by the clock gating(1) during Sleep and Stop modes
1: Power interface clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 27 Reserved, must be kept at reset value.
Bit 25 CAN1SMEN: CAN1 clocks enable during Sleep and Stop modes
Set and cleared by software.
0: CAN1 clocks disabled by the clock gating(1) during Sleep and Stop modes
1: CAN1 clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 24 CRSSMEN: CRS clock enable during Sleep and Stop modes
Set and cleared by software.
0: CRS clocks disabled by the clock gating(1) during Sleep and Stop modes
1: CRS clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 23 I2C3SMEN: I2C3 clocks enable during Sleep and Stop modes
Set and cleared by software.
0: I2C3 clocks disabled by the clock gating(1) during Sleep and Stop modes
1: I2C3 clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 22 I2C2SMEN: I2C2 clocks enable during Sleep and Stop modes
Set and cleared by software.
0: I2C2 clocks disabled by the clock gating(1) during Sleep and Stop modes
1: I2C2 clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 21 I2C1SMEN: I2C1 clocks enable during Sleep and Stop modes
Set and cleared by software.
0: I2C1 clocks disabled by the clock gating(1) during Sleep and Stop modes
1: I2C1 clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 20 UART5SMEN: UART5 clocks enable during Sleep and Stop modes
Set and cleared by software.
0: UART5 clocks disabled by the clock gating(1) during Sleep and Stop modes
1: UART5 clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 19 UART4SMEN: UART4 clocks enable during Sleep and Stop modes
Set and cleared by software.
0: UART4 clocks disabled by the clock gating(1) during Sleep and Stop modes
1: UART4 clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 18 USART3SMEN: USART3 clocks enable during Sleep and Stop modes
Set and cleared by software.
0: USART3 clocks disabled by the clock gating(1) during Sleep and Stop modes
1: USART3 clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 17 USART2SMEN: USART2 clocks enable during Sleep and Stop modes
Set and cleared by software.
0: USART2 clocks disabled by the clock gating(1) during Sleep and Stop modes
1: USART2 clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 16 Reserved, must be kept at reset value.
Bit 15 SPI3SMEN: SPI3 clocks enable during Sleep and Stop modes
Set and cleared by software.
0: SPI3 clocks disabled by the clock gating(1) during Sleep and Stop modes
1: SPI3 clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 14 SPI2SMEN: SPI2 clocks enable during Sleep and Stop modes
Set and cleared by software.
0: SPI2 clocks disabled by the clock gating(1) during Sleep and Stop modes
1: SPI2 clocks enabled by the clock gating(1) during Sleep and Stop modes
Bits 13:12 Reserved, must be kept at reset value.
Bit 11 WWDGSMEN: Window watchdog clocks enable during Sleep and Stop modes
Set and cleared by software. This bit is forced to ‘1’ by hardware when the hardware WWDG
option is activated.
0: Window watchdog clocks disabled by the clock gating(1) during Sleep and Stop modes
1: Window watchdog clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 10 RTCAPBSMEN: RTC APB clock enable during Sleep and Stop modes
Set and cleared by software
0: RTC APB clock disabled by the clock gating(1) during Sleep and Stop modes
1: RTC APB clock enabled by the clock gating(1) during Sleep and Stop modes
Bits :6 Reserved, must be kept at reset value.
Bit 5 TIM7SMEN: TIM7 timer clocks enable during Sleep and Stop modes
Set and cleared by software.
0: TIM7 clocks disabled by the clock gating(1) during Sleep and Stop modes
1: TIM7 clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 4 TIM6SMEN: TIM6 timer clocks enable during Sleep and Stop modes
Set and cleared by software.
0: TIM6 clocks disabled by the clock gating(1) during Sleep and Stop modes
1: TIM6 clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 3 TIM5SMEN: TIM5 timer clocks enable during Sleep and Stop modes
Set and cleared by software.
0: TIM5 clocks disabled by the clock gating(1) during Sleep and Stop modes
1: TIM5 clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 2 TIM4SMEN: TIM4 timer clocks enable during Sleep and Stop modes
Set and cleared by software.
0: TIM4 clocks disabled by the clock gating(1) during Sleep and Stop modes
1: TIM4 clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 1 TIM3SMEN: TIM3 timer clocks enable during Sleep and Stop modes
Set and cleared by software.
0: TIM3 clocks disabled by the clock gating(1) during Sleep and Stop modes
1: TIM3 clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 0 TIM2SMEN: TIM2 timer clocks enable during Sleep and Stop modes
Set and cleared by software.
0: TIM2 clocks disabled by the clock gating(1) during Sleep and Stop modes
1: TIM2 clocks enabled by the clock gating(1) during Sleep and Stop modes
1. This register only configures the clock gating, not the clock source itself. Most of the peripherals are clocked by a single
clock (AHB or APB clock), which is always disabled in Stop mode. In this case setting the bit has no effect in Stop mode.
6.4.26 APB1 peripheral clocks enable in Sleep and Stop modes register 2
(RCC_APB1SMENR2)
Address offset: 0x7C
Reset value: 0x0000 0023
Access: no wait state, word, half-word and byte access
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LPTIM I2C4S LPUART
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
2SMEN MEN 1SMEN
rw rw rw
6.4.27 APB2 peripheral clocks enable in Sleep and Stop modes register
(RCC_APB2SMENR)
Address: 0x80
Reset value: 0x0D67 7801
Access: word, half-word and byte access
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DFSD
.DSISM LTDCS SAI2S SAI1S TIM17S TIM16S TIM15S
Res. Res. Res. Res. Res. M1SM Res. Res. Res.
EN MEN MEN MEN MEN MEN MEN
EN
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SYSCF
USART TIM8S SPI1S TIM1S
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. GSME
1SMEN MEN MEN MEN
N
rw rw rw rw rw
Bit 17 TIM16SMEN: TIM16 timer clocks enable during Sleep and Stop modes
Set and cleared by software.
0: TIM16 timer clocks disabled by the clock gating(1) during Sleep and Stop modes
1: TIM16 timer clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 16 TIM15SMEN: TIM15 timer clocks enable during Sleep and Stop modes
Set and cleared by software.
0: TIM15 timer clocks disabled by the clock gating(1) during Sleep and Stop modes
1: TIM15 timer clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 15 Reserved, must be kept at reset value.
Bit 14 USART1SMEN: USART1clocks enable during Sleep and Stop modes
Set and cleared by software.
0: USART1clocks disabled by the clock gating(1) during Sleep and Stop modes
1: USART1clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 13 TIM8SMEN: TIM8 timer clocks enable during Sleep and Stop modes
Set and cleared by software.
0: TIM8 timer clocks disabled by the clock gating(1) during Sleep and Stop modes
1: TIM8 timer clocks enabled by the clock gating(1) during Sleep and Stop modes
Bit 12 SPI1SMEN: SPI1 clocks enable during Sleep and Stop modes
Set and cleared by software.
0: SPI1 clocks disabled by the clock gating during(1) Sleep and Stop modes
1: SPI1 clocks enabled by the clock gating during(1) Sleep and Stop modes
Bit 11 TIM1SMEN: TIM1 timer clocks enable during Sleep and Stop modes
Set and cleared by software.
0: TIM1 timer clocks disabled by the clock gating(1) during Sleep and Stop modes
1: TIM1P timer clocks enabled by the clock gating(1) during Sleep and Stop modes
Bits 10:1 Reserved, must be kept at reset value.
Bit 0 SYSCFGSMEN: SYSCFG + COMP + VREFBUF clocks enable during Sleep and Stop modes
Set and cleared by software.
0: SYSCFG + COMP + VREFBUF clocks disabled by the clock gating(1) during Sleep and
Stop modes
1: SYSCFG + COMP + VREFBUF clocks enabled by the clock gating(1) during Sleep and
Stop modes
1. This register only configures the clock gating, not the clock source itself. Most of the peripherals are clocked by a single
clock (AHB or APB clock), which is always disabled in Stop mode. In this case setting the bit has no effect in Stop mode.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. ADCSEL[1:0] CLK48SEL[1:0] Res. LPTIM2SEL[1:0] LPTIM1SEL[1:0 I2C3SEL[1:0]
rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LPUART1SEL[1: USART3SEL[1:0 USART1SEL[1:0
I2C2SEL[1:0] I2C1SEL[1:0] UART5SEL[1:0] UART4SEL[1:0] USART2SEL[1:0]
0] ] ]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
LSCOS LSCOE
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. BDRST
EL N
rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RTC LSESY LSE LSE LSE LSE
Res. Res. Res. Res. Res. RTCSEL[1:0] LSEDRV[1:0] LSEON
EN SDIS CSSD CSSON BYP RDY
rw rw rw rw r rw rw rw rw r rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
LPWR WWDG IWWG SFTRS BORR PINRS OBLRS FWRST
RMVF Res. Res. Res. Res. Res. Res. Res.
RSTF RSTF RSTF TF STF TF TF F
r r r r r r r r rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LSIPR
Res. Res. Res. Res. MSISRANGE[3:0] Res. Res. Res. Res. Res. LSIRDY LSION
EDIV
rw rw rw rw rw r rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
HSI48R HSI48O
HSI48CAL[8:0] Res. Res. Res. Res. Res.
DY N
r r r r r r r r r r rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PLLSAI2DIVR[1:
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. OSPISEL[1:0] Res. Res.
0]
rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SDMMC DSISE ADFSDMSEL[1: DFSD
Res. Res. Res. SAI2SEL[2:0] SAI1SEL[2:0] I2C4SEL[1:0]
SEL L 0] MSEL
rw rw rw rw rw rw rw
Bits 4:3 ADFSDMSEL: Digital filter for sigma delta modulator audio clock source selection
Set and reset by software.
00: SAI1clock selected as DFSDM audio clock
01: HSI clock selected as DFSDM audio clock
10: MSI clock selected as DFSDM audio clock
11: reserved
Bit 2 DFSDMSEL: Digital filter for sigma delta modulator kernel clock source selection
Set and reset by software.
0: APB2 clock (PCLK2) selected as DFSDM kernel clock
1: System clock selected as DFSDM kernel clock
Bits 1:0 I2C4SEL[1:0]: I2C4 clock source selection
These bits are set and cleared by software to select the I2C4 clock source.
00: PCLK selected as I2C4 clock
01: System clock (SYSCLK) selected as I2C4 clock
10: HSI16 clock selected as I2C4 clock
11: reserved
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. OCTOSPI2_DLY OCTOSPI1_DLY
rw rw rw rw rw rw rw rw
10
11
9
8
7
6
5
4
3
2
1
0
set
PLLSAI2RDY
PLLSAI1RDY
PLLSAI2ON
PLLSAI1ON
HSIKERON
MSIRGSEL
MSIPLLEN
HSIASFS
HSERDY
MSIRANG
HSEBYP
PLLRDY
MSIRDY
HSIRDY
CSSON
HSEON
PLLON
MSION
HSION
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
RCC_CR E
0x00 [3:0]
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 1
Res.
Reset value 1 0 0 0 0 0 0 x x x x x x x x 0 0 0 0 0 0 0 0 x x x x x x x x
STOPWUCK
MCOP
MCOSEL PPRE2 PPRE1 SWS SW
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
PLL PLL
PLLQEN
PLLREN
PLLPEN
Res.
Res.
Res.
Res.
Res.
PLLPDIV[4:0] Q SRC
0x0C CFGR [1:0] [6:0] [3:0]
[1:0] [1:0]
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
0x28
0x20
0x18
0x14
0x10
0x2C
0x1C
RM0432
RCC_
RCC_
RCC_
RCC_
CFGR
CFGR
PLLSAI2
PLLSAI1
Register
RCC_CIFR
RCC_CIER
RCC_CICR
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
AHB2RSTR
AHB1RSTR
Res. Res. Res. Res. Res. 31
Res. Res. Res. Res. Res. 30
V
V
[4:0]
[4:0]
PLLSAI2PDI
PLLSAI1PDI
PLL
PLL
[1:0]
[1:0]
SAI2
SAI1
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0
SDMMC1RST Res. Res. Res. Res. 22
PLLSAI2Q[1:0]
Q
PLL
[1:0]
SAI1
0
OSPIMRST Res. Res. Res. Res. PLLSAI2QEN PLLSAI1QEN 20
Res. Res. Res. Res. Res. Res. Res. 19
RNGRST. GFXMMURST Res. Res. Res. Res. Res. 18
RM0432 Rev 6
HASHRST DMA2DRST Res. Res. Res. PLLSAI2P PLLSAI1P 17
0 0
0 0
0 0 0
AESRST. TSCRST. Res. Res. Res. PLLSAI2PEN PLLSAI1PEN 16
PKARST Res. Res. Res. Res. Res. Res. 15
DCMIRST Res. Res. Res. Res. 14
ADCRST. Res. Res. Res. Res. 13
0 0 0 0 0 0 0
0
OTGFSRST CRCRST. Res. Res. Res. 12
Res. Res. Res. Res. Res. 11
[6:0]
[6:0]
0 0
0
GPIOIRST FLASHRST. CSSC CSSF Res. 8
GPIOHRST Res. PLLSAI2RDYC PLLSAI2RDYF PLLSAI2RDYIE 7
GPIOGRST Res. PLLSAI1RDYC PLLSAI1RDYF PLLSAI1RDYIE 6
[3:0]
[3:0]
PLLSAI2M
PLLSAI1M
0 0 0 0 0 0 0 0 0
0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
Reset and clock control (RCC)
317/2301
GPIOARST DMA1RST LSIRDYC LSIRDYF LSIRDYIE Res. Res. 0
320
set
Off-
0x58
0x50
0x48
0x40
0x30
0x4C
318/2301
ENR
ENR
ENR
RCC_
RCC_
RCC_
RCC_
RCC_
Register
APB1ENR1
Reset value
Reset value
Reset value
Reset value
Reset value
APB2RSTR
Reset value
Reset value
Reset value
RCC_AHB3
RCC_AHB2
RCC_AHB1
AHB3RSTR
0x3C APB1RSTR2
0x38 APB1RSTR1
LPTIM1EN Res. Res. Res. Res. Res. LPTIM1RST Res. 31
OPAMPEN Res. Res. Res. Res. Res. OPAMPRST Res. 30
DAC1EN Res. Res. Res. Res. Res. DAC1RST Res. 29
0 0 0 0
0 0 0 0
PWREN Res. Res. Res. Res. Res. PWRRST Res. 28
Reset and clock control (RCC)
0 0
Res. Res. Res. Res. LTDCRST Res. Res. Res. 26
CAN1EN Res. Res. Res. Res. Res. CAN1RST Res. 25
0
CRSEN Res. Res. Res. DFSDM1RST Res. CRSRST Res. 24
I2C3EN Res. SDMMC2EN Res. Res. Res. I2C3RST Res. 23
0 0
I2C2EN Res. SDMMC1EN Res. SAI2RST Res. I2C2RST Res. 22
0 0
I2C1EN Res. Res. Res. SAI1RST Res. I2C1RST Res. 21
0
UART5EN Res. OSPIMEN Res. Res. Res. UART5RST Res. 20
UART4EN Res. Res. Res. Res. Res. UART4RST Res. 19
USART3EN Res. RNGEN GFXMMUEN TIM17RST Res. USART3RST Res. 18
RM0432 Rev 6
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0
0 0 0
Res. Res. AESEN TSCEN. TIM15RST Res. Res. Res. 16
SP3EN Res. PKAEN Res. Res. Res. SPI3RST Res. 15
0 0
0 0
0 0 0 0 0 0 0
0
Res. Res. OTGFSEN CRCEN SPI1RST Res. Res. Res. 12
0 0 0 0
WWDGEN Res. Res. Res. TIM1RST Res. Res. Res. 11
0 1
RTCAPBEN Res. Res. Res. Res. Res. Res. Res. 10
Res. OSPI2EN Res. Res. Res. Res. Res. OSPI2RST 9
Table 38. RCC register map and reset values (continued)
0 0
1
0 0
0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0
0
0 0 0
0
0 0
0
RM0432
0x78
0x68
0x60
0x7C
0x5C
RM0432
ENR2
ENR1
RCC_
RCC_
RCC_
RCC_
RCC_
RCC_
RCC_
Register
APB1SM
APB1SM
APB2ENR
APB1ENR2
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
0x70 AHB3SMENR
0x6C AHB2SMENR
AHB1SMENR
Res. LPTIM1SMEN Res. Res. Res. Res. Res. 31
Res. OPAMPSMEN Res. Res. Res. Res. Res. 30
Res. DAC1SMEN Res. Res. Res. Res. Res. 29
1 1 1 1
Res. PWRSMEN Res. Res. Res. Res. Res. 28
Res. Res. Res. Res. Res. DSIEN Res. 27
0 0
Res. Res. Res. Res. Res. LTDCEN Res. 26
Res. CAN1SMEN Res. Res. Res. Res. Res. 25
0
Res. CRSSMEN Res. Res. Res. DFSDM1EN Res. 24
Res. I2C3SMEN Res. SDMMC2SMEN Res. Res. Res. 23
1 1
Res. I2C2SMEN Res. SDMMC1SMEN Res. 0 0 SAI2EN Res. 22
Res. I2C1SMEN Res. Res. Res. SAI1EN Res. 21
1
Res. UART5SMEN Res. OSPIMSMEN Res. Res. Res. 20
Res. UART4SMEN Res. Res. Res. Res. Res. 19
Res. USART3SMEN Res. RNGSMEN GFXMMUSMEN TIM17EN Res. 18
RM0432 Rev 6
1 1 1 1 1 1 1 1 1
Res. USART2SMEN Res. HASHSMEN DMA2DSMEN TIM16EN Res. 17
1 1 1
0 0 0
1 1
Res. SPI2SMEN Res. DCMISMEN Res. USART1EN Res. 14
Res. Res. Res. ADCFSSMEN Res. TIM8EN Res. 13
1 1 1 1 1 1 1
1
1 1
Res. RTCAPBSMEN Res. SRAM3SMEN Res. Res. Res. 10
Res. Res. OSPI2SMEN SRAM2SMEN SRAM1SMEN Res. Res. 9
Table 38. RCC register map and reset values (continued)
1 1
1 1
1
0
1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1
1 1
1
1 1 1
0
0 0
Reset and clock control (RCC)
319/2301
LPUART1SMEN TIM2SMEN FMCSMEN GPIOASMEN DMA1SMEN SYSCFGEN LPUART1EN 0
320
set
Off-
0x98
0x94
0x90
0x88
0x9C
0xA4h
320/2301
GR
RCC_
Register
RCC_CSR
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
RCC_BDCR
RCC_CCIPR
RCC_DLYCF
0x80 APB2SMENR
RCC_CRRCR
RCC_CCIPR2
Res. Res. Res. LPWRRSTF Res. Res. Res. 31
Res. Res. Res. WWDGRSTF Res. Res. Res. 30
Res. Res. Res. IWDGRSTF Res. ADCSEL Res. 29
Res. Res. Res. SFTRSTF Res. Res. 28
Reset and clock control (RCC)
0 0 0 0
1 1
Res. Res. Res. PINRSTF Res. LTDCSMEN 26
Res. Res. Res. OBLRSTF LSCOSEL Res. Res. 25
0 0
1
0 0 0 0 0 0 0 0 0
Res. Res. Res. RMVF Res. Res. Res. 23
Res. Res. Res. Res. Res. Res. SAI2SMEN 22
1 1
0 0
Res. [1:0] Res. Res. Res. Res. 20
Res. Res. Res. Res. Res. LPTIM1SEL Res. 19
Res. Res. Res. Res. Res. TIM17SMEN 18
RM0432 Rev 6
Res. PLLSAI2DIVR Res. Res. Res. I2C3SEL TIM16SMEN 17
0 0
1 1 1
0
Res. SDMMCSEL Res. Res. USART1SMEN 14
Res. Res. Res. Res. I2C1SEL TIM8SMEN 13
0
Res. DSISEL Res. Res. SPI1SMEN 12
1 1 1 1
HSI48CAL[8:0]
[2:0] UART5SEL
0 1 1 0
SEL
[1:0]
RTC
Res. Res. 8
x x x x x x x x x
SAI1SEL Res. LSESYSDIS UART4SEL Res. 7
[2:0] Res. Res. LSECSSD Res. 6
Res. Res. LSECSSON Res. 5
2_DLY
USART3SEL
0
[1:0]
DRV
1_DLY
USART1SEL
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
1
0 0
OCTOSPI OCTOSPI
[1:0]
RM0432
7.1 Introduction
The clock recovery system (CRS) is an advanced digital controller acting on the internal
fine-granularity trimmable RC oscillator HSI48. The CRS provides powerful means for
oscillator output frequency evaluation, based on comparison with a selectable
synchronization signal. It is capable of doing automatic adjustment of oscillator trimming
based on the measured frequency error value, while keeping the possibility of a manual
trimming.
The CRS is ideally suited to provide a precise clock to the USB peripheral. In such case, the
synchronization signal can be derived from the start-of-frame (SOF) packet signalization on
the USB bus, which is sent by a USB host at 1 ms intervals.
The synchronization signal can also be derived from the LSE oscillator output or it can be
generated by user software.
SYNCSRC SWSYNC
OSC32_IN
SYNC divider
LSE
(/1, /2, /4,…, /128)
OSC32_OUT
SYNC
USB_DP
FELIM
USB
USB_DM
RCC
RC 48 MHz 16-bit counter
RELOAD
HSI48
To peripherals
MS52498V1
RELOAD
ESYNC
Down Up
Frequency
OUTRANGE error counter
(128 x FELIM) stopped
WARNING LIMIT
(3 x FELIM)
TOLERANCE LIMIT
(FELIM)
Trimming action: 0 +2 +1 0 -1 -2 0
CRS event: SYNCERR SYNCWARN SYNCOK SYNCWARN
SYNCMISS
MSv32122V1
FELIM value
The selection of the FELIM value is closely coupled with the HSI48 oscillator characteristics
and its typical trimming step size. The optimal value corresponds to half of the trimming step
size, expressed as a number of HSI48 oscillator clock ticks. The following formula can be
used:
FELIM = (fTARGET / fSYNC) * STEP[%] / 100% / 2
The result must be always rounded up to the nearest integer value to obtain the best
trimming response. If frequent trimming actions are not needed in the application, the
hysteresis can be increased by slightly increasing the FELIM value.
The reset value of the FELIM field corresponds to (fTARGET / fSYNC) = 48000 and to a typical
trimming step size of 0.14%.
Caution: There is no hardware protection from a wrong configuration of the RELOAD and FELIM
fields which can lead to an erratic trimming response. The expected operational mode
requires proper setup of the RELOAD value (according to the synchronization source
frequency), which is also greater than 128 * FELIM value (OUTRANGE limit).
Sleep No effect. CRS interrupts cause the device to exit the Sleep mode.
CRS registers are frozen. The CRS stops operating until the Stop mode is exited and the
Stop
HSI48 oscillator restarted.
Standby The CRS peripheral is powered down and must be reinitialized after exiting Standby mode.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SW AUTO ESYNCI SYNC SYNC
Res. TRIM[6] TRIM[5:0] CEN Res. ERRIE
SYNC TRIMEN E WARNIE OKIE
rw rw rw rw rw rw rw rt_w1 rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
SYNCPOL Res. SYNCSRC[1:0] Res. SYNCDIV[2:0] FELIM[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RELOAD[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
FECAP[15:0]
r r r r r r r r r r r r r r r r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
TRIM SYNC SYNC SYNC SYNC
FEDIR Res. Res. Res. Res. Res. Res. Res. Res. ESYNCF ERRF
OVF MISS ERR WARNF OKF
r r r r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SYNC SYNC
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. ESYNCC ERRC
WARNC OKC
rw rw rw rw
10
11
9
8
7
6
5
4
3
2
1
0
SYNCWARNIE
AUTOTRIMEN
SYNCOKIE
TRIM[6](1)
ESYNCIE
SWSYNC
ERRIE
CEN
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
CRS_CR TRIM[5:0]
0x00
Reset value 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
SYNCPOL
SYNC SYNC
Res.
Res.
Reset value 0 1 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 1 1 0 1 1 0 1 1 1 1 1 1 1
SYNCWARNF
SYNCMISS
SYNCERR
SYNCOKF
TRIMOVF
ESYNCF
FEDIR
ERRF
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
CRS_ISR FECAP[15:0]
0x08
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
SYNCWARNC
SYNCOKC
ESYNCC
ERRC
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
CRS_ICR
0x0C
Reset value 0 0 0 0
1. The TRIM bitfield can be one bit less. Refer to Section 7.3: CRS implementation for details.
8.1 Introduction
Each general-purpose I/O port has four 32-bit configuration registers (GPIOx_MODER,
GPIOx_OTYPER, GPIOx_OSPEEDR and GPIOx_PUPDR), two 32-bit data registers
(GPIOx_IDR and GPIOx_ODR) and a 32-bit set/reset register (GPIOx_BSRR). In addition
all GPIOs have a 32-bit locking register (GPIOx_LCKR) and two 32-bit alternate function
selection registers (GPIOx_AFRH and GPIOx_AFRL).
Figure 25 and Figure 26 show the basic structures of a standard and a 5-Volt tolerant I/O
port bit, respectively. Table 43 gives the possible port bit configurations.
Analog
To on-chip
peripheral Alternate function input
Protection
trigger on/off
Pull diode
up
Input driver I/O pin
Output data register
Write
MS31476V1
To on-chip
peripheral
Alternate function input
on/off
Input data register
Read (1)
VDDIOx VDD_FT
TTL Schmitt
Bit set/reset registers
Protection
trigger on/off
Pull diode
up
Input driver I/O pin
Write
Output data register
ai15939d
1. VDD_FT is a potential specific to five-volt tolerant I/Os and different from VDD.
0 0 0 GP output PP
0 0 1 GP output PP + PU
0 1 0 GP output PP + PD
0 SPEED 1 1 Reserved
01
1 [1:0] 0 0 GP output OD
1 0 1 GP output OD + PU
1 1 0 GP output OD + PD
1 1 1 Reserved (GP output OD)
0 0 0 AF PP
0 0 1 AF PP + PU
0 1 0 AF PP + PD
0 SPEED 1 1 Reserved
10
1 [1:0] 0 0 AF OD
1 0 1 AF OD + PU
1 1 0 AF OD + PD
1 1 1 Reserved
x x x 0 0 Input Floating
x x x 0 1 Input PU
00
x x x 1 0 Input PD
x x x 1 1 Reserved (input floating)
x x x 0 0 Input/output Analog
x x x 0 1
11
x x x 1 0 Reserved
x x x 1 1
1. GP = general-purpose, PP = push-pull, PU = pull-up, PD = pull-down, OD = open-drain, AF = alternate
function.
There is no need for the software to disable interrupts when programming the GPIOx_ODR
at bit level: it is possible to modify one or more bits in a single atomic AHB write access.
on
Read
VDDIOx VDDIOx
Bit set/reset registers
MS31477V1
on
Read
VDDIOxVDDIOx
TTL Schmitt on/off
Bit set/reset registers
trigger protection
Pull diode
Input driver up
Write
Output data register
I/O pin
Output driver VDD on/off
Pull protection
P-MOS down diode
Output
control VSS VSS
N-MOS
Read/write
VSS push-pull or
open-drain
From on-chip
peripheral Alternate function output
MSv34756V1
Analog
To on-chip
peripheral
Input data register
Read off
0
VDDIOx
Bit set/reset registers
TTL Schmitt
trigger protection
Write diode
Output data register
Input driver
I/O pin
protection
diode
Read/write VSS
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OT15 OT14 OT13 OT12 OT11 OT10 OT9 OT8 OT7 OT6 OT5 OT4 OT3 OT2 OT1 OT0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
OSPEED15 OSPEED14 OSPEED13 OSPEED12 OSPEED11 OSPEED10 OSPEED9 OSPEED8
[1:0] [1:0] [1:0] [1:0] [1:0] [1:0] [1:0] [1:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OSPEED7 OSPEED6 OSPEED5 OSPEED4 OSPEED3 OSPEED2 OSPEED1 OSPEED0
[1:0] [1:0] [1:0] [1:0] [1:0] [1:0] [1:0] [1:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PUPD15[1:0] PUPD14[1:0] PUPD13[1:0] PUPD12[1:0] PUPD11[1:0] PUPD10[1:0] PUPD9[1:0] PUPD8[1:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PUPD7[1:0] PUPD6[1:0] PUPD5[1:0] PUPD4[1:0] PUPD3[1:0] PUPD2[1:0] PUPD1[1:0] PUPD0[1:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ID15 ID14 ID13 ID12 ID11 ID10 ID9 ID8 ID7 ID6 ID5 ID4 ID3 ID2 ID1 ID0
r r r r r r r r r r r r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OD15 OD14 OD13 OD12 OD11 OD10 OD9 OD8 OD7 OD6 OD5 OD4 OD3 OD2 OD1 OD0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
BR15 BR14 BR13 BR12 BR11 BR10 BR9 BR8 BR7 BR6 BR5 BR4 BR3 BR2 BR1 BR0
w w w w w w w w w w w w w w w w
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
BS15 BS14 BS13 BS12 BS11 BS10 BS9 BS8 BS7 BS6 BS5 BS4 BS3 BS2 BS1 BS0
w w w w w w w w w w w w w w w w
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. LCKK
rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LCK15 LCK14 LCK13 LCK12 LCK11 LCK10 LCK9 LCK8 LCK7 LCK6 LCK5 LCK4 LCK3 LCK2 LCK1 LCK0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
AFSEL7[3:0] AFSEL6[3:0] AFSEL5[3:0] AFSEL4[3:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
AFSEL3[3:0] AFSEL2[3:0] AFSEL1[3:0] AFSEL0[3:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
Bits 31:0 AFSEL[7:0][3:0]: Alternate function selection for port x I/O pin y (y = 7 to 0)
These bits are written by software to configure alternate function I/Os.
0000: AF0
0001: AF1
0010: AF2
0011: AF3
0100: AF4
0101: AF5
0110: AF6
0111: AF7
1000: AF8
1001: AF9
1010: AF10
1011: AF11
1100: AF12
1101: AF13
1110: AF14
1111: AF15
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
AFSEL15[3:0] AFSEL14[3:0] AFSEL13[3:0] AFSEL12[3:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
AFSEL11[3:0] AFSEL10[3:0] AFSEL9[3:0] AFSEL8[3:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
Bits 31:0 AFSEL[15:8][3:0]: Alternate function selection for port x I/O pin y (y = 15 to 8)
These bits are written by software to configure alternate function I/Os.
0000: AF0
0001: AF1
0010: AF2
0011: AF3
0100: AF4
0101: AF5
0110: AF6
0111: AF7
1000: AF8
1001: AF9
1010: AF10
1011: AF11
1100: AF12
1101: AF13
1110: AF14
1111: AF15
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
BR15 BR14 BR13 BR12 BR11 BR10 BR9 BR8 BR7 BR6 BR5 BR4 BR3 BR2 BR1 BR0
w w w w w w w w w w w w w w w w
0x0C
0x0C
0x0C
8.4.12
RM0432
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
GPIOx_IDR
(where x = A..I)
(where x = A..I)
(where x = C..I)
(where x = C..I)
GPIOx_PUPDR
(where x = B..H)
GPIOB_PUPDR
GPIOA_PUPDR
GPIOx_MODER
GPIOB_MODER
GPIOA_MODER
GPIOx_OTYPER
GPIOx_OSPEEDR
GPIOA_OSPEEDR
Offset Register name
0
0
0
0
0
1
1
1
Res. Res. 31
PUPD15[1:0] PUPD15[1:0] PUPD15[1:0] OSPEED15[1:0] OSPEED15[1:0] MODE15[1:0] MODE15[1:0] MODE15[1:0]
0
0
1
0
0
1
1
0
Res. Res. 30
0
0
1
0
0
1
1
1
Res. Res. 29
PUPD14[1:0] PUPD14[1:0] PUPD14[1:0] OSPEED14[1:0] OSPEED14[1:0] MODE14[1:0] MODE14[1:0] MODE14[1:0]
0
0
0
0
0
1
1
0
Res. Res. 28
0
0
0
0
1
1
1
1
Res. Res. 27
PUPD13[1:0] PUPD13[1:0] PUPD13[1:0] OSPEED13[1:0] OSPEED13[1:0] MODE13[1:0] MODE13[1:0] MODE13[1:0]
GPIO register map
0
0
1
0
1
1
1
Res. Res. 0
26
0
0
0
0
0
1
1
1
Res. Res. 25
PUPD12[1:0] PUPD12[1:0] PUPD12[1:0] OSPEED12[1:0] OSPEED12[1:0] MODE12[1:0] MODE12[1:0] MODE12[1:0]
0
0
0
0
0
1
1
1
Res. Res. 24
0
0
0
0
0
1
1
1
Res. Res. 23
PUPD11[1:0] PUPD11[1:0] PUPD11[1:0] OSPEED11[1:0] OSPEED11[1:0] MODE11[1:0] MODE11[1:0] MODE11[1:0]
0
0
0
0
0
1
1
1
Res. Res. 22
0
0
0
0
0
1
1
1
Res. Res. 21
PUPD10[1:0] PUPD10[1:0] PUPD10[1:0] OSPEED10[1:0] OSPEED10[1:0] MODE10[1:0] MODE10[1:0] MODE10[1:0]
0
0
0
0
0
1
1
1
Res. Res. 20
0
0
0
0
0
1
1
1
Res. Res. 19
PUPD9[1:0] PUPD9[1:0] PUPD9[1:0] OSPEED9[1:0] OSPEED9[1:0] MODE9[1:0] MODE9[1:0] MODE9[1:0]
0
0
0
0
0
1
1
1
Res. Res. 18
RM0432 Rev 6
0
0
0
0
0
1
1
1
Res. Res. 17
PUPD8[1:0] PUPD8[1:0] PUPD8[1:0] OSPEED8[1:0] OSPEED8[1:0] MODE8[1:0] MODE8[1:0] MODE8[1:0]
0
0
0
0
0
1
1
1
Res. Res. 16
x
0
0
0
0
0
1
1
1
0
ID15 OT15 15
PUPD7[1:0] PUPD7[1:0] PUPD7[1:0] OSPEED7[1:0] OSPEED7[1:0] MODE7[1:0] MODE7[1:0] MODE7[1:0]
x
0
0
0
0
0
1
1
1
0
ID14 OT14 14
x
0
0
0
0
0
1
1
1
0
ID13 OT13 13
PUPD6[1:0] PUPD6[1:0] PUPD6[1:0] OSPEED6[1:0] OSPEED6[1:0] MODE6[1:0] MODE6[1:0] MODE6[1:0]
x
0
0
0
0
0
1
1
1
0
ID12 OT12 12
x
0
0
0
0
0
1
1
1
ID11 OT11
Table 44. GPIO register map and reset values
x
0
0
0
0
0
1
1
1
ID10 OT10 10
The following table gives the GPIO register map and reset values.
x
0
0
0
0
0
1
1
1
ID9 OT9 9
PUPD4[1:0] PUPD4[1:0] PUPD4[1:0] OSPEED4[1:0] OSPEED4[1:0] MODE4[1:0] MODE4[1:0] MODE4[1:0]
x
0
1
0
0
0
1
0
1
ID8 OT8 8
x
0
0
0
0
0
1
1
1
ID7 OT7 7
PUPD3[1:0] PUPD3[1:0] PUPD3[1:0] OSPEED3[1:0] OSPEED3[1:0] MODE3[1:0] MODE3[1:0] MODE3[1:0]
x
0
0
0
0
0
1
0
1
ID6 OT6 6
x
0
0
0
0
0
0
1
1
1
ID5 OT5 5
PUPD2[1:0] PUPD2[1:0] PUPD2[1:0] OSPEED2[1:0] OSPEED2[1:0] MODE2[1:0] MODE2[1:0] MODE2[1:0]
x
0
0
0
0
0
0
1
1
1
ID4 OT4 4
x
0
0
0
0
0
0
1
1
1
ID3 OT3 3
PUPD1[1:0] PUPD1[1:0] PUPD1[1:0] OSPEED1[1:0] OSPEED1[1:0] MODE1[1:0] MODE1[1:0] MODE1[1:0]
x
0
0
0
0
0
0
1
1
1
ID2 OT2 2
x
0
0
0
0
0
0
1
1
1
ID1 OT1 1
PUPD0[1:0] PUPD0[1:0] PUPD0[1:0] OSPEED0[1:0] OSPEED0[1:0] MODE0[1:0] MODE0[1:0] MODE0[1:0]
x
0
0
0
0
0
0
1
1
1
ID0 OT0 0
349/2301
General-purpose I/Os (GPIO)
350
General-purpose I/Os (GPIO) RM0432
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
GPIOx_ODR
OD15
OD14
OD13
OD12
OD10
OD11
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
OD9
OD8
OD7
OD6
OD5
OD4
OD3
OD2
OD1
OD0
0x14 (where x = A..I)
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
GPIOx_BSRR BR15
BR14
BR13
BR12
BR10
BS15
BS14
BS13
BS12
BS10
BR11
BS11
BR9
BR8
BR7
BR6
BR5
BR4
BR3
BR2
BR1
BR0
BS9
BS8
BS7
BS6
BS5
BS4
BS3
BS2
BS1
BS0
0x18 (where x = A..I)
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
LCK15
LCK14
LCK13
LCK12
LCK10
LCK11
GPIOx_LCKR
LCKK
LCK9
LCK8
LCK7
LCK6
LCK5
LCK4
LCK3
LCK2
LCK1
LCK0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
0x1C (where x = A..I)
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
GPIOx_AFRL
AFSEL7[3:0] AFSEL6[3:0] AFSEL5[3:0] AFSEL4[3:0] AFSEL3[3:0] AFSEL2[3:0] AFSEL1[3:0] AFSEL0[3:0]
0x20 (where x = A..I)
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
GPIOx_AFRH AFSEL15[3:0 AFSEL14[3:0 AFSEL13[3:0 AFSEL12[3:0 AFSEL11[3:0
AFSEL10[3:0] AFSEL9[3:0] AFSEL8[3:0]
0x24 (where x = A..I) ] ] ] ] ]
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
GPIOx_BRR
BR15
BR14
BR13
BR12
BR10
BR11
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
BR9
BR8
BR7
BR6
BR5
BR4
BR3
BR2
BR1
BR0
0x28 (where x = A..I))
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
FB_
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. MEM_MODE[2:0]
MODE
rw rw rw rw
Note: When the FSMC is remapped at address 0x0000 0000, only the first two regions of Bank 1
memory controller (Bank1 NOR/PSRAM 1 and NOR/PSRAM 2) can be remapped. In remap
mode, the CPU can access the external memory via ICode bus instead of System bus
which boosts up the performance.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
I2C_ I2C_ I2C_ I2C_
I2C4_ I2C3_ I2C2_ I2C1_
FPU_IE[5:0] Res. Res. PB9_ PB8_ PB7_ PB6_
FMP FMP FMP FMP
FMP FMP FMP FMP
rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ANAS BOOST
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. FWDIS
WVDD EN
rw rw rc_w0
Table 45 describes when the bit 9 (ANASWVDD) and the bit 8 (BOOSTEN) should be set or
reset depending on the voltage settings.
- > 2.4 V 0 0
> 2.4 V < 2.4 V 0 1
< 2.4 V < 2.4 V 1 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
EXTI3[3:0] EXTI2[3:0] EXTI1[3:0] EXTI0[3:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
EXTI7[3:0] EXTI6[3:0] EXTI5[3:0] EXTI4[3:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
Note: Some of the I/O pins mentioned in the above register may not be available on small
packages.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
EXTI11[3:0] EXTI10[3:0] EXTI9[3:0] EXTI8[3:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
Note: Some of the I/O pins mentioned in the above register may not be available on small
packages.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
EXTI15[3:0] EXTI14[3:0] EXTI13[3:0] EXTI12[3:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
Note: Some of the I/O pins mentioned in the above register may not be available on small
packages.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SRAM2 SRAM2
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
BSY ER
r rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. SPF Res. Res. Res. Res. ECCL PVDL SPL CLL
rc_w1 rs rs rs rs
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
P31WP P30WP P29WP P28WP P27WP P26WP P25WP P24WP P23WP P22WP P21WP P20WP P19WP P18WP P17WP P16WP
rs rs rs rs rs rs rs rs rs rs rs rs rs rs rs rs
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
P15WP P14WP P13WP P12WP P11WP P10WP P9WP P8WP P7WP P6WP P5WP P4WP P3WP P2WP P1WP P0WP
rs rs rs rs rs rs rs rs rs rs rs rs rs rs rs rs
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. KEY[7:0]
w w w w w w w w
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
P63WP P62WP P61WP P60WP P59WP P58WP P57WP P56WP P55WP P54WP P53WP P52WP P51WP P50WP P49WP P48WP
rs rs rs rs rs rs rs rs rs rs rs rs rs rs rs rs
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
P47WP P46WP P45WP P44WP P43WP P42WP P41WP P40WP P39WP P38WP P37WP P36WP P35WP P34WP P33WP P32WP
rs rs rs rs rs rs rs rs rs rs rs rs rs rs rs rs
0x1C
0x0C
Offset
9.2.12
364/2301
MEMRMP
SYSCFG_
Register
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
SYSCFG_SKR
SYSCFG_SCSR
SYSCFG_SWPR
SYSCFG_CFGR2
SYSCFG_CFGR1
SYSCFG_SWPR2
SYSCFG_EXTICR4
SYSCFG_EXTICR3
SYSCFG_EXTICR2
SYSCFG_EXTICR1
0
0
0
P63WP Res. P31WP Res. Res. Res. Res. Res. Res. Res. 31
0
0
1
P62WP Res. P30WP Res. Res. Res. Res. Res. Res. Res. 30
0
0
1
P61WP Res. P29WP Res. Res. Res. Res. Res. Res. Res. 29
0
0
1
P60WP Res. P28WP Res. Res. Res. Res. Res. Res. Res. 28
0
0
1
FPU_IE[5..0]
P59WP Res. P27WP Res. Res. Res. Res. Res. Res. Res. 27
0
0
1
P58WP Res. P26WP Res. Res. Res. Res. Res. Res. Res. 26
0
0
P57WP Res. P25WP Res. Res. Res. Res. Res. Res. Res. Res. 25
SYSCFG register map
0
0
P56WP Res. P24WP Res. Res. Res. Res. Res. Res. Res. Res. 24
0
0
0
P55WP Res. P23WP Res. Res. Res. Res. Res. Res. I2C4_FMP Res.
System configuration controller (SYSCFG)
23
0
0
0
P54WP Res. P22WP Res. Res. Res. Res. Res. Res. I2C3_FMP Res. 22
0
0
0
P53WP Res. P21WP Res. Res. Res. Res. Res. Res. I2C2_FMP Res. 21
0
0
0
P52WP Res. P20WP Res. Res. Res. Res. Res. Res. I2C1_FMP Res. 20
0
0
0
P51WP Res. P19WP Res. Res. Res. Res. Res. Res. I2C_PB9_FMP Res. 19
0
0
0
P50WP Res. P18WP Res. Res. Res. Res. Res. Res. I2C_PB8_FMP Res. 18
RM0432 Rev 6
0
0
0
P49WP Res. P17WP Res. Res. Res. Res. Res. Res. I2C_PB7_FMP Res. 17
0
0
0
P48WP Res. P16WP Res. Res. Res. Res. Res. Res. I2C_PB6_FMP Res. 16
0
0
0
0
0
0
P47WP Res. P15WP Res. Res. Res. Res. 15
0
0
0
0
0
0
P46WP Res. P14WP Res. Res. Res. Res. 14
[3:0]
[3:0]
[3:0]
[3:0]
0
0
0
0
0
0
P45WP Res. P13WP Res. Res. Res. Res.
EXTI7
EXTI3
13
EXTI11
EXTI15
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Table 46. SYSCFG register map and reset values
[3:0]
[3:0]
[3:0]
[3:0]
0
0
0
0
0
0
0
EXTI14
EXTI10
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
The following table gives the SYSCFG register map and the reset values.
0
0
0
0
0
0
0
P38WP P6WP Res. Res. Res. Res. 6
[3:0]
[3:0]
[3:0]
[3:0]
0
0
0
0
0
0
0
P37WP P5WP Res. Res. Res. Res.
EXTI9
EXTI5
EXTI1
5
EXTI13
0
0
0
0
0
0
0
P36WP P4WP Res. Res. Res. Res. 4
KEY
0
0
0
0
0
0
0
0
0
P35WP P3WP ECCL Res. Res. Res. 3
x
0
0
0
0
0
0
0
0
0
P34WP P2WP PVDL Res. Res. 2
[3:0]
[3:0]
[3:0]
[3:0]
x
0
0
0
0
0
0
0
0
0
0
P33WP P1WP SPL SRAM2BS Res.
EXTI8
EXTI4
EXTI0
1
EXTI12
MEM_
MODE
0
0
0
0
0
0
1
0
0
0
P32WP P0WP CLL SRAM2ER FWDIS
RM0432
0
RM0432 System configuration controller (SYSCFG)
10.1 Introduction
Several peripherals have direct connections between them.
This allows autonomous communication and or synchronization between peripherals,
saving CPU resources thus power supply consumption.
In addition, these hardware connections remove software latency and allow design of
predictable system.
Depending on peripherals, these interconnections can operate in Run, Sleep, Low-power
run and sleep, Stop 0, Stop 1 and Stop 2 modes.
OPAMP1
OPAMP2
DFSDM1
Source
ADC2(3)
LPTIM1
LPTIM2
COMP1
COMP2
TIM15
TIM16
TIM17
IRTIM
ADC1
DAC1
DAC2
TIM1
TIM8
TIM2
TIM3
TIM4
TIM5
TIM6
TIM7
TIM1 - 1 1 1 1 - - - 1 - - - - 2 2 5 - - - - 9 - -
TIM8 - - 1 - 1 1 - - - - - - - 2 2 5 - - 4 4 - 9 -
TIM2 1 1 - 1 1 1 - - - - - - - 2 2 - - - 4 4 9 - -
TIM3 1 - 1 - 1 1 - - 1 - - - - 2 2 5 - - - - 9 9 -
TIM4 1 1 1 1 - 1 - - - - - - - 2 2 5 - - 4 4 - - -
TIM5 - 1 - - - - - - - - - - - - - - - - 4 4 - - -
TIM6 - - - - - - - - - - - - - 2 2 5 - - 4 4 - - -
TIM7 - - - - - - - - - - - - - - - 5 - - 4 4 - - -
TIM15 1 - - 1 - - - - - - - - - 2 2 - - - - - - 9 -
TIM16 - - - - - - - - 1 - - - - - - 5 - - - - - - 15
TIM17 - - - - - - - - 1 - - - - - - - - - - - - - 15
LPTIM1 - - - - - - - - - - - - - - - 5 - - - - - - -
LPTIM2 - - - - - - - - - - - - - - - 5 - - - - - - -
ADC1 3 - - - - - - - - - - - - - 10 16 - - - - - - -
(3)
ADC2 - 3 - - - - - - - - - - - - - 16 - - - - - - -
DFSDM1 6 6 - - - - - - 6 6 6 - - - - - - - - - - - -
T. Sensor - - - - - - - - - - - - - 12 - - - - - - - - -
VBAT - - - - - - - - - - - - - 12 - - - - - - - - -
VREFINT - - - - - - - - - - - - - 12 - - - - - - - - -
OPAMP1
OPAMP2
DFSDM1
Source
ADC2(3)
LPTIM1
LPTIM2
COMP1
COMP2
TIM15
TIM16
TIM17
IRTIM
ADC1
DAC1
DAC2
TIM1
TIM8
TIM2
TIM3
TIM4
TIM5
TIM6
TIM7
OPAMP1 - - - - - - - - - - - - - 12 12 - - - - - - - -
OPAMP2 - - - - - - - - - - - - - 12 12 - - - - - - - -
DAC1 - - - - - - - - - - - - - - 12 - 12 12 - - - - -
DAC2 - - - - - - - - - - - - - - 12 - - - - - - - -
HSE - - - - - - - - - - 7 - - - - - - - - - - - -
LSE - - 7 - - - - - 7 7 - - - - - - - - - - - - -
MSI - - - - - - - - - - 7 - - - - - - - - - - - -
LSI - - - - - - - - - 7 - - - - - - - - - - - - -
MCO - - - - - - - - - - 7 - - - - - - - - - - - -
EXTI - - - - - - - - - - - - - 2 2 5 - - 4 4 - - -
RTC - - - - - - - - - 7 - 8 8 - - - - - - - - - -
COMP1 13 13 13 13 - - - - 13 13 13 8 8 - - - - - - - - - -
COMP2 13 13 13 13 - - - - 13 13 13 8 8 - - - - - - - - - -
SYST ERR 14 14 - - - - - - 14 14 14 - - - - - - - - - - - -
USB - - 11 - - - - - - - - - - - - - - - - - - - -
1. Numbers in table are links to corresponding detailed sub-section in Section 10.3: Interconnection details.
2. The “-” symbol in grayed cells means no interconnect.
3. ADC2 is only available on STM32L4P5xx and STM32L4Q5xx devices.
Triggering signals
The output (from Master) is on signal TIMx_TRGO (and TIMx_TRGO2 for TIM1/TIM8)
following a configurable timer event.
The input (to slave) is on signals TIMx_ITR0/ITR1/ITR2/ITR3
The input and output signals for TIM1/TIM8 are shown in Figure 283: Advanced-control
timer block diagram.
The possible master/slave connections are given in:
• Table 275: TIMx internal trigger connection
• Table 280: TIMx internal trigger connection
• Table 284: TIMx Internal trigger connection
Triggering signals
The output (from timer) is on signal TIMx_TRGO, TIMx_TRGO2 or TIMx_CCx event.
The input (to ADC) is on signal EXT[15:0], JEXT[15:0].
The connection between timers and ADC is provided in:
• Table 130: ADC1 - External triggers for regular channels
• Table 131: ADC1 - External trigger for injected channels
Triggering signals
The output (from ADC) is on signals ADCn_AWDx_OUT n = 1, 2 (for ADC1, 2) x = 1, 2, 3 (3
watchdog per ADC) and the input (to timer) on signal TIMx_ETR (external trigger).
Triggering signals
The output (from timer) is on signal TIMx_TRGO directly connected to corresponding DAC
inputs.
Selection of input triggers on DAC is provided in Section 22.4.6: DAC trigger selection
(single and dual mode).
Triggering signals
The output (from timer) is on signal TIMx_TRGO/TIMx_TRGO2 or TIM16_OC1.
The input (on DFSDM1) is on signal DFSDM1_INTRG[0:8].
The connection between timers, EXTI and DFSDM1 is provided in Table 186: DFSDM
triggers connection.
Triggering signals
The output (from DFSDM1) is on signals dfsdm1_break[0:3] directly connected to timer and
‘Ored’ with other break input signals of the timer.
External clock LSE can be used as input to general-purpose timers (TIM2) on TIM2_ETR
pin, see Section 38.4.22: TIM2 option register 1 (TIM2_OR1).
Triggering signals
This trigger feature is described in Section 41.4.7: Trigger multiplexer (and following
sections).
The input selection is described in Table 293: LPTIM1 external trigger connection.
Triggering signals
Timer output signal TIMx_Ocx are the inputs to blanking source of COMP1/COMP2.
A description of dual ADC mode is provided in: Section 21.4.31: Dual ADC modes.
Triggering signals
Internal to the ADCs.
Triggering signals
Internal signal generated by USB FS Start Of Frame.
11.1 Introduction
The direct memory access (DMA) controller is a bus master and system peripheral.
The DMA is used to perform programmable data transfers between memory-mapped
peripherals and/or memories, upon the control of an off-loaded CPU.
The DMA controller features a single AHB master architecture.
There are two instances of DMA, DMA1 and DMA2.
Each channel is dedicated to managing memory access requests from one or more
peripherals. Each DMA includes an arbiter for handling the priority between DMA requests.
Number of channels 7 7
DMA1
Ch 1
...
Ch 7
dma1_it[1..7]
DMAMUX
DMA2
Ch 1
Ch 7
dma2_it[1..7]
MSv48190V1
The DMA controller performs direct memory transfer by sharing the AHB system bus with
other system masters. The bus matrix implements round-robin scheduling. DMA requests
may stop the CPU access to the system bus for a number of bus cycles, when CPU and
DMA target the same destination (memory or peripheral).
According to its configuration through the AHB slave interface, the DMA controller arbitrates
between the DMA channels and their associated received requests. The DMA controller
also schedules the DMA data transfers over the single AHB port master.
The DMA controller generates an interrupt per channel to the interrupt controller.
address register.
The start address used for the first transfer is the base address of the peripheral or
memory, and is programmed in the DMA_CPARx or DMA_CMARx register.
• post-decrementing of the programmed DMA_CNDTRx register
This register contains the remaining number of data items to transfer (number of AHB
‘read followed by write’ transfers).
This sequence is repeated until DMA_CNDTRx is null.
Note: The AHB master bus source/destination address must be aligned with the programmed size
of the transferred single data to the source/destination.
Pointer incrementation
The peripheral and memory pointers may be automatically incremented after each transfer,
depending on the PINC and MINC bits of the DMA_CCRx register.
If the incremented mode is enabled (PINC or MINC set to 1), the address of the next
transfer is the address of the previous one incremented by 1, 2 or 4, depending on the data
size defined in PSIZE[1:0] or MSIZE[1:0]. The first transfer address is the one programmed
in the DMA_CPARx or DMA_CMARx register. During transfers, these registers keep the
initially programmed value. The current transfer addresses (in the current internal
peripheral/memory address register) are not accessible by software.
If the channel x is configured in non-circular mode, no DMA request is served after the last
data transfer (once the number of single data to transfer reaches zero). The DMA channel
must be disabled in order to reload a new number of data items into the DMA_CNDTRx
register.
Note: If the channel x is disabled, the DMA registers are not reset. The DMA channel registers
(DMA_CCRx, DMA_CPARx and DMA_CMARx) retain the initial values programmed during
the channel configuration phase.
In circular mode, after the last data transfer, the DMA_CNDTRx register is automatically
reloaded with the initially programmed value. The current internal address registers are
reloaded with the base address values from the DMA_CPARx and DMA_CMARx registers.
automatically reloaded with the initial value programmed during the channel configuration
phase, and the DMA requests continue to be served.
In order to stop a circular transfer, the software needs to stop the peripheral from generating
DMA requests (such as quit the ADC scan mode), before disabling the DMA channel.
The software must explicitly program the DMA_CNDTRx value before starting/enabling a
transfer, and after having stopped a circular transfer.
Memory-to-memory mode
The DMA channels may operate without being triggered by a request from a peripheral. This
mode is called memory-to-memory mode, and is initiated by software.
If the MEM2MEM bit in the DMA_CCRx register is set, the channel, if enabled, initiates
transfers. The transfer stops once the DMA_CNDTRx register reaches zero.
Note: The memory-to-memory mode must not be used in circular mode. Before enabling a
channel in memory-to-memory mode (MEM2MEM = 1), the software must clear the CIRC
bit of the DMA_CCRx register.
Peripheral-to-peripheral mode
Any DMA channel can operate in peripheral-to-peripheral mode:
• when the hardware request from a peripheral is selected to trigger the DMA channel
This peripheral is the DMA initiator and paces the data transfer from/to this peripheral
to/from a register belonging to another memory-mapped peripheral (this one being not
configured in DMA mode).
• when no peripheral request is selected and connected to the DMA channel
The software configures a register-to-register transfer by setting the MEM2MEM bit of
the DMA_CCRx register.
Regardless of their usual naming, these ‘memory’ register, field and bit are used to
define the destination peripheral in peripheral-to-peripheral mode.
Table 50. Programmable data width and endian behavior (when PINC = MINC = 1)
Source Destinat
port ion port Destination
Number Source content:
width width content:
of data address / data
(MSIZE (PSIZE address / data
items to (DMA_CMARx if DMA transfers
if if (DMA_CPARx if
transfer DIR = 1, else
DIR = 1, DIR = 1, DIR = 1, else
(NDT) DMA_CPARx)
else else DMA_CMARx)
PSIZE) MSIZE)
@0x0 / B0 1: read B0[7:0] @0x0 then write 00B0[15:0] @0x0 @0x0 / 00B0
@0x1 / B1 2: read B1[7:0] @0x1 then write 00B1[15:0] @0x2 @0x2 / 00B1
8 16 4
@0x2 / B2 3: read B2[7:0] @0x2 then write 00B2[15:0] @0x4 @0x4 / 00B2
@0x3 / B3 4: read B3[7:0] @0x3 then write 00B3[15:0] @0x6 @0x6 / 00B3
@0x0 / B0 1: read B0[7:0] @0x0 then write 000000B0[31:0] @0x0 @0x0 / 000000B0
@0x1 / B1 2: read B1[7:0] @0x1 then write 000000B1[31:0] @0x4 @0x4 / 000000B1
8 32 4
@0x2 / B2 3: read B2[7:0] @0x2 then write 000000B2[31:0] @0x8 @0x8 / 000000B2
@0x3 / B3 4: read B3[7:0] @0x3 then write 000000B3[31:0] @0xC @0xC / 000000B3
@0x0 / B1B0 1: read B1B0[15:0] @0x0 then write B0[7:0] @0x0 @0x0 / B0
@0x2 / B3B2 2: read B3B2[15:0] @0x2 then write B2[7:0] @0x1 @0x1 / B2
16 8 4
@0x4 / B5B4 3: read B5B4[15:0] @0x4 then write B4[7:0] @0x2 @0x2 / B4
@0x6 / B7B6 4: read B7B6[15:0] @0x6 then write B6[7:0] @0x3 @0x3 / B6
@0x0 / B1B0 1: read B1B0[15:0] @0x0 then write B1B0[15:0] @0x0 @0x0 / B1B0
@0x2 / B3B2 2: read B3B2[15:0] @0x2 then write B3B2[15:0] @0x2 @0x2 / B3B2
16 16 4
@0x4 / B5B4 3: read B5B4[15:0] @0x4 then write B5B4[15:0] @0x4 @0x4 / B5B4
@0x6 / B7B6 4: read B7B6[15:0] @0x6 then write B7B6[15:0] @0x6 @0x6 / B7B6
@0x0 / B1B0 1: read B1B0[15:0] @0x0 then write 0000B1B0[31:0] @0x0 @0x0 / 0000B1B0
@0x2 / B3B2 2: read B3B2[15:0] @0x2 then write 0000B3B2[31:0] @0x4 @0x4 / 0000B3B2
16 32 4
@0x4 / B5B4 3: read B5B4[15:0] @0x4 then write 0000B5B4[31:0] @0x8 @0x8 / 0000B5B4
@0x6 / B7B6 4: read B7B6[15:0] @0x6 then write 0000B7B6[31:0] @0xC @0xC / 0000B7B6
@0x0 / B3B2B1B0 1: read B3B2B1B0[31:0] @0x0 then write B0[7:0] @0x0 @0x0 / B0
@0x4 / B7B6B5B4 2: read B7B6B5B4[31:0] @0x4 then write B4[7:0] @0x1 @0x1 / B4
32 8 4
@0x8 / BBBAB9B8 3: read BBBAB9B8[31:0] @0x8 then write B8[7:0] @0x2 @0x2 / B8
@0xC / BFBEBDBC 4: read BFBEBDBC[31:0] @0xC then write BC[7:0] @0x3 @0x3 / BC
@0x0 / B3B2B1B0 1: read B3B2B1B0[31:0] @0x0 then write B1B0[15:0] @0x0 @0x0 / B1B0
@0x4 / B7B6B5B4 2: read B7B6B5B4[31:0] @0x4 then write B5B4[15:0] @0x2 @0x2 / B5B4
32 16 4
@0x8 / BBBAB9B8 3: read BBBAB9B8[31:0] @0x8 then write B9B8[15:0] @0x4 @0x4 / B9B8
@0xC / BFBEBDBC 4: read BFBEBDBC[31:0] @0xC then write BDBC[15:0] @0x6 @0x6 / BDBC
@0x0 / B3B2B1B0 1: read B3B2B1B0[31:0] @0x0 then write B3B2B1B0[31:0] @0x0 @0x0 / B3B2B1B0
@0x4 / B7B6B5B4 2: read B7B6B5B4[31:0] @0x4 then write B7B6B5B4[31:0] @0x4 @0x4 / B7B6B5B4
32 32 4
@0x8 / BBBAB9B8 3: read BBBAB9B8[31:0] @0x8 then write BBBAB9B8[31:0] @0x8 @0x8 / BBBAB9B8
@0xC / BFBEBDBC 4: read BFBEBDBC[31:0] @0xC then write BFBEBDBC[31:0] @0xC @0xC / BFBEBDBC
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. TEIF7 HTIF7 TCIF7 GIF7 TEIF6 HTIF6 TCIF6 GIF6 TEIF5 HTIF5 TCIF5 GIF5
r r r r r r r r r r r r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
TEIF4 HTIF4 TCIF4 GIF4 TEIF3 HTIF3 TCIF3 GIF3 TEIF2 HTIF2 TCIF2 GIF2 TEIF1 HTIF1 TCIF1 GIF1
r r r r r r r r r r r r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
CHTIF7
CTCIF7
CHTIF6
CTCIF6
CHTIF5
CTCIF5
CTEIF7
CTEIF6
CTEIF5
CGIF7
CGIF6
CGIF5
Res. Res. Res. Res.
w w w w w w w w w w w w
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CHTIF4
CTCIF4
CHTIF3
CTCIF3
CHTIF2
CTCIF2
CHTIF1
CTCIF1
CTEIF4
CTEIF3
CTEIF2
CTEIF1
CGIF4
CGIF3
CGIF2
CGIF1
w w w w w w w w w w w w w w w w
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
MEM2
Res. PL[1:0] MSIZE[1:0] PSIZE[1:0] MINC PINC CIRC DIR TEIE HTIE TCIE EN
MEM
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
NDT[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PA[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PA[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
MA[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
MA[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
Offset Register
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
HTIF7
TCIF7
HTIF6
TCIF6
HTIF5
TCIF5
HTIF4
TCIF4
HTIF3
TCIF3
HTIF2
TCIF2
HTIF1
TCIF1
TEIF7
TEIF6
TEIF5
TEIF4
TEIF3
TEIF2
TEIF1
GIF7
GIF6
GIF5
GIF4
GIF3
GIF2
GIF1
Res.
Res.
Res.
Res.
DMA_ISR
0x000
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Offset Register
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
CTCIF7
CTCIF6
CTCIF5
CTCIF4
CTCIF3
CTCIF2
CTCIF1
CHTIF7
CHTIF6
CHTIF5
CHTIF4
CHTIF3
CHTIF2
CHTIF1
CTEIF7
CTEIF6
CTEIF5
CTEIF4
CTEIF3
CTEIF2
CTEIF1
CGIF7
CGIF6
CGIF5
CGIF4
CGIF3
CGIF2
CGIF1
Res.
Res.
Res.
Res.
DMA_IFCR
0x004
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
MEM2MEM
MSIZE[1:0]
PSIZE[1:0]
PL[1:0]
MINC
CIRC
PINC
HTIE
TCIE
TEIE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DIR
EN
DMA_CCR1
0x008
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DMA_CNDTR1 NDTR[15:0]
0x00C
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DMA_CPAR1 PA[31:0]
0x010
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DMA_CMAR1 MA[31:0]
0x014
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x018 Reserved Reserved.
MEM2MEM
MSIZE[1:0]
PSIZE[1:0]
PL[1:0]
MINC
CIRC
PINC
HTIE
TCIE
TEIE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DIR
EN
DMA_CCR2
0x01C
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DMA_CNDTR2 NDTR[15:0]
0x020
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DMA_CPAR2 PA[31:0]
0x024
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DMA_CMAR2 MA[31:0]
0x028
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x02C Reserved Reserved.
MEM2MEM
MSIZE[1:0]
PSIZE[1:0]
PL[1:0]
MINC
CIRC
PINC
HTIE
TCIE
TEIE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DIR
EN
DMA_CCR3
0x030
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DMA_CNDTR3 NDTR[15:0]
0x034
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DMA_CPAR3 PA[31:0]
0x038
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DMA_CMAR3 MA[31:0]
0x03C
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x040 Reserved Reserved.
MEM2MEM
MSIZE[1:0]
PSIZE[1:0]
PL[1:0]
MINC
CIRC
PINC
HTIE
TCIE
TEIE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DIR
EN
DMA_CCR4
0x044
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DMA_CNDTR4 NDTR[15:0]
0x048
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DMA_CPAR4 PA[31:0]
0x04C
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DMA_CMAR4 MA[31:0]
0x050
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x054 Reserved Reserved.
Offset Register
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
MEM2MEM
MSIZE[1:0]
PSIZE[1:0]
PL[1:0]
MINC
CIRC
PINC
HTIE
TCIE
TEIE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DIR
EN
DMA_CCR5
0x058
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DMA_CNDTR5 NDTR[15:0]
0x05C
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DMA_CPAR5 PA[31:0]
0x060
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DMA_CMAR5 MA[31:0]
0x064
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x068 Reserved Reserved.
MEM2MEM
MSIZE[1:0]
PSIZE[1:0]
PL[1:0]
MINC
CIRC
PINC
HTIE
TCIE
TEIE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DIR
EN
DMA_CCR6
0x06C
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DMA_CNDTR6 NDTR[15:0]
0x070
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DMA_CPAR6 PA[31:0]
0x074
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DMA_CMAR6 MA[31:0]
0x078
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x07C Reserved Reserved.
MEM2MEM
MSIZE[1:0]
PSIZE[1:0]
PL[1:0]
MINC
CIRC
PINC
HTIE
TCIE
TEIE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DIR
EN
DMA_CCR7
0x080
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DMA_CNDTR7 NDTR[15:0]
0x084
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DMA_CPAR7 PA[31:0]
0x088
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DMA_CMAR7 MA[31:0]
0x08C
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
12.1 Introduction
A peripheral indicates a request for DMA transfer by setting its DMA request signal. The
DMA request is pending until it is served by the DMA controller that generates a DMA
acknowledge signal, and the corresponding DMA request signal is deasserted.
In this document, the set of control signals required for the DMA request/acknowledge
protocol is not explicitly shown or described, and it is referred to as DMA request line.
The DMAMUX request multiplexer enables routing a DMA request line between the
peripherals and the DMA controllers of the product. The routing function is ensured by a
programmable multi-channel DMA request line multiplexer. Each channel selects a unique
DMA request line, unconditionally or synchronously with events from its DMAMUX
synchronization inputs. The DMAMUX may also be used as a DMA request generator from
programmable events on its input trigger signals.
The number of DMAMUX instances and their main characteristics are specified in
Section 12.3.1.
The assignment of DMAMUX request multiplexer inputs to the DMA request lines from
peripherals and to the DMAMUX request generator outputs, the assignment of DMAMUX
request multiplexer outputs to DMA controller channels, and the assignment of DMAMUX
synchronizations and trigger inputs to internal and external signals depend on the product
implementation, and are detailed inSection 12.3.2.
p Channel 1
Channel 0
x
DMA requests eq
_r
DMAMUX_C0CR
from peripherals: 1
ux
am
select
n+p+2 m DMA requests
1 to DMA controllers:
0
Request generator dmamux_req_outx
n+3
Channel n n
Sync
dmamux_req_genx
DMAMUX_RGCnCR n+2 m
DMA channels
1 events:
n+1 0
dmamux_evtx
s 1 0
Channel 1 1 2
DMAMUX_RGC1CR
1
Channel 0 0
DMAMUX_RGC0CR
Interrupt
interface
t 1 0 s 1 0
DMAMUX features two main sub-blocks: the request line multiplexer and the request line
generator.
The implementation assigns:
• DMAMUX request multiplexer sub-block inputs (dmamux_reqx) from peripherals
(dmamux_req_inx) and from channels of the DMAMUX request generator sub-block
(dmamux_req_genx)
• DMAMUX request outputs to channels of DMA controllers (dmamux_req_outx)
• Internal or external signals to DMA request trigger inputs (dmamux_trgx)
• Internal or external signals to synchronization inputs (dmamux_syncx)
Note: The null value in the field DMAREQ_ID corresponds to no DMA request line selected. It is
not allowed to configure a same non-null DMAREQ_ID to two different channels of the
DMAMUX request line multiplexer.
On top of the DMA request selection, the synchronization mode and/or the event generation
may be configured and enabled, if required.
Figure 33. Synchronization mode of the DMAMUX request line multiplexer channel
Selected
dmamux_reqx
Not pending
dmamux_syncx
dmamux_req_outx
dmamux_evtx
Example: DMAMUX_CCRx configured with: NBREQ=4, SE=1, EGE=1, SPOL=01 (rising edge)
MSv41974V1
Figure 34. Event generation of the DMA request line multiplexer channel
Selected
dmamux_reqx Not pending
dmamux_req_outx
SE
EGE
dmamux_evtx
MSv41975V1
If EGE is enabled, the multiplexer channel generates a channel event, as a pulse of one
AHB clock cycle, when its DMA request counter is automatically reloaded with the value of
the programmed NBREQ field, as shown in Figure 33 and Figure 34.
Note: If EGE is enabled and NBREQ = 0, an event is generated after each served DMA request.
Note: A synchronization event (edge) is detected if the state following the edge remains stable for
more than two AHB clock cycles.
Upon writing into DMAMUX_CxCR register, the synchronization events are masked during
three AHB clock cycles.
Note: The GNBREQ field value must be written by software only when the enable GE bit of the
corresponding generator channel x is disabled.
A trigger event (edge) is detected if the state following the edge remains stable for more
than two AHB clock cycles.
Upon writing into DMAMUX_RGxCR register, the trigger events are masked during three
AHB clock cycles.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. SYNC_ID[4:0] NBREQ[4:0] SPOL[1:0] SE
rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. EGE SOIE Res. DMAREQ_ID[6:0]
rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. SOF13 SOF12 SOF11 SOF10 SOF9 SOF8 SOF7 SOF6 SOF5 SOF4 SOF3 SOF2 SOF1 SOF0
r r r r r r r r r r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. CSOF CSOF CSOF CSOF CSOF CSOF CSOF CSOF CSOF CSOF CSOF CSOF CSOF CSOF
13 12 11 10 9 8 7 6 5 4 3 2 1 0
w w w w w w w w w w w w w w
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. GNBREQ[4:0] GPOL[1:0] GE
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. OIE Res. Res. Res. SIG_ID[4:0]
rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. OF3 OF2 OF1 OF0
r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. COF3 COF2 COF1 COF0
w w w w
10
11
9
8
7
6
5
4
3
2
1
0
SPOL
SOIE
EGE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[1:0]
DMAMUX_C0CR SYNC_ID[4:0] NBREQ[4:0] DMAREQ_ID[6:0]
SE
0x000
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
SPOL
SOIE
EGE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[1:0]
SE
DMAMUX_C1CR SYNC_ID[4:0] NBREQ[4:0] DMAREQ_ID[6:0]
0x004
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
SPOL
SOIE
EGE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[1:0]
SE
DMAMUX_C2CR SYNC_ID[4:0] NBREQ[4:0] DMAREQ_ID[6:0]
0x008
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
SPOL
SOIE
EGE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[1:0]
DMAMUX_C3CR SYNC_ID[4:0] NBREQ[4:0] DMAREQ_ID[6:0]
SE
0x00C
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
SPOL
SOIE
EGE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[1:0]
DMAREQ_ID[6:0]
SE
DMAMUX_C4CR SYNC_ID[4:0] NBREQ[4:0]
0x010
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
SPOL
SOIE
EGE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[1:0]
SE
DMAMUX_C5CR SYNC_ID[4:0] NBREQ[4:0] DMAREQ_ID[6:0]
0x014
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
SPOL
SOIE
EGE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[1:0]
0x018
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
SPOL
SOIE
EGE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[1:0]
SE
SOIE
EGE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[1:0]
SE
SOIE
EGE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[1:0]
0x024
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
SPOL
SOIE
EGE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[1:0]
SE
SOIE
EGE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[1:0]
SE
SOIE
EGE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[1:0]
SE
SOIE
EGE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[1:0]
SE
Reserved
0x07C
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DMAMUX_CSR
0x080
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0
CSOF13
CSOF12
CSOF10
CSOF11
CSOF9
CSOF8
CSOF7
CSOF6
CSOF5
CSOF4
CSOF3
CSOF2
CSOF1
CSOF0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DMAMUX_CFR
0x084
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x13C
0x10C
0x3FC
0x0FC
0x110 -
Offset
0x148 -
0x088 -
RM0432
Reserved
Reserved
Reserved
Register
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
DMAMUX_RGSR
DMAMUX_RG3CR
DMAMUX_RG2CR
DMAMUX_RG1CR
DMAMUX_RG0CR
DMAMUX_RGCFR
Res. Res. Res. Res. Res. Res. Res. Res. Res. 31
Res. Res. Res. Res. Res. Res. Res. Res. Res. 30
Res. Res. Res. Res. Res. Res. Res. Res. Res. 29
Res. Res. Res. Res. Res. Res. Res. Res. Res. 28
Res. Res. Res. Res. Res. Res. Res. Res. Res. 27
Res. Res. Res. Res. Res. Res. Res. Res. Res. 26
Res. Res. Res. Res. Res. Res. Res. Res. Res. 25
Res. Res. Res. Res. Res. Res. Res. Res. Res. 24
0
0
0
0
0
0
0
0
RM0432 Rev 6
[1:0] [1:0] [1:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
415/2301
DMA request multiplexer (DMAMUX)
415
Chrom-ART Accelerator controller (DMA2D) RM0432
AHB MASTER
FG PFC
Dmode
Blue
BG PFC
Dmode
CLUT itf
256x32-bit
RAM AHB SLAVE
MS30439V1
0000 ARGB8888
0001 RGB888
0010 RGB565
0011 ARGB1555
0100 ARGB4444
0101 L8
0110 AL44
0111 AL88
1000 L4
1001 A8
1010 A4
The 24-bit RGB888 aligned on 32-bit is supported through the ARGB8888 mode.
Once the 32-bit value is generated, the alpha channel can be modified according to the
AM[1:0] field of the DMA2D_FGPFCCR/DMA2D_BGPFCCR registers as shown in
Table 65: Alpha mode configuration.
00 No modification
01 Replaced by value in DMA2D_xxPFCCR
10 Replaced by original value multiplied by the value in DMA2D_xxPFCCR / 255
11 Reserved
Note: To support the alternate format, the incoming alpha value can be inverted setting the AI bit
of the DMA2D_FGPFCCR/DMA2D_BGPFCCR registers. This applies also to the Alpha
value stored in the DMA2D_FGPFCCR/DMA2D_BGPFCCR and in the CLUT.
The R and B fields can also be swapped setting the RBS bit of the
DMA2D_FGPFCCR/DMA2D_BGPFCCR registers. This applies also to the RGB order used
in the CLUT and in the DMA2D_FGCOLR/DMA2D_BGCOLR registers.
occurs, a CLUT access error interrupt is raised assuming CAEIE is set to ‘1’ in
DMA2D_CR.
• Manual loading
The application has to program the CLUT manually through the DMA2D AHB slave
port to which the local CLUT memory is mapped.The foreground CLUT is located at
address offset 0x0400 and the background CLUT at address offset 0x0800.
The CLUT format is 24 or 32 bits. It is configured through the CCM bit of the
DMA2D_FGPFCCR register (foreground CLUT) or DMA2D_BGPFCCR register
(background CLUT) as shown in Table 66: Supported CLUT color mode.
0 32-bit ARGB8888
1 24-bit RGB888
The way the CLUT data are organized in the system memory is specified in Table 67: CLUT
data order in system memory.
αFG . αBG
with αMult =
255
No configuration register is required by the blender. The blender usage depends on the
DMA2D operating mode defined in MODE[2:0] field of the DMA2D_CR register.
000 ARGB8888
001 RGB888
010 RGB565
011 ARGB1555
100 ARGB4444
Note: To support the alternate format, the calculated alpha value is inverted setting the AI bit of the
DMA2D_OPFCCR registers. This applies also to the Alpha value used in the
DMA2D_OCOLR.
The R and B fields can also be swapped setting the RBS bit of the DMA2D_OPFCCR
registers. This applies also to the RGB order used in the DMA2D_OCOLR.
16-bit Data
Colors R4 R3 R2 R1 R0 G5 G4 G3 G2 G1 G0
G5 B4 B3 B2 B1 B0
64K colors
MSv42078V2
Transfer
1 2
Order
16-bit Data 16-bit Data
Data Bus D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
Colors R7 R6 R5 R4 R3 R2 R1 R0 G7 G6 G5 G4 G3 G2 G1 G0 B7 B6 B5 B4 B3 B2 B1 B0 R7 R6 R5 R4 R3 R2 R1 R0
16.7M colors
1st pixel 2nd pixel
MSv42079V2
Register-to-memory
The register-to-memory mode is used to fill a user defined area with a predefined color.
The color format is set in the DMA2D_OPFCCR.
The DMA2D does not perform any data fetching from any source. It just writes the color
defined in the DMA2D_OCOLR register to the area located at the address pointed by the
DMA2D_OMAR and defined in the DMA2D_NLR and DMA2D_OOR.
Memory-to-memory
In memory-to-memory mode, the DMA2D does not perform any graphical data
transformation. The foreground input FIFO acts as a buffer and the data are transferred
from the source memory location defined in DMA2D_FGMAR to the destination memory
location pointed by DMA2D_OMAR.
The color mode programmed in the CM[3:0] bits of the DMA2D_FGPFCCR register defines
the number of bits per pixel for both input and output.
The size of the area to be transferred is defined by the DMA2D_NLR and DMA2D_FGOR
registers for the source, and by DMA2D_NLR and DMA2D_OOR registers for the
destination.
The two pixel format converters have to be configured as described in the memory-to-
memory mode. Their configurations can be different as each pixel format converter are
independent and have their own CLUT memory.
Once each pixel has been converted into 32 bits by their respective PFCs, they are blended
according to the equation below:
αFG . αBG
with αMult =
255
The resulting 32-bit pixel value is encoded by the output PFC according to the specified
output format, and the data are written into the destination memory location pointed by
DMA2D_OMAR.
Once each pixel has been converted into 32 bits by their respective PFCs, they are blended
together, and the resulting 32-bit pixel value is encoded by the output PFC according to the
specified output format, and the data are written into the destination memory location
pointed by DMA2D_OMAR.
13.3.14 Watermark
A watermark can be programmed to generate an interrupt when the last pixel of a given line
has been written to the destination memory area.
The line number is defined in the LW[15:0] field of the DMA2D_LWR register.
When the last pixel of this line has been transferred, the TWIF flag of the DMA2D_ISR
register is raised and an interrupt is generated if the TWIE bit of the DMA2D_CR is set.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. MODE[2:0]
rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. CEIE CTCIE CAEIE TWIE TCIE TEIE Res. LOM Res. Res. Res. ABORT SUSP START
rw rw rw rw rw rw rw rs rw rs
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. CEIF CTCIF CAEIF TWIF TCIF TEIF
r r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. CCEIF CCTCIF CAECIF CTWIF CTCIF CTEIF
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
MA[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
MA[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LO[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
MA[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
MA[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LO[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw rs rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
GREEN[7:0] BLUE[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw rs rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
GREEN[7:0] BLUE[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
MA[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
MA[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
MA[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
MA[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. RBS AI Res. Res. Res. Res.
rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. SB Res. Res. Res. Res. Res. Res. CM[2:0]
rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
ALPHA[7:0] RED[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
GREEN[7:0] BLUE[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
MA[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
MA[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LO[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
NL[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LW[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
ALPHA<y>[7:0] RED<y>[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
GREEN<y>[7:0] BLUE<y>[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
ALPHA<y>[7:0] RED<y>[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
GREEN<y>[7:0] BLUE<y>[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
Offset Register
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
MODE[2:0]
ABORT
START
CTCIE
CAEIE
SUSP
TWIE
CEIE
TCIE
TEIE
LOM
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DMA2D_CR
0x0000
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0
CTCIF
CAEIF
TWIF
CEIF
TCIF
TEIF
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DMA2D_ISR
0x0004
Reset value 0 0 0 0 0 0
CCTCIF
CAECIF
CTWIF
CCEIF
CTCIF
CTEIF
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DMA2D_IFCR
0x0008
Reset value 0 0 0 0 0 0
DMA2D_FGMAR MA[31:0]
0x000C
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DMA2D_FGOR LO[15:0]
0x0010
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DMA2D_BGMAR MA[31:0]
0x0014
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DMA2D_BGOR LO[15:0]
0x0018
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
AM[1:0]
START
CCM
RBS
Res.
Res.
Res.
Res.
Res.
Res.
DMA2D_FGPFCCR ALPHA[7:0] CS[7:0] CM[3:0]
AI
0x001C
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
START
CCM
RBS
Res.
Res.
Res.
Res.
Res.
Res.
0x0024
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DMA2D_OPFCCR CM[2:0]
SB
AI
0x0034
Reset value 0 0 0 0 0 0
Offset Register
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
ALPHA[7:0] RED[7:0] GREEN[7:0] BLUE[7:0]
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DMA2D_AMTCR DT[7:0]
EN
0x004C
Reset value 0 0 0 0 0 0 0 0 0
0x0050-
Reserved Reserved
0x03FC
14 Chrom-GRC™ (GFXMMU)
14.1 Introduction
The graphic MMU is a graphical oriented memory management unit aimed to optimize
memory usage according to the display shape.
Status
registers
MMU
Control
registers
Add[23:22]
PhyAdd[22:0]
pBuffer3AddMSB[31:23]
pBuffer2AddMSB[31:23]
pBuffer1AddMSB[31:23]
pBuffer0AddMSB[31:23]
AHBMasterAdd[31:0]
MSv41698V1
Virtual buffer
A virtual buffer is seen by any system master as a continuous memory space representing a
virtual frame buffer of 1024 lines.
Each line is divided into 192 or 256 16-byte blocks depending on the 192BM bit of the
graphic MMU configuration register (GFXMMU_CR).
Depending on the display shape and size, only the necessary blocks will be mapped to a
physical memory location. This mapping is done programming the LUT entry for each line:
• The enable of the line
• The number of the first “visible” block
• The number of the last “visible” block
• The address offset of the line within the physical buffer
The “visible” blocks can be arranged in the physical buffer in a continuous way programming
the address offset of each line.
The LUT is common to all the buffers i.e. all the buffers have the same “shape”.
1024 lines
192/256 x 16-byte blocks per line
1024 lines
Line N first block on Line N last block Line N+1 first Line N+1 last
screen on screen block on screen block on screen
MSv43800V1
Virtual buffer
0xFF:FFFF
pBuffer3
0xDF:FFFF
0xYY:Y000 Physical buffer 3 offset
Virtual buffer 3
(3/4 Mbyte)
0xXX00:0000 Physical buffer 3 base address
0xC0:0000
0xAF:FFFF
pBuffer2
Virtual buffer 2 0xYY:Y000 Physical buffer 2 offset
(3/4 Mbyte)
0x6F:FFFF
Virtual buffer 1
(3/4 Mbyte)
pBuffer1
0xYY:Y000 Physical buffer 1 offset
0x40:0000
0xXX00:0000 Physical buffer 1 base address
0x2F:FFFF
Virtual buffer 0
(3/4 Mbyte)
pBuffer0
0x00:0000 0xYY:Y000 Physical buffer 0 offset
The buffer can not overflow the 8 MByte boundary of the zone defined by its base address.
In case of overflow, the buffer x overflow flag (BxOF) of the graphic MMU status register
(GFXMMU_SR) is set and an interrupt is generated if the buffer x overflow interrupt enable
(BxOIE) bit of the graphic MMU configuration register (GFXMMU_CR) is set.
Block[7:0]
Line/block
Add[21:4] [21:4]
decoder +
Block0Offset[21:4] Overflow
Line[9:0] C
LookUp LineEnable
RAM + PhyAdd[22:4]
FirstBlock[7:0]
Add[23:4] Block Valid
1024 x 35-bit valid
LastBlock[7:0]
comp.
Add[23:22] pBufferOffset[22:4]
pBufferOffset
MSv43802V1
Look up RAM
The look up RAM is a 1024 x 35-bit RAM with the following fields:
• 1-bit line enable
• 8-bit first valid block
• 8-bit last valid block
• 18-bit for line offset
As the RAM is bigger than a word, each entry is split into two words on the memory map.
The write access are done in two steps:
1. Write the first word with enable/first valid block/last valid block in the GFXMMU_LUTxL
memory location (internally buffered)
2. Write the second word with line offset in the GFXMMU_LUTxH memory location
(effective write into the memory together with the internally buffered value)
A write in the LUT can happen any time but it can lead to inconsistencies if a master is using
the MMU at the same time. As the CPU has the priority during LUT programming, this may
slow down MMU calculation.
There is no restriction during read operations, but this may slow down CPU as the MMU has
the priority on LUT accesses.
Block validation/comparator
This block is checking is the block is valid.
Add[23:22] PBufferOffset
pBuffer0Offset[22:4]
pBuffer1Offset[22:4] pBufferOffset[22:4]
pBuffer2Offset[22:4]
pBuffer3Offset[22:4]
MSv43803V1
The resulting address and the buffer offset address shall be on 23-bit.
The carry is taken into account to trigger address overflow. The carry is propagated to the
graphic MMU status register (GFXMMU_SR) to set the buffer x overflow flag (BxOF).
Example of calculation
We are considering the following configuration for virtual buffer 0
• First visible block of line 0: block 7
• Number of visible block in line 0: 10
• First visible block of line 1: block 6
• Number of visible block in line 1: 12
• Address of the physical buffer: 0xC020:0000
The configuration shall be:
• The base address of the physical buffer 0: 0xC000:0000
• The offset of buffer 0: 0x20:0000
• First visible block of line 0: block 7
• Last visible block of line 0: block 16
• Block 0 offset of line 0: (0 - 7) x 0x10 = -0x70 = 0x3F:FF90
• First visible block of line 1: block 6
• Last visible block of line 1: block 17
• Block 0 offset of line 1: (10 - 6) x 0x10 = (0xA - 0x6) x 0x10 = 0x40
As a consequence:
• the physical address of block 7 of line 0 is:
0xC000:0000 + 0x20:0000 + (0x3F:FF90 + 0x70 without carry) = 0xC020:0000
• the physical address of block 16 of line 0 is:
0xC000:0000 + 0x20:0000 + (0x3F:FF90 + 0x100 without carry) = 0xC020:0090
• the physical address of block 6 of line 1 is:
0xC000:0000 + 0x20:0000 + (0x40 + 0x60 without carry) = 0xC020:00A0
• the physical address of block 17 of line 1 is:
0xC000:0000 + 0x20:0000 + (0x40 + 0x110 without carry) = 0xC020:0150
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. 192BM Res. AMEIE B3OIE B2OIE B1OIE B0OIE
rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. AMEF B3OF B2OF B1OF B0OF
r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. CAMEF CB3OF CB2OF CB1OF CB0OF
rc_w1 rc_w1 rc_w1 rc_w1 rc_w1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DV[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DV[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PBBA[31:23] PBO[22:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PBO[15:4] Res. Res. Res. Res.
rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PBBA[31:23] PBO[22:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PBO[15:4] Res. Res. Res. Res.
rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PBBA[31:23] PBO[22:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PBO[15:4] Res. Res. Res. Res.
rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PBBA[31:23] PBO[22:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PBO[15:4] Res. Res. Res. Res.
rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. LVB[7:0]
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
FVB[7:0] Res. Res. Res. Res. Res. Res. Res. EN
rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. LO[21:16]
rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LO[15:4] Res. Res. Res. Res.
rw rw rw rw rw rw rw rw rw rw rw rw
0x2FF8
0x0FF0
0x000C
0x002C
0x001C
0x2FFC
0x0FEC
Offset
RM0432
14.5.11
LUT0L
LUT0H
Reserved
Reserved
Reserved
LUT1023L
LUT1023H
GFXMMU_
GFXMMU_
GFXMMU_
GFXMMU_
Register
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
GFXMMU_SR
GFXMMU_CR
GFXMMU_FCR
GFXMMU_DVR
GFXMMU_B3CR
GFXMMU_B2CR
GFXMMU_B1CR
GFXMMU_B0CR
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 31
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 30
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 29
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 28
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 27
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 26
PBBA[31:23]
PBBA[31:23]
PBBA[31:23]
PBBA[31:23]
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 25
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 24
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. 23
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. 22
Graphic MMU register map
0
0
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. 21
0
0
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. 20
...
0
0
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. 19
LVB[7:0]
LVB[7:0]
0
0
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. 18
0
0
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res.
RM0432 Rev 6
17
0
0
0
0
0
0
0
0
Res. Res. 0 Res. Res. Res. Res. 16
0
0
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. 15
DV[31:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
PBO[22:4]
PBO[22:4]
PBO[22:4]
PBO[22:4]
addresses table for the graphic MMU register base address.
LO[21:4]
LO[21:4]
0
0
0
0
0
0
0
0
0
FVB[7:0]
FVB[7:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. CB3OF B3OF B3OIE 3
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. CB2OF B2OF B2OIE 2
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. CB1OF B1OF B1OIE 1
The following table summarizes the graphic MMU registers. Refer to the register boundary
0
0
0
0
0
Res. EN Res. EN Res. Res. Res. Res. Res. Res. Res. CB0OF B0OF B0OIE 0
Chrom-GRC™ (GFXMMU)
467/2301
467
Nested vectored interrupt controller (NVIC) RM0432
Priority
Type of
Acronym Description Address
priority
Priority
Type of
Acronym Description Address
priority
Priority
Type of
Acronym Description Address
priority
Priority
Type of
Acronym Description Address
priority
Priority
Type of
Acronym Description Address
priority
Priority
Type of
Acronym Description Address
priority
Priority
Type of
Acronym Description Address
priority
Priority
Type of
Acronym Description Address
priority
Priority
Type of
Acronym Description Address
priority
16.1 Introduction
The EXTI main features are as follows:
• Generation of up to 39 event/interrupt requests
– 26 configurable lines
– 13 direct lines
• Independent mask on each event/interrupt line
• Configurable rising or falling edge (configurable lines only)
• Dedicated status bit (configurable lines only)
• Emulation of event/interrupt requests (configurable lines only)
selected edge occurs on the event line, an event pulse is generated. The pending bit
corresponding to the event line is not set.
For the configurable lines, an interrupt/event request can also be generated by software by
writing a ‘1’ in the software interrupt/event register.
Note: The interrupts or events associated to the direct lines are triggered only when the system is
in Stop mode. If the system is still running, no interrupt/event is generated by the EXTI.
Interrupts
Configurable Edge detect
events circuit
Events
Stop mode Rising
Direct events edge
detect
Wakeup
MS33393V1
PA0
PB0
PC0
PD0 EXTI0
PE0
PF0
PG0
PH0
PI0(1)
PA1
PB1
PC1
PD1 EXTI1
PE1
PF1
PG1
PH1
PI1(1)
...
PA15
PB15
PC15
PD15 EXTI15
PE15
PF15
PG15
PH15(1)
MS46947V1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
IM31 IM30 IM29 IM28 IM27 IM26 IM25 IM24 IM23 IM22 IM21 IM20 IM19 IM18 IM17 IM16
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
IM15 IM14 IM13 IM12 IM11 IM10 IM9 IM8 IM7 IM6 IM5 IM4 IM3 IM2 IM1 IM0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
Note: The reset value for the direct lines (line 17, lines from 23 to 34, line 39) is set to ‘1’ in order
to enable the interrupt by default.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
EM31 EM30 EM29 EM28 EM27 EM26 EM25 EM24 EM23 EM22 EM21 EM20 EM19 EM18 EM17 EM16
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
EM15 EM14 EM13 EM12 EM11 EM10 EM9 EM8 EM7 EM6 EM5 EM4 EM3 EM2 EM1 EM0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. RT22 RT21 RT20 RT19 RT18 Res. RT16
rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RT15 RT14 RT13 RT12 RT11 RT10 RT9 RT8 RT7 RT6 RT5 RT4 RT3 RT2 RT1 RT0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
Note: The configurable wakeup lines are edge-triggered. No glitch must be generated on these
lines. If a rising edge on a configurable interrupt line occurs during a write operation in the
EXTI_RTSR register, the pending bit is not set.
Rising and falling edge triggers can be set for the same interrupt line. In this case, both
generate a trigger condition.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. FT22 FT21 FT20 FT19 FT18 Res. FT16
rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
FT15 FT14 FT13 FT12 FT11 FT10 FT9 FT8 FT7 FT6 FT5 FT4 FT3 FT2 FT1 FT0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
Note: The configurable wakeup lines are edge-triggered. No glitch must be generated on these
lines. If a falling edge on a configurable interrupt line occurs during a write operation to the
EXTI_FTSR register, the pending bit is not set.
Rising and falling edge triggers can be set for the same interrupt line. In this case, both
generate a trigger condition.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
SWI SWI SWI SWI SWI SWI
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
22 21 20 19 18 16
rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SWI SWI SWI SWI SWI SWI SWI SWI SWI SWI SWI SWI SWI SWI SWI SWI
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. PIF22 PIF21 PIF20 PIF19 PIF18 Res. PIF16
rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PIF15 PIF14 PIF13 PIF12 PIF11 PIF10 PIF9 PIF8 PIF7 PIF6 PIF5 PIF4 PIF3 PIF2 PIF1 PIF0
rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. IM40 IM39 IM38 IM37 IM36 IM35 IM34 IM33 IM32
rw rw rw rw rw rw rw rw rw
Note: The reset value for the direct lines (line 17, lines from 23 to 34, line 39, line 40) is set to ‘1’ in
order to enable the interrupt by default.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. EM40 EM39 EM38 EM37 EM36 EM35 EM34 EM33 EM32
rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. RT38 RT37 RT36 RT35 Res. Res. Res.
rw rw rw rw
Note: The configurable wakeup lines are edge-triggered. No glitch must be generated on these
lines. If a rising edge on a configurable interrupt line occurs during a write operation to the
EXTI_RTSR register, the pending bit is not set.
Rising and falling edge triggers can be set for the same interrupt line. In this case, both
generate a trigger condition.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. FT38 FT37 FT36 FT35 Res. Res. Res.
rw rw rw rw
Note: The configurable wakeup lines are edge-triggered. No glitch must be generated on these
lines. If a falling edge on a configurable interrupt line occurs during a write operation to the
EXTI_FTSR register, the pending bit is not set.
Rising and falling edge triggers can be set for the same interrupt line. In this case, both
generate a trigger condition.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SWI SWI SWI SWI
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
38 37 36 35
rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. PIF38 PIF37 PIF36 PIF35 Res. Res. Res.
0x2C
0x0C
Offset
RM0432
16.5.13
EXTI_PR2
EXTI_PR1
Register
EXTI_IMR2
EXTI_IMR1
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
EXTI_EMR2
EXTI_EMR1
EXTI_FTSR2
EXTI_FTSR1
EXTI_RTSR2
EXTI_RTSR1
EXTI_SWIER2
EXTI_SWIER1
0
1
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. EM31 IM31 31
0
1
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. EM30 IM30 30
0
1
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. EM29 IM29 29
0
1
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. EM28 IM28 28
0
1
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. EM27 IM27 27
0
1
EXTI register map
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. EM26 IM26 26
0
1
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. EM25 IM25 25
0
1
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 0 EM24 IM24 24
1
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. EM23 IM23 23
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. PIF22 SWI22 FT22 RT22 EM22 IM22 22
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. PIF21 SWI21 FT21 RT21 EM21 IM21 21
0
0
0
0
0
Res. Res. Res. Res. Res. Res. PIF20 SWI20 FT20 0 RT20 EM20 IM20 20
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. PIF19 SWI19 FT19 RT19 EM19 IM19 19
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. PIF18 SWI18 FT18 RT18 EM18 IM18 18
RM0432 Rev 6
0
1
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. EM17 IM17 17
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. PIF16 SWI16 FT16 RT16 EM16 IM16 16
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. PIF15 SWI15 FT15 RT15 EM15 IM15 15
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. PIF14 SWI14 FT14 RT14 EM14 IM14 14
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. PIF13 SWI13 FT13 RT13 EM13 IM13 13
Table 79 gives the EXTI register map and the reset values.
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. PIF12 SWI12 FT12 RT12 EM12 IM12 12
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. PIF11 SWI11 FT11 RT11 EM11 IM11 11
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. PIF10 SWI10 FT10 RT10 EM10 IM10 10
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. PIF9 SWI9 FT9 RT9 EM9 IM9 9
0
0
0
0
0
1
Res. Res. Res. Res. EM40 IM40 PIF8 SWI8 FT8 RT8 EM8 IM8 8
0
0
0
0
0
0
0
1
Res. Res. Res. Res. EM39 IM39 PIF7 SWI7 FT7 RT7 EM7 IM7 7
0
0
0
0
0
0
0
0
0
0
0
0
PIF38 SWI38 FT38 RT38 EM38 IM38 PIF6 SWI6 FT6 RT6 EM6 IM6 6
0
0
0
0
0
0
0
0
0
0
0
PIF37 SWI37 FT37 RT37 EM37 0 IM37 PIF5 SWI5 FT5 RT5 EM5 IM5 5
Table 79. Extended interrupt/event controller register map and reset values
0
0
0
0
0
0
0
0
0
0
0
0
PIF36 SWI36 FT36 RT36 EM36 IM36 PIF4 SWI4 FT4 RT4 EM4 IM4 4
0
0
0
0
0
0
0
0
0
0
0
0
PIF35 SWI35 FT35 RT35 EM35 IM35 PIF3 SWI3 FT3 RT3 EM3 IM3 3
0
0
0
0
0
0
0
1
Res. Res. Res. Res. EM34 IM34 PIF2 SWI2 FT2 RT2 EM2 IM2 2
0
0
0
0
0
0
0
1
Res. Res. Res. Res. EM33 IM33 PIF1 SWI1 FT1 RT1 EM1 IM1 1
0
0
0
0
0
0
0
1
489/2301
Extended interrupts and events controller (EXTI)
489
Cyclic redundancy check calculation unit (CRC) RM0432
17.1 Introduction
The CRC (cyclic redundancy check) calculation unit is used to get a CRC code from 8-, 16-
or 32-bit data word and a generator polynomial.
Among other applications, CRC-based techniques are used to verify data transmission or
storage integrity. In the scope of the functional safety standards, they offer a means of
verifying the Flash memory integrity. The CRC calculation unit helps compute a signature of
the software during runtime, to be compared with a reference signature generated at link
time and stored at a given memory location.
CRC computation
MS19882V2
The input data can be reversed, to manage the various endianness schemes. The reversing
operation can be performed on 8 bits, 16 bits and 32 bits depending on the REV_IN[1:0] bits
in the CRC_CR register.
For example: input data 0x1A2B3C4D is used for CRC calculation as:
• 0x58D43CB2 with bit-reversal done by byte
• 0xD458B23C with bit-reversal done by half-word
• 0xB23CD458 with bit-reversal done on the full word
The output data can also be reversed by setting the REV_OUT bit in the CRC_CR register.
The operation is done at bit level: for example, output data 0x11223344 is converted into
0x22CC4488.
The CRC calculator can be initialized to a programmable value using the RESET control bit
in the CRC_CR register (the default value is 0xFFFFFFFF).
The initial CRC value can be programmed with the CRC_INIT register. The CRC_DR
register is automatically initialized upon CRC_INIT register write access.
The CRC_IDR register can be used to hold a temporary value related to CRC calculation. It
is not affected by the RESET bit in the CRC_CR register.
Polynomial programmability
The polynomial coefficients are fully programmable through the CRC_POL register, and the
polynomial size can be configured to be 7, 8, 16 or 32 bits by programming the
POLYSIZE[1:0] bits in the CRC_CR register. Even polynomials are not supported.
If the CRC data is less than 32-bit, its value can be read from the least significant bits of the
CRC_DR register.
To obtain a reliable CRC calculation, the change on-fly of the polynomial value or size can
not be performed during a CRC calculation. As a result, if a CRC calculation is ongoing, the
application must either reset it or perform a CRC_DR read before changing the polynomial.
The default polynomial value is the CRC-32 (Ethernet) polynomial: 0x4C11DB7.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DR[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DR[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
REV_
Res. Res. Res. Res. Res. Res. Res. Res. REV_IN[1:0] POLYSIZE[1:0] Res. Res. RESET
OUT
rw rw rw rw rw rs
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
CRC_INIT[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CRC_INIT[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
POL[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
POL[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
Offset Register
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
name
CRC_DR DR[31:0]
0x00
Reset value 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
CRC_IDR IDR[7:0]
0x04
Reset value 0 0 0 0 0 0 0 0
POLYSIZE[1:0]
REV_IN[1:0]
REV_OUT
RESET
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
CRC_CR
0x08
Reset value 0 0 0 0 0 0
CRC_INIT CRC_INIT[31:0]
0x10
Reset value 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
CRC_POL POL[31:0]
0x14
Reset value 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 1 0 0 0 1 1 1 0 1 1 0 1 1 0 1 1 1
18.1 Introduction
The flexible static memory controller (FSMC) includes two memory controllers:
• The NOR/PSRAM memory controller
• The NAND memory controller
This memory controller is also named flexible memory controller (FMC).
The Write FIFO can be disabled by setting the WFDIS bit in the FMC_BCR1 register.
At startup the FMC pins must be configured by the user application. The FMC I/O pins which
are not used by the application can be used for other purposes.
The FMC registers that define the external device type and associated characteristics are
usually set at boot time and do not change until the next reset or power-up. However, the
settings can be changed at any time.
NOR/PSRAM
FSMC_NL (or NADV)
signals
FSMC_CLK
From clock NOR/PSRAM
controller NOR / PSRAM / SRAM
memory FSMC_NBL[1:0]
HCLK shared signals
controller
FSMC_A[25:0]
Shared signals
FSMC_D[15:0]
FSMC_NE[4:1]
Configuration
FSMC_NOE NOR / PSRAM / SRAM
registers
NAND FSMC_NWE shared signals
memory FSMC_NWAIT
controller
FSMC_NCE
NAND signals
FSMC_INT
MSv39280V1
to any other value than 0, the FMC chip select (FMC_NEx) toggles between the
consecutive accesses. This feature is required when interfacing with FRAM memory.
• AHB transaction size is smaller than the memory size:
The transfer may or not be consistent depending on the type of external device:
– Accesses to devices that have the byte select feature (SRAM, ROM, PSRAM)
In this case, the FMC allows read/write transactions and accesses the right data
through its byte lanes NBL[1:0].
Bytes to be written are addressed by NBL[1:0].
All memory bytes are read (NBL[1:0] are driven low during read transaction) and
the useless ones are discarded.
– Accesses to devices that do not have the byte select feature (NOR and NAND
Flash memories)
This situation occurs when a byte access is requested to a 16-bit wide Flash
memory. Since the device cannot be accessed in Byte mode (only 16-bit words
can be read/written from/to the Flash memory), Write transactions and Read
transactions are allowed (the controller reads the entire 16-bit memory word and
uses only the required byte).
Configuration registers
The FMC can be configured through a set of registers. Refer to Section 18.7.6, for a
detailed description of the NOR Flash/PSRAM controller registers. Refer to Section 18.8.7,
for a detailed description of the NAND Flash registers.
0x6FFF FFFF
0x7000 0000
Not used
0x7FFF FFFF
0x8000 0000
Bank 3
NAND Flash memory
4 x 64 Mbyte
0x8FFF FFFF
0x9000 0000
Not used
0x9FFF FFFF
MSv34475V2
00 Bank 1 - NOR/PSRAM 1
01 Bank 1 - NOR/PSRAM 2
10 Bank 1 - NOR/PSRAM 3
11 Bank 1 - NOR/PSRAM 4
1. HADDR are internal AHB address lines that are translated to external memory.
The HADDR[25:0] bits contain the external memory address. Since HADDR is a byte
address whereas the memory is addressed at word level, the address actually issued to the
memory varies according to the memory data width, as shown in the following table.
1. In case of a 16-bit external memory width, the FMC internally uses HADDR[25:1] to generate the address
for external memory FMC_A[24:0].
Whatever the external memory width, FMC_A[0] should be connected to external memory address A[0].
For NAND Flash memory, the common and attribute memory spaces are subdivided into
three sections (see in Table 86 below) located in the lower 256 Kbytes:
• Data section (first 64 Kbytes in the common/attribute memory space)
• Command section (second 64 Kbytes in the common / attribute memory space)
• Address section (next 128 Kbytes in the common / attribute memory space)
The application software uses the 3 sections to access the NAND Flash memory:
• To sending a command to NAND Flash memory, the software must write the
command value to any memory location in the command section.
• To specify the NAND Flash address that must be read or written, the software
must write the address value to any memory location in the address section. Since an
address can be 4 or 5 bytes long (depending on the actual memory size), several
consecutive write operations to the address section are required to specify the full
address.
• To read or write data, the software reads or writes the data from/to any memory
location in the data section.
Since the NAND Flash memory automatically increments addresses, there is no need to
increment the address of the data section to access consecutive memory locations.
NE[x] O Chip select, x = 1..4 (called NCE by PSRAM (CellularRAM™ i.e. CRAM))
NOE O Output enable
NWE O Write enable
NL(= NADV) O Address valid PSRAM input (memory signal name: NADV)
NWAIT I PSRAM wait input signal to the FMC
NBL[1:0] O Byte lane output. Byte 0 and Byte 1 control (upper and lower byte enable)
Asynchronous R 8 16 Y -
Asynchronous W 8 16 N -
Asynchronous R 16 16 Y -
Asynchronous W 16 16 Y -
NOR Flash Asynchronous R 32 16 Y Split into 2 FMC accesses
(muxed I/Os
and nonmuxed Asynchronous W 32 16 Y Split into 2 FMC accesses
I/Os) Asynchronous
R - 16 N Mode is not supported
page
Synchronous R 8 16 N -
Synchronous R 16 16 Y -
Synchronous R 32 16 Y -
Asynchronous R 8 16 Y -
Asynchronous W 8 16 Y Use of byte lanes NBL[1:0]
Asynchronous R 16 16 Y -
Asynchronous W 16 16 Y -
Asynchronous R 32 16 Y Split into 2 FMC accesses
PSRAM
(multiplexed Asynchronous W 32 16 Y Split into 2 FMC accesses
I/Os and non- Asynchronous
multiplexed R - 16 N Mode is not supported
page
I/Os)
Synchronous R 8 16 N -
Synchronous R 16 16 Y -
Synchronous R 32 16 Y -
Synchronous W 8 16 Y Use of byte lanes NBL[1:0]
Synchronous W 16/32 16 Y -
Asynchronous R 8 / 16 16 Y -
Asynchronous W 8 / 16 16 Y Use of byte lanes NBL[1:0]
SRAM and
ROM Asynchronous R 32 16 Y Split into 2 FMC accesses
Split into 2 FMC accesses
Asynchronous W 32 16 Y
Use of byte lanes NBL[1:0]
A[25:0]
NBL[x:0]
NEx
NOE
NWE High
A[25:0]
NBL[x:0]
NEx
NOE
NWE
The DATAHLD time at the end of the read and write transactions guarantee the address and
data hold time after the NOE/NWE rising edge. The DATAST value must be greater than
zero (DATAST > 0).
Duration of the data hold phase (DATAHLD HCLK cycles for read
31:30 DATAHLD
accesses, DATAHLD+1 HCLK cycles for write accesses).
29:28 ACCMOD Don’t care
27:24 DATLAT Don’t care
23:20 CLKDIV Don’t care
19:16 BUSTURN Time between NEx high to NEx low (BUSTURN HCLK).
15:8 DATAST Duration of the second access phase (DATAST HCLK cycles).
7:4 ADDHLD Don’t care
Duration of the first access phase (ADDSET HCLK cycles).
3:0 ADDSET
Minimum value for ADDSET is 0.
A[25:0]
NBL[x:0]
NEx
NOE
NWE High
A[25:0]
NBL[x:0]
NEx
NOE
NWE
The differences compared with Mode 1 are the toggling of NOE and the independent read
and write timings.
Duration of the data hold phase (DATAHLD HCLK cycles for read
31:30 DATAHLD
accesses).
29:28 ACCMOD 0x0
27:24 DATLAT Don’t care
23:20 CLKDIV Don’t care
19:16 BUSTURN Time between NEx high to NEx low (BUSTURN HCLK).
Duration of the second access phase (DATAST HCLK cycles) for read
15:8 DATAST
accesses.
7:4 ADDHLD Don’t care
Duration of the first access phase (ADDSET HCLK cycles) for read
3:0 ADDSET accesses.
Minimum value for ADDSET is 0.
Duration of the data hold phase (DATAHLD+1 HCLK cycles for write
31:30 DATAHLD
accesses).
29:28 ACCMOD 0x0
27:24 DATLAT Don’t care
23:20 CLKDIV Don’t care
19:16 BUSTURN Time between NEx high to NEx low (BUSTURN HCLK).
Duration of the second access phase (DATAST HCLK cycles) for write
15:8 DATAST
accesses.
7:4 ADDHLD Don’t care
Duration of the first access phase (ADDSET HCLK cycles) for write
3:0 ADDSET accesses.
Minimum value for ADDSET is 0.
A[25:0]
NADV
NEx
NOE
NWE High
MSv41678V1
A[25:0]
NADV
NEx
NOE
NWE
MSv41679V1
A[25:0]
NADV
NEx
NOE
NWE
MSv41680V1
The differences with mode 1 are the toggling of NWE and the independent read and write
timings when extended mode is set (mode B).
Duration of the data hold phase (DATAHLD HCLK cycles for read
31:30 DATAHLD accesses and DATAHLD+1 HCLK cycles for write accesses when
Extended mode is disabled).
29:28 ACCMOD 0x1 if Extended mode is set
27:24 DATLAT Don’t care
23:20 CLKDIV Don’t care
19:16 BUSTURN Time between NEx high to NEx low (BUSTURN HCLK).
Duration of the access second phase (DATAST HCLK cycles) for
15:8 DATAST
read accesses.
7:4 ADDHLD Don’t care
Duration of the access first phase (ADDSET HCLK cycles) for read
3:0 ADDSET
accesses. Minimum value for ADDSET is 0.
Duration of the data hold phase (DATAHLD+1 HCLK cycles for write
31:30 DATAHLD
accesses).
29:28 ACCMOD 0x1 if Extended mode is set
27:24 DATLAT Don’t care
23:20 CLKDIV Don’t care
19:16 BUSTURN Time between NEx high to NEx low (BUSTURN HCLK).
Duration of the access second phase (DATAST HCLK cycles) for
15:8 DATAST
write accesses.
7:4 ADDHLD Don’t care
Duration of the access first phase (ADDSET HCLK cycles) for write
3:0 ADDSET
accesses. Minimum value for ADDSET is 0.
Note: The FMC_BWTRx register is valid only if the Extended mode is set (mode B), otherwise its
content is don’t care.
A[25:0]
NADV
NEx
NOE
NWE High
MSv41682V1
A[25:0]
NADV
NEx
NOE
NWE
MSv41679V1
The differences compared with mode 1 are the toggling of NOE and the independent read
and write timings.
Duration of the data hold phase (DATAHLD HCLK cycles for read
31:30 DATAHLD
accesses).
29:28 ACCMOD 0x2
27:24 DATLAT 0x0
23:20 CLKDIV 0x0
19:16 BUSTURN Time between NEx high to NEx low (BUSTURN HCLK).
Duration of the second access phase (DATAST HCLK cycles) for
15:8 DATAST
read accesses.
7:4 ADDHLD Don’t care
Duration of the first access phase (ADDSET HCLK cycles) for read
3:0 ADDSET
accesses. Minimum value for ADDSET is 0.
Duration of the data hold phase (DATAHLD+1 HCLK cycles for write
31:30 DATAHLD
accesses).
29:28 ACCMOD 0x2
27:24 DATLAT Don’t care
23:20 CLKDIV Don’t care
19:16 BUSTURN Time between NEx high to NEx low (BUSTURN HCLK).
Duration of the second access phase (DATAST HCLK cycles) for
15:8 DATAST
write accesses.
7:4 ADDHLD Don’t care
Duration of the first access phase (ADDSET HCLK cycles) for write
3:0 ADDSET
accesses. Minimum value for ADDSET is 0.
A[25:0]
NADV
NBL[x:0]
NEx
NOE
NWE High
A[25:0]
NADV
NBL[x:0]
NEx
NOE
NWE
The differences with mode 1 are the toggling of NOE that goes on toggling after NADV
changes and the independent read and write timings.
7 Reserved 0x1
6 FACCEN Set according to memory support
5:4 MWID As needed
3:2 MTYP As needed
1 MUXEN 0x0
0 MBKEN 0x1
Duration of the data hold phase (DATAHLD HCLK cycles for read
31:30 DATAHLD
accesses).
29:28 ACCMOD 0x3
27:24 DATLAT Don’t care
23:20 CLKDIV Don’t care
19:16 BUSTURN Time between NEx high to NEx low (BUSTURN HCLK).
Duration of the second access phase (DATAST HCLK cycles) for read
15:8 DATAST
accesses.
Duration of the middle phase of the read access (ADDHLD HCLK
7:4 ADDHLD
cycles)
Duration of the first access phase (ADDSET HCLK cycles) for read
3:0 ADDSET
accesses. Minimum value for ADDSET is 1.
Duration of the data hold phase (DATAHLD+1 HCLK cycles for write
31:30 DATAHLD
accesses).
29:28 ACCMOD 0x3
27:24 DATLAT Don’t care
23:20 CLKDIV Don’t care
19:16 BUSTURN Time between NEx high to NEx low (BUSTURN HCLK).
15:8 DATAST Duration of the second access phase (DATAST HCLK cycles).
Duration of the middle phase of the write access (ADDHLD HCLK
7:4 ADDHLD
cycles)
Duration of the first access phase (ADDSET HCLK cycles) for write
3:0 ADDSET
accesses. Minimum value for ADDSET is 1.
A[25:16]
NADV
NBL[x:0]
NEx
NOE
NWE High
A[25:16]
NADV
NBL[x:0]
NEx
NOE
NWE
The difference with mode D is the drive of the lower address byte(s) on the data bus.
6 FACCEN 0x1
5:4 MWID As needed
3:2 MTYP 0x2 (NOR Flash memory) or 0x1(PSRAM)
1 MUXEN 0x1
0 MBKEN 0x1
Duration of the data hold phase (DATAHLD HCLK cycles for read
31:30 DATAHLD
accesses, DATAHLD+1 HCLK cycles for write accesses).
29:28 ACCMOD 0x0
27:24 DATLAT Don’t care
23:20 CLKDIV Don’t care
19:16 BUSTURN Time between NEx high to NEx low (BUSTURN HCLK).
15:8 DATAST Duration of the second access phase (DATAST HCLK cycles).
7:4 ADDHLD Duration of the middle phase of the access (ADDHLD HCLK cycles).
Duration of the first access phase (ADDSET HCLK cycles). Minimum
3:0 ADDSET
value for ADDSET is 1.
1. The memory asserts the WAIT signal aligned to NOE/NWE which toggles:
DATAST ≥ ( 4 × HCLK ) + max_wait_assertion_time
2. The memory asserts the WAIT signal aligned to NEx (or NOE/NWE not toggling):
if
max_wait_assertion_time > address_phase + hold_phase
then:
Memory transaction
A[25:0]
NOE
4HCLK
MS30463V2
Memory transaction
A[25:0]
NEx
1HCLK
NWE
3HCLK
MSv40168V1
Single-burst transfer
When the selected bank is configured in Burst mode for synchronous accesses, if for
example an AHB single-burst transaction is requested on 16-bit memories, the FMC
performs a burst transaction of length 1 (if the AHB transfer is 16 bits), or length 2 (if the
AHB transfer is 32 bits) and de-assert the chip select signal when the last data is strobed.
Such transfers are not the most efficient in terms of cycles compared to asynchronous read
operations. Nevertheless, a random asynchronous access would first require to re-program
the memory access mode, which would altogether last longer.
Wait management
For synchronous NOR Flash memories, NWAIT is evaluated after the programmed latency
period, which corresponds to (DATLAT+2) CLK clock cycles.
If NWAIT is active (low level when WAITPOL = 0, high level when WAITPOL = 1), wait
states are inserted until NWAIT is inactive (high level when WAITPOL = 0, low level when
WAITPOL = 1).
When NWAIT is inactive, the data is considered valid either immediately (bit WAITCFG = 1)
or on the next clock edge (bit WAITCFG = 0).
During wait-state insertion via the NWAIT signal, the controller continues to send clock
pulses to the memory, keeping the chip select and output enable signals valid. It does not
consider the data as valid.
In Burst mode, there are two timing configurations for the NOR Flash NWAIT signal:
• The Flash memory asserts the NWAIT signal one data cycle before the wait state
(default after reset).
• The Flash memory asserts the NWAIT signal during the wait state
The FMC supports both NOR Flash wait state configurations, for each chip select, thanks to
the WAITCFG bit in the FMC_BCRx registers (x = 0..3).
HCLK
CLK
A[25:16] addr[25:16]
NADV
NWAIT
(WAITCFG = 0)
NWAIT
(WAITCFG = 1)
inserted wait state
ai15798c
Figure 64. Synchronous multiplexed read mode waveforms - NOR, PSRAM (CRAM)
HCLK
CLK
A[25:16] addr[25:16]
NEx
NOE
High
NWE
NADV
NWAIT
(WAITCFG=
0)
(DATLAT + 2) inserted wait state
CLK cycles
A/D[15:0] Addr[15:0] data data data data
1 clock 1 clock
cycle cycle
Data strobes Data strobes
ai17723f
1. Byte lane outputs (NBL are not shown; for NOR access, they are held high, and, for PSRAM (CRAM)
access, they are held low.
10 Reserved 0x0
9 WAITPOL To be set according to memory
8 BURSTEN 0x1
7 Reserved 0x1
6 FACCEN Set according to memory support (NOR Flash memory)
5-4 MWID As needed
3-2 MTYP 0x1 or 0x2
1 MUXEN As needed
0 MBKEN 0x1
HCLK
CLK
A[25:16] addr[25:16]
NEx
Hi-Z
NOE
NWE
NADV
NWAIT
(WAITCFG = 0)
1. The memory must issue NWAIT signal one cycle in advance, accordingly WAITCFG must be programmed to 0.
2. Byte Lane (NBL) outputs are not shown, they are held low while NEx is active.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
CCLK CBURST
Res. Res. Res. Res. Res. Res. Res. Res. NBLSET[1:0] WFDIS CPSIZE[2:0]
EN RW
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ASYNC EXT WAIT WAIT WAIT BURST FACC MUX MBK
WREN Res. Res. MWID[1:0] MTYP[1:0]
WAIT MOD EN CFG POL EN EN EN EN
rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DATAHLD[1:0] ACCMOD[1:0] DATLAT[3:0] CLKDIV[3:0] BUSTURN[3:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DATAST[7:0] ADDHLD[3:0] ADDSET[3:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
Note: PSRAMs (CRAMs) have a variable latency due to internal refresh. Therefore these
memories issue the NWAIT signal during the whole latency phase to prolong the latency as
needed.
With PSRAMs (CRAMs) the filled DATLAT must be set to 0, so that the FMC exits its latency
phase soon and starts sampling NWAIT from memory, then starts to read or write when the
memory is ready.
This method can be used also with the latest generation of synchronous Flash memories
that issue the NWAIT signal, unlike older Flash memories (check the datasheet of the
specific Flash memory being used).
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DATAHLD[1:0] ACCMOD[1:0] Res. Res. Res. Res. Res. Res. Res. Res. BUSTURN[3:0]
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DATAST[7:0] ADDHLD[3:0] ADDSET[3:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
CNTB4EN
CNTB3EN
CNTB2EN
CNTB1EN
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CSCOUNT[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
Theoretically, there is no capacity limitation as the FMC can manage as many address
cycles as needed.
Theoretically, there is no capacity limitation as the FMC can manage as many address
cycles as needed.
Asynchronous R 8 8 Y -
Asynchronous W 8 8 Y -
Asynchronous R 16 8 Y Split into 2 FMC accesses
NAND 8-bit
Asynchronous W 16 8 Y Split into 2 FMC accesses
Asynchronous R 32 8 Y Split into 4 FMC accesses
Asynchronous W 32 8 Y Split into 4 FMC accesses
Asynchronous R 8 16 Y -
Asynchronous W 8 16 N -
Asynchronous R 16 16 Y -
NAND 16-bit
Asynchronous W 16 16 Y -
Asynchronous R 32 16 Y Split into 2 FMC accesses
Asynchronous W 32 16 Y Split into 2 FMC accesses
Figure 66. NAND Flash controller waveforms for common memory access
HCLK
A[25:0]
NCEx
NREG, High
NIOW,
NIOR MEMxSET
+1 MEMxWAIT + 1 MEMxHOLD
NWE,
NOE (1)
MEMxHIZ + 1
write_data
read_data Valid
MS33733V3
1. NOE remains high (inactive) during write accesses. NWE remains high (inactive) during read accesses.
2. For write access, the hold phase delay is (MEMHOLD) HCLK cycles and for read access is
(MEMHOLD + 2) HCLK cycles.
to implement the prewait functionality needed by some NAND Flash memories (see
details in Section 18.8.5: NAND Flash prewait functionality).
4. The controller waits for the NAND Flash memory to be ready (R/NB signal high), before
starting a new access to the same or another memory bank. While waiting, the
controller holds the NCE signal active (low).
5. The CPU can then perform byte read operations from the common memory space to
read the NAND Flash page (data field + Spare field) byte by byte.
6. The next NAND Flash page can be read without any CPU command or address write
operation. This can be done in three different ways:
– by simply performing the operation described in step 5
– a new random address can be accessed by restarting the operation at step 3
– a new command can be sent to the NAND Flash device by restarting at step 2
When this functionality is required, it can be ensured by programming the MEMHOLD value
to meet the tWB timing. However any CPU read access to the NAND Flash memory has a
hold delay of (MEMHOLD + 2) HCLK cycles and CPU write access has a hold delay of
(MEMHOLD) HCLK cycles inserted between the rising edge of the NWE signal and the next
access.
To cope with this timing constraint, the attribute memory space can be used by
programming its timing register with an ATTHOLD value that meets the tWB timing, and by
keeping the MEMHOLD value at its minimum value. The CPU must then use the common
memory space for all NAND Flash read and write accesses, except when writing the last
address byte to the NAND Flash device, where the CPU must write to the attribute memory
space.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. ECCPS[2:0] TAR3
rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
TAR[2:0] TCLR[3:0] Res. Res. ECCEN PWID[1:0] PTYP PBKEN PWAITEN Res.
rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. FEMPT IFEN ILEN IREN IFS ILS IRS
r rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
MEMHIZ[7:0] MEMHOLD[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
MEMWAIT[7:0] MEMSET[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
ATTHIZ[7:0] ATTHOLD[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ATTWAIT[7:0] ATTSET[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
ECC[31:16]
r r r r r r r r r r r r r r r r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ECC[15:0]
r r r r r r r r r r r r r r r r
10
11
9
8
7
6
5
4
3
2
1
0
ASYNCWAIT
CBURSTRW
BURSTEN
WAITCFG
WAITPOL
EXTMOD
CCLKEN
FACCEN
NBL
WAITEN
MUXEN
MBKEN
WFDIS
WREN
CPSIZE MWID MTYP
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
FMC_BCR1 SET
0x00 [2:0] [1:0] [1:0]
[1:0]
Reset value 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 1 1 0 1 1
ASYNCWAIT
CBURSTRW
BURSTEN
WAITCFG
WAITPOL
EXTMOD
FACCEN
NBL
WAITEN
MUXEN
MBKEN
WREN
CPSIZE MWID MTYP
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
FMC_BCR2 SET
0x08 [2:0] [1:0] [1:0]
[1:0]
Reset value 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 1 0
ASYNCWAIT
CBURSTRW
BURSTEN
WAITCFG
WAITPOL
EXTMOD
FACCEN
NBL
WAITEN
MUXEN
MBKEN
WREN
CPSIZE MWID MTYP
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
FMC_BCR3 SET
0x10 [2:0] [1:0] [1:0]
[1:0]
Reset value 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 1 0
ASYNCWAIT
CBURSTRW
BURSTEN
WAITCFG
WAITPOL
EXTMOD
FACCEN
NBL
WAITEN
MUXEN
MBKEN
WREN
CPSIZE MWID MTYP
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
FMC_BCR4 SET
0x18 [2:0] [1:0] [1:0]
[1:0]
Reset value 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 1 0
DATAHLD [1:0]]
ACCMOD[1:0]
BUSTURN
FMC_BTR1 DATLAT[3:0] CLKDIV[3:0] DATAST[7:0] ADDHLD[3:0] ADDSET[3:0]
0x04 [3:0]
Reset value 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
DATAHLD [1:0]]
ACCMOD[1:0]
BUSTURN
FMC_BTR2 DATLAT[3:0] CLKDIV[3:0] DATAST[7:0] ADDHLD[3:0] ADDSET[3:0]
0x0C [3:0]
Reset value 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
DATAHLD [1:0]]
ACCMOD[1:0]
BUSTURN
FMC_BTR3 DATLAT[3:0] CLKDIV[3:0] DATAST[7:0] ADDHLD[3:0] ADDSET[3:0]
0x14 [3:0]
Reset value 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
DATAHLD [1:0]]
ACCMOD[1:0]
BUSTURN
FMC_BTR4 DATLAT[3:0] CLKDIV[3:0] DATAST[7:0] ADDHLD[3:0] ADDSET[3:0]
0x1C [3:0]
Reset value 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
CNTB4EN
CNTB3EN
CNTB2EN
CNTB1EN
FMC_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
CSCOUNT[15:0]
0x20 PCSCNTR
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
DATAHLD [1:0]]
ACCMOD[1:0]
BUSTURN
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
FMC_BWTR1 DATAST[7:0] ADDHLD[3:0] ADDSET[3:0]
0x104 [3:0]
Reset value 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
DATAHLD [1:0]]
ACCMOD[1:0]
BUSTURN
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
FMC_BWTR2 DATAST[7:0] ADDHLD[3:0] ADDSET[3:0]
0x10C [3:0]
Reset value 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
DATAHLD [1:0]]
ACCMOD[1:0]
BUSTURN
Res.
Res.
Res.
Res.
Res.
Res.
Res.
FMC_BWTR3 Res. DATAST[7:0] ADDHLD[3:0] ADDSET[3:0]
0x114 [3:0]
Reset value 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
DATAHLD [1:0]]
ACCMOD[1:0]
BUSTURN
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Reset value 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
PWAITEN
ECCEN
PBKEN
ECCPS PWID
PTYP
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
FMC_PCR TAR[3:0] TCLR[3:0]
0x80 [2:0] [1:0]
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0
FEMPT
IREN
IFEN
ILEN
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
IRS
FMC_SR
IFS
ILS
0x84
Reset value 1 0 0 0 0 0 0
FMC_PMEM MEMHIZx[7:0] MEMHOLDx[7:0] MEMWAITx[7:0] MEMSETx[7:0]
0x88
Reset value 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0
FMC_PATT ATTHIZ[7:0] ATTHOLD[7:0] ATTWAIT[7:0] ATTSET[7:0]
0x8C
Reset value 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0
FMC_ECCR ECCx[31:0]
0x94
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
19.1 Introduction
The OCTOSPI supports two frame formats used by most external serial memories such as
serial PSRAMs, serial NAND and serial NOR Flash memories, HyperRAM™ and
HyperFlash™ memories:
• Indirect mode: all the operations are performed using the OCTOSPI registers.
• Status polling-mode: the external memory status register is periodically read and an
interrupt can be generated in case of flag setting.
• Memory-mapped mode: the external memory is memory mapped and it is seen by the
system as if it was an internal memory supporting both read and write operations.
The OCTOSPI supports two frame formats:
• the classical frame format with the command, address, alternate byte, dummy cycles
and data phase
• the HyperBus™ frame format
Registers/ Clock
AHB/ control management Octo-SPI memory
AXI
OCTOSPI_CLK CLK
OCTOSPI_IO0 IO0
FIFO OCTOSPI_IO1 IO1
OCTOSPI_IO2 IO2
OCTOSPI_IO3 IO3
Shift OCTOSPI_IO4 IO4
register OCTOSPI_IO5 IO5
OCTOSPI_IO6 IO6
OCTOSPI_IO7 IO7
OCTOSPI_NCS NCS
OCTOSPI_DQS DQS
MSv43485V2
Registers/ Clock
AHB/ control management Quad-SPI memory
AXI
OCTOSPI_CLK CLK
OCTOSPI_IO0 Q0/SI
FIFO OCTOSPI_IO1 Q1/SO
Shift OCTOSPI_IO2 Q2/WP
register OCTOSPI_IO3 Q3/HOLD
OCTOSPI_nCS CS
MSv43486V2
Registers/ Clock
AHB/ control management Quad-SPI memory 1
AXI
OCTOSPI_CLK CLK
OCTOSPI_IO0 Q0/SI
FIFO OCTOSPI_IO1 Q1/SO
OCTOSPI_IO2 Q2/WP
OCTOSPI_IO3 Q3/HOLD
OCTOSPI_nCS CS
Shift
register Quad-SPI memory 2
CLK
OCTOSPI_IO4 Q0/SI
OCTOSPI_IO5 Q1/SO
OCTOSPI_IO6 Q2/WP
OCTOSPI_IO7 Q3/HOLD
CS
MSv43487V2
The nCS falls before the start of each command and rises again after each command
finishes.
In Memory-mapped mode, both read and write operation are supported, as a consequence,
some of the configuration registers are duplicated to specify write operations (read
operations are configured using regular registers).
CS#
≈ ≈
CLK
Pre-drive
≈
IO[7:0] ECh 13h A[31:24] A[23:16] A[15:8] A[7:0] D0 D1 D2 D3
Address Dummy
MSv43488V1
The specific Regular-command mode features are configured through the registers in the
0x0100-0x01FC offset range.
Instruction phase
During this phase, a 1- to 4-byte instruction is sent to the external device specifying the type
of operation to be performed. The size of the instruction to be sent is configured in the
ISIZE[1:0] field of the OCTOSPI_CCR register and the instruction is programmed in the
INSTRUCTION[31:0] field of the OCTOSPI_IR register.
Most of the devices can receive instructions only 1 bit at a time from the IO0/SO signal
(Single-SPI mode), the instruction phase can optionally send 2 bits at a time (over IO0/IO1
in Dual-SPI mode), 4 bits at a time (over IO0 to IO3 in Quad-SPI mode) or 8-bits at a time
(over IO0 to IO7 in Octal SPI mode). This can be configured using the IMODE[2:0] field of
the OCTOSPI_CCR register.
The instruction can be sent in DTR (double-transfer rate) mode on each rising and falling
edge of the clock, by setting the IDTR bit in OCTOSPI_CCR.
When IMODE[2:0] = 000 in OCTOSPI_CCR, the instruction phase is skipped, and the
command sequence starts with the address phase, if present.
When in Memory-mapped mode, the instruction used for the write operation is specified in
the OCTOSPI_WIR register and the instruction format is specified in the OCTOSPI_WCCR
register. The instruction used for the read operation and the instruction format are specified
in the regular registers OCTOSPI_IR and OCTOSPI_CCR.
Address phase
In the address phase, 1 to 4 bytes are sent to the external device, to indicate the address of
the operation. The number of address bytes to be sent is configured in the ADSIZE[1:0] field
of the OCTOSPI_CCR register.
In Indirect and Automatic-polling modes, the address bytes to be sent are specified in the
ADDRESS[31:0] field of the OCTOSPI_AR register. In Memory-mapped mode, the address
is given directly via the AHB (from the Cortex-M core or from a DMA).
The address phase can send 1 it at a time (over SO in Single-SPI mode), 2 bits at a time
(over IO0/IO1 in Dual-SPI mode), 4 bits at a time (over IO0 to IO3 in Quad-SPI mode) or
8 bits at a time (over IO0 to IO7 in Octal SPI mode). This can be configured using the
ADMODE[2:0] field of the OCTOSPI_CCR register.
The address can be sent in DTR mode (on each rising and falling edge of the clock) setting
the ADDTR bit in OCTOSPI_CCR.
When ADMODE[2:0] = 000, the address phase is skipped and the command sequence
proceeds directly to the next phase, if any.
In Memory-mapped mode, the address format for the write operation is specified in the
OCTOSPI_WCCR register. The address format for the read operation is specified in the
regular register OCTOSPI_CCR.
Alternate-bytes phase
In the alternate-bytes phase, 1 to 4 bytes are sent to the external device, generally to control
the mode of operation. The number of alternate bytes to be sent is configured in the
ABSIZE[1:0] field of the OCTOSPI_CCR register. The bytes to be sent are specified in the
OCTOSPI_ABR register.
The alternate-bytes phase can send 1 bit at a time (over SO in Single-SPI mode), 2 bits at a
time (over IO0 and IO1 in Dual-SPI mode), 4 bits at a time (over IO0 to IO3 in Quad-SPI
mode) or 8 bits at a time (over IO0 to IO7 in Octal SPI mode). This can be configured using
the ABMODE[2:0] field of the OCTOSPI_CCR register.
The alternate bytes can be sent in DTR mode (on each rising and falling edge of the clock)
setting the ABDTR bit of OCTOSPI_CCR.
When ABMODE[2:0] = 000, the alternate-bytes phase is skipped and the command
sequence proceeds directly to the next phase, if any.
There may be times when only a single nibble needs to be sent during the alternate-byte
phase rather than a full byte, such as when the Dual-SPI mode is used and only two cycles
are used for the alternate bytes.
In this case, the firmware can use the Quad-SPI mode (ABMODE[2:0] = 011) and send a
byte with bits 7 and 3 of ALTERNATE[31:0] set to 1 (keeping the IO3 line high), and bits 6
and 2 set to 0 (keeping the IO2 line low), in the OCSTOSPI_IR register.
The upper two bits of the nibble to be sent are then placed in bits 4:3 of ALTERNATE[31:0]
while the lower two bits are placed in bits 1 and 0. For example, if the nibble 2 (0010) is to be
sent over IO0/IO1, then ALTERNATE[31:0] must be set to 0x8A (1000_1010).
In Memory-mapped mode, the alternate bytes used for the write operation are specified in
the OCTOSPI_WABR register and the alternate byte format is specified in the
OCTOSPI_WCCR register. The alternate bytes used for read operation and the alternate
byte format are specified in the regular registers OCTOSPI_ABR and OCTOSPI_CCR.
Dummy-cycles phase
In the dummy-cycles phase, 1 to 31 cycles are given without any data being sent or
received, in order to give the external device, the time to prepare for the data phase when
the higher clock frequencies are used. The number of cycles given during this phase is
specified in the DCYC[4:0] field of the OCTOSPI_TCR register. In both SDR and DTR
modes, the duration is specified as a number of full CLK cycles.
When DCYC[4:0] = 00000, the dummy-cycles phase is skipped, and the command
sequence proceeds directly to the data phase, if present.
In order to assure enough “turn-around” time for changing the data signals from the output
mode to the input mode, there must be at least one dummy cycle when using the Dual-SPI,
the Quad-SPI or the Octal-SPI mode, to receive data from the external device.
It is recommended to have at least five dummy cycles when using memories with DQS
activated.
In Memory-mapped mode, the dummy cycles for the write operations are specified in the
OCTOSPI_WTCR register. The dummy cycles for the read operation are specified in the
regular register (OCTOSPI_TCR)
Data phase
During the data phase, any number of bytes can be sent to or received from the external
device.
In Indirect mode, the number of bytes to be sent/received is specified in the OCTOSPI_DLR
register. In this mode, the data to be sent to the external device must be written to the
OCTOSPI_DR register, while in Indirect-read mode the data received from the external
device is obtained by reading from the OCTOSPI_DR register.
In Automatic-polling mode, the number of bytes to be received is specified in the
OCTOSPI_DLR register and the data received from the external device can be obtained by
reading from the OCTOSPI_DR register.
In Memory-mapped mode, the data read or written, is sent or received directly over the AHB
to the Cortex core or to a DMA.
The data phase can send/receive 1 bit at a time (over SO/SI in Single-SPI mode), 2 bits at a
time (over IO0/IO1 in Dual-SPI mode), 4 bits at a time (over IO0 to IO3 in Quad-SPI mode)
or 8 bits at a time (over IO0 to IO7 in Octal SPI mode). This can be configured using the
DMODE[2:0] field of the OCTOSPI_CCR register.
The data can be sent or received in DTR mode (on each rising and falling edge of the clock)
setting the DDTR bit of OCTOSPI_CCR.
When DMODE[2:0] = 000, the data phase is skipped, and the command sequence finishes
immediately by raising the nCS. This configuration must be used only in Indirect-write mode.
In Memory-mapped mode, the data format for the write operation is specified in the
OCTOSPI_WCCR register. The data format for the read operation is specified in the regular
register OCTOSPI_CCR.
DQS usage
The DQS signal can be used for data strobing during the read transactions when the device
toggles the DQS aligned with the data.
The DQS management can be enabled by setting the DQS enable (DQSE) bit of
OCTOSPI_CCR.
Figure 72. DTR read in Octal mode with DQS (Macronix mode) example
CS#
≈
CLK
≈
≈
DQS
≈
IO[7:0] EEh 11h A[31:24] A[23:16] A[15:8] A[7:0] D1 D0 D3 D2
Word Word
Address Dummy unit unit
MSv43489V1
Dual-SPI mode
In Dual-SPI mode, two bits are sent/received simultaneously over the IO0/IO1 signals.
The different phases can each be configured separately to use Dual-SPI mode by setting
to 010 the IMODE/ADMODE/ABMODE/DMODE fields (in OCTOSPI_CCR and
OCTOSPI_WCCR).
In each phase configured in Dual-SPI mode:
• IO0/IO1 are at high-impedance (input) during the data phase for the read operations,
and outputs in all other cases.
• IO2 is in output mode and forced to 0.
• IO3 is in output mode and forced to 1.
• IO4/IO5/IO6/IO7 are in output mode and forced to 0.
In the dummy phase when DMODE[2:0] = 010, IO0/IO1 are always high-impedance.
Quad-SPI mode
In Quad-SPI mode, four bits are sent/received simultaneously over the IO0/IO1/IO2/IO3
signals.
The different phases can each be configured separately to use the Quad-SPI mode by
setting to 011 the IMODE/ADMODE/ABMODE/DMODE fields (in OCTOSPI_CCR and
OCTOSPI_WCCR).
In each phase configured in Quad-SPI mode:
• IO0/IO1/IO2/IO3 are all are at high-impedance (input) during the data phase for the
read operations, and outputs in all other cases.
• IO4/IO5/IO6/IO7 are in output mode and forced to 0.
In the dummy phase when DMODE[2:0] = 011, IO0/IO1/IO2/IO3 are all high-impedance.
IO2 and IO3 are used only in Quad-SPI mode. If none of the phases are configured to use
the Quad-SPI mode, then the pins corresponding to IO2 and IO3 can be used for other
functions even while the OCTOSPI is active.
Octo-SPI mode
In regular Octo-SPI mode, the eight bits are sent/received simultaneously over the IO[0:7]
signals.
The different phases can each be configured separately to use the Octo-SPI mode by
setting to 100 the IMODE/ADMODE/ABMODE/DMODE fields (in OCTOSPI_CCR and
OCTOSPI_WCCR).
In each phase that is configured in Octal mode, IO[0:7] are all at high-impedance (input)
during the data phase for read operations, and outputs in all other cases.
In the dummy phase when DMODE[2:0] = 100, IO[0:7] are all high-impedance.
IO[4:7] are used only in Octo-SPI mode. If none of the phases are configured to use
Octo-SPI mode, then the pins corresponding to IO[4:7] can be used for other functions even
while the OCTOSPI is active.
CLK
≈
≈≈
MSv43490V1
CS#
CLK ≈
≈ ≈ ≈
MSv43491V1
Dual-quad mode
When the DQM = 1 in OCTOSPI_CR, the OCTOSPI is in Dual-quad mode: two external
Quad-SPI devices (device A and device B) are used in order to send/receive 8 bits (or
16 bits in DTR mode) every cycle, effectively doubling the throughput as well as the
capacity.
Each device (A or B) uses the same CLK and nCS signals, but each has separate IO0, IO1,
IO2, and IO3 signals.
The Dual-quad mode can be used in conjunction with the Single-bit, Dual-bit, and Quad-bit
modes, as well as with either the SDR or the DTR mode.
The device size, as specified in DEVSIZE[4:0] of OCTOSPI_DCR1, must reflect the total
external device capacity, that is the double of the size of one individual component.
If address X is even, then the byte that the OCTOSPI gives for address X is the byte at the
address X/2 of device A, and the byte that the OCTOSPI gives for address X + 1 is the byte
at the address X/2 of device B. In other words, the bytes at even addresses are all stored in
device A and the bytes at odd addresses are all stored in device B.
When reading the status registers of the devices in Dual-quad mode, twice as many bytes
must be read compared to the same read in Regular mode: if each device gives eight valid
bits after the instruction for fetching the status register, then the OCTOSPI must be
configured with a data length of 2 bytes (16 bits), and the OCTOSPI receives one byte from
each device.
If each device gives a status of 16 bits, then the OCTOSPI must be configured to read
4 bytes to get all the status bits of both devices in Dual-quad mode. The least-significant
byte of the result (in the data register) is the least-significant byte of device A status register.
The next byte is the least-significant byte of device B status register. Then, the third byte of
the data register is the device A second byte. The forth byte is the device B second byte (if
devices have 16-bit status registers).
An even number of bytes must always be accessed in Dual-quad mode. For this reason,
bit 0 of the DL[31:0] field in OCTOSPI_DLR is stuck at 1 when DQM = 1.
In Dual-quad mode, the behavior of device A interface signals is basically the same as in
Normal mode. Device B interface signals have exactly the same waveforms as Device A
ones during the instruction, address, alternate-byte, and dummy-cycles phases. In other
words, each device always receives the same instruction and the same address.
Then, during the data phase, the AIOx and the BIOx buses both transfer data in parallel, but
the data that is sent to (or received from) device A is distinct than the one from device B.
CS#
CK
Command-Address
Memory drives DQ[7:0]
and RWDS
Host drives DQ[7:0] and Memory drives RWDS
MSv43492V1
The specific HyperBus features are configured through the registers in the 0x0200-0x02FC
offset range.
Command/address phase
During this initial phase, the OCTOSPI sends 48 bits over IO[7:0] to specify the operations
to be performed with the external device.
The address space is configured through the memory type MTYP[2:0] field of the
OCTOSPI_DCR1 register.
The total size of the device is configured in the device size DEVSIZE[4:0] field of the
OCTOSPI_DCR1 register. In case of multi-chip product (MCP), the device size is the sum of
all the sizes of all the dies of the MCP.
During the read operation, the RWDS is used by the device, in two ways:
• during the command/address phase, to request an additional latency
• during the data phase, for data strobing
CS#
CK
Command-Address
Memory drives DQ[7:0]
and RWDS
Host drives DQ[7:0] and Memory drives RWDS
MSv43492V1
CS#
CK
CK
Latency Count 1 Latency Count 2
MSv43495V1
CS#
Additional Latency
tRWR= Read Write Recovery
t ACC = Initial Access
CK
CS#
CK
Command-Address Data
MSv43497V1
12 Clock 9 Words
Initial Latency Data
CS#
CK
3 Clock Initial Page
Crossing Latency
RDS
DQ[7:0] A0 02 46 8A 80 07 dd dd dd dd dd dd dd dd dd dd dd dd dd dd
Read from Address = 123457h Address Address Address Address Address Address Address
123457 123458 12345D 12345E 12345F 123460 123461
MSv43498V1
The CS boundary feature limits a transaction to a boundary of aligned addresses. The size
of the address to be aligned with, is configured in the CS boundary CSBOUND[4:0] field of
OCTOSPI_DCR3 and it is equal to 2CSBOUND.
As an example, if CSBOUND(4:0] = 0x4, the boundary is set to 24 = 16 bytes. As a
consequence, the nCS is released each time that the LSB address is equal to 0xF and each
time that a new transaction is issued to address the next data.
If CSBOUND[4:0] = 0, the feature is disabled and a minimum value of 3 is recommended.
The CS boundary feature cannot be used for Flash memory devices in write mode since a
command is necessary to program another page of the Flash memory.
The refresh feature limits the duration of the transactions to the value programmed in the
REFRESH[31:0] field of OCTOSPI_DCR4. The duration is expressed in number of cycles.
This allows an external RAM to perform its internal refresh operation regularly.
The refresh value must be greater than the minimal transaction size in terms of number of
cycles including the command/address/alternate/dummy phases.
If CS boundary and refresh are enabled at the same time, the nCS is released on the first
condition met.
The access to the device begins in the same manner as in Indirect-read mode. The BUSY
bit in OCTOSPI_SR goes high at this point and stays high even between the periodic
accesses.
The content of MASK[31:0] in OCTOSPI_PSMAR is used to mask the data from the
external device in Automatic-polling mode:
• If the MASK[n] = 0, then bit n of the result is masked and not considered.
• If MASK[n] = 1, and the content of bit[n] is the same as MATCH[n] in
OCTOSPI_PSMAR, /°then there is a match for bit n.
If the polling match mode PMM bit in OCTOSPI_CR is 0, the AND-match mode is activated:
the status match flag (SMF) is set in OCTOSPI_SR only when there is a match on all of the
unmasked bits.
If PMM = 1 in OCTOSPI_CR, the OR-match mode is activated: SMF gets set if there is a
match on any of the unmasked bits.
An interrupt is called when SMF = 1 if SMIE = 1.
If the Automatic-polling mode stop APMS bit is set in OCTOSPI_CR, the operation stops
and BUSY goes to 0 as soon as a match is detected. Otherwise, BUSY stays at 1 and the
periodic accesses continue until there is an abort or until the OCTOSPI is disabled (EN = 0).
The OCTOSPI_DR register contains the latest received status bytes (FIFO deactivated).
The content of this register is not affected by the masking used in the matching logic. The
FTF status bit in OCTOSPI_SR is set as soon as a new reading of the status is complete.
FTF is cleared as soon as the data is read.
In Automatic-polling mode, variable latency is not supported. As a consequence, the
memory must be configured in Fixed latency.
DEVSIZE[4:0] defines the size of external memory using the following formula:
Number of bytes in the device = 2[DEVSIZE+1]
where DEVSIZE+1 is the number of address bits required to address the external device.
The external device capacity can go up to 4 Gbytes (addressed using 32 bits) in Indirect
mode, but the addressable space in Memory-mapped mode is limited to 256 Mbytes.
If DQM = 1, DEVSIZE[4:0] indicates the total capacity of the two devices together.
When the OCTOSPI executes two commands, one immediately after the other, it raises the
chip-select signal (nCS) high between the two commands for only one CLK cycle by default.
If the external device requires more time between commands, the chip-select high time
CSHT[5:0] field can be used to specify the minimum number of CLK cycles (up to 64) for
which the nCS must remain high.
Note: The CLK cycles are up to 64 when extended CSHT timeout feature is supported and up to 8
when it is not supported. Refer to Section 19.3: OCTOSPI implementation.
The clock mode CKMODE bit indicates the level that the CLK takes between commands
(when nCS=1).
In HyperBus mode, the device timing (tACC and tRWR) and the Latency mode must be
configured in OCTOSPI_HLCR.
Before setting ABORT, the software must ensure that all the current transactions are
finished using the synchronization barriers.
Note: Some devices may misbehave if a write operation to a status register is aborted.
T T
nCS
SCLK
MSv44100V1
When CKMODE = 1 (Mode 3: CLK goes high when no operation is in progress) and when in
SDR mode, nCS falls one CLK cycle before an operation first rising CLK edge, and the nCS
rises one CLK cycle after the operation final rising CLK edge (see the figure below).
T T
nCS
SCLK
MSv44101V1
When the CKMODE = 1 (Mode 3) and DDTR = 1 (data DTR mode), the nCS falls one CLK
cycle before an operation first rising CLK edge, and the nCS rises one CLK cycle after the
operation final active rising CLK edge (see the figure below). Because the DDR operations
must finish with a falling edge, the CLK is low when the nCS rises, and the CLK rises back
up one half of a CLK cycle afterwards.
nCS
SCLK
MSv44102V1
When the FIFO stays full during a read operation, or if the FIFO stays empty during a write
operation, the operation stalls and the CLK stays low until the software services the FIFO. If
an abort occurs when an operation is stalled, the nCS rises just after the abort is requested
and then the CLK rises one half of a CLK cycle later (see the figure below).
nCS
SCLK
Abort
MSv44103V1
When not in Dual-quad mode (DQM = 0), only device A is accessed and thus the BnCS
stays high. In Dual-quad mode, the BnCS behaves exactly the same as the AnCS. Thus, if
there is a device B and if the application always stays in Dual-quad mode, then the device B
may use the AnCS and the pin outputting BnCS can be used for other functions.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. FMODE[1:0] Res. Res. Res. Res. PMM APMS Res. TOIE SMIE FTIE TCIE TEIE
rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. FTHRES[4:0] FSEL DQM Res. Res. TCEN DMAEN ABORT EN
rw rw rw rw rw rw rw rw rw rw rw
If DMAEN = 1, the DMA controller for the corresponding channel must be disabled before
changing the FTHRES[4:0] value.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. MTYP[2:0] Res. Res. Res. DEVSIZE[4:0]
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DLYBY CKMO
Res. Res. CSHT[5:0] Res. Res. Res. Res. Res. FRCK
P DE
rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. CSBOUND[4:0]
rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
REFRESH[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
REFRESH[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. FLEVEL[5:0] Res. Res. BUSY TOF SMF FTF TCF TEF
r r r r r r r r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. CTOF CSMF Res. CTCF CTEF
w w w w
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DL[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DL[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
ADDRESS[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ADDRESS[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DATA[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DATA[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
MASK[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
MASK[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
MATCH[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
MATCH[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
INTERVAL[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
SIOO Res. DQSE Res. DDTR DMODE[2:0] Res. Res. ABSIZE[1:0] ABDTR ABMODE[2:0]
rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ADDT
Res. Res. ADSIZE[1:0] ADMODE[2:0] Res. Res. ISIZE[1:0] IDTR IMODE[2:0]
R
rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
SSHIF
Res. Res. DHQC Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
T
rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. DCYC[4:0]
rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
INSTRUCTION[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
INSTRUCTION[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
ALTERNATE[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ALTERNATE[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
TIMEOUT[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. DQSE Res. DDTR DMODE[2:0] Res. Res. ABSIZE[1:0] ABDTR ABMODE[2:0]
rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ADDT
Res. Res. ADSIZE[1:0] ADMODE[2:0] Res. Res. ISIZE[1:0] IDTR IMODE[2:0]
R
rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. DCYC[4:0]
rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
INSTRUCTION[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
INSTRUCTION[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
ALTERNATE[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ALTERNATE[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw rw rw
Offset Register
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
FMDOE[1:0]
DMAEN
ABORT
APMS
TCEN
FSEL
SMIE
PMM
DQM
TOIE
TCIE
TEIE
FTIE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
EN
OCTOSPI_CR FTHRES[4:0]
0x0000
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
MTYP[2:0] Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
0x0004 Reserved
CKMODE
DLYBYP
FRCK
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
OCTOSPI_DCR1 DEVSIZE[4:0] CSHT[5:0]
0x0008
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
OCTOSPI_DCR2 PRESCALER[7:0]
0x000C
Reset value 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
OCTOSPI_DCR4 REFRESH[31:0]
0x0014
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x0018
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
- Reserved
0x001C
SMF
BUS
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
TOF
TCF
TEF
FTF
OCTOSPI_SR FLEVEL[5:0]
0x0020
Reset value 0 0 0 0 0 0 0 0 0 0 0 0
0x0104
0x0084
0x0044
0x0108
0x0100
0x0094
0x0090
0x0088
0x0080
0x0054
0x0050
0x0048
0x0040
0x0028
0x0024
0x010C
0x008C
0x004C
0x007C
0x003C
0x00FC
Offset
602/2301
PSMAR
PSMKR
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
OCTOSPI_
OCTOSPI_
Register
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
OCTOSPI_AR
OCTOSPI_DR
OCTOSPI_PIR
OCTOSPI_DLR
OCTOSPI_TCR
OCTOSPI_FCR
OCTOSPI_CCR
0
0
0
0
0
0
Res. Res. Res. SIOO Res. Res. Res. Res. Res. Res. Res. Res. Res. 31
0
0
0
0
0
0
Res. SSHIFT Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 30
0
0
0
0
0
0
Res. Res. Res. DQSE Res. Res. Res. Res. Res. Res. Res. Res. Res. 29
0
0
0
0
0
0
Octo-SPI interface (OCTOSPI)
Res. DHQC Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 28
0
0
0
0
0
0
Res. Res. Res. DDTR Res. Res. Res. Res. Res. Res. Res. Res. Res. 27
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 0 Res. Res. 26
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 25
[2:0]
DMODE
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 24
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 23
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 22
0
0
0
0
0
0
Res. Res. Res. ABSIZE Res. Res. Res. Res. Res. Res. Res. Res. Res. 21
0
0
0
0
0
0
Res. Res. Res. [1:0] Res. Res. Res. Res. Res. Res. Res. Res. Res. 20
0
0
0
0
0
0
Res. Res. Res. ABDTR Res. Res. Res. Res. Res. Res. Res. Res. Res. 19
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 18
RM0432 Rev 6
ABMODE
0
0
0
0
0
0
Res. Res. Res. [2:0] Res. Res. Res. Res. Res. Res. Res. Res. Res. 17
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 16
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 15
DL[31:0]
DATA[31:0]
MASK[31:0]
0
0
0
0
0
0
MATCH[31:0]
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 14
ADDRESS[31:0]
0
0
0
0
0
0
0
Res. Res. Res. ADSIZE Res. Res. Res. Res. Res. Res. Res. Res. 13
0
0
0
0
0
0
0
Res. Res. Res. [1:0] Res. Res. Res. Res. Res. Res. Res. Res. 12
0
0
0
0
0
0
0
Res. Res. Res. ADDTR Res. Res. Res. Res. Res. Res. Res. Res. 11
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 10
ADMODE
0
0
0
0
0
0
0
Res. Res. Res. [2:0] Res. Res. Res. Res. Res. Res. Res. Res. 9
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 8
0
0
0
0
0
0
Table 122. OCTOSPI register map and reset values (continued)
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 7
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 6
INTERVAL[15:0]
0
0
0
0
0
0
0
Res. Res. Res.
ISIZE[1:0]
Res. Res. Res. Res. Res. Res. Res. Res. 5
0
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. CTOF 4
0
0
0
0
0
0
0
0
Res. Res. IDTR Res. Res. Res. Res. Res. Res. Res. CSMF 3
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 2
0
0
0
0
0
0
0
0
IMODE[2:0]
DCYC[4:0]
Res. Res. Res. Res. Res. Res. Res. Res. Res. CTCF 1
0
0
0
0
0
0
0
0
0
RM0432
Res. Res. Res. Res. Res. Res. Res. Res. Res. CTEF
-
-
-
-
0x0114
0x0110
0x0200
0x0194
0x0190
0x0188
0x0180
0x0200
0x0134
0x0130
0x0124
0x0120
0x01A4
0x01A0
0x018C
0x019C
0x012C
0x01FC
-0x011C
Offset
RM0432
Reserved
Reserved
Reserved
Reserved
Reserved
Reserved
Register
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
OCTOSPI_IR
OCTOSPI_WIR
OCTOSPI_ABR
OCTOSPI_LPTR
OCTOSPI_HLCR
OCTOSPI_WABR
OCTOSPI_WTCR
OCTOSPI_WCCR
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 31
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 30
0
0
0
0
0
Res. Res. Res. Res. Res. DQSE Res. Res. Res. Res. 29
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 28
0
0
0
0
0
Res. Res. Res. Res. Res. DDTR Res. Res. Res. Res. 27
0
0
0
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. [2:0] Res. Res. Res. Res. 25
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
TRWR[7:0]
0
0
0
0
0
0
RM0432 Rev 6
ABMODE
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
ALTERNATE[31:0]
ALTERNATE[31:0]
0
0
0
0
0
0
0
INSTRUCTION[31:0]
INSTRUCTION[31:0]
Res. Res. Res. Res. ADSIZE Res. Res. Res. 13
0
0
0
0
0
0
0
0
0
0
0
0
TACC[7:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Table 122. OCTOSPI register map and reset values (continued)
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
DCYC[4:0]
0
0
603/2301
LM Res. Res. Res. Res. Res. Res.
Octo-SPI interface (OCTOSPI)
603
OCTOSPI I/O manager (OCTOSPIM) RM0432
20.1 Introduction
The OCTOSPI I/O manager is a low-level interface that enables:
• An efficient OCTOSPI pin assignment with a full I/O Matrix (before alternate function
map)
• Multiplex of single/dual/quad/octal SPI interfaces over the same bus
AHB PnCR
AHB interface
CR
P1CR
MUXEN OCTOSPIM_P1_CLK
OCTOSPI1
sig. OCTOSPIM_P1_NCLK
Port 1
OCTOSPIM_P1_DQS
OCTOSPI1 ACK1 OCTOSPIM_P1_NCS
OCTOSPIM_P1_IO[7:0]
REQ1
I/O Matrix
Muxer
OCTOSPIM_Pn_CLK
REQ2 OCTOSPIM_Pn_NCLK
Port n
OCTOSPIM_Pn_DQS
OCTOSPI2
ACK2 OCTOSPIM_Pn_NCS
OCTOSPIM_Pn_IO[7:0]
OCTOSPI2
sig.
MS42409V4
AHB PnCR
AHB interface P1CR
OCTOSPIM_P1_CLK
OCTOSPI1 OCTOSPIM_P1_NCLK
Port 1
OCTOSPI1 sig.
OCTOSPIM_P1_DQS
OCTOSPIM_P1_NCS
OCTOSPIM_P1_IO[7:0]
OCTOSPI
Kernel I/O Matrix
clock
OCTOSPIM_Pn_CLK
OCTOSPIM_Pn_NCLK
Port n
OCTOSPI2 OCTOSPIM_Pn_DQS
OCTOSPI2
OCTOSPIM_Pn_NCS
sig.
OCTOSPIM_Pn_IO[7:0]
MS42422V3
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. MUXEN
rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. IOHSRC[1:0] IOHEN Res. Res. Res. Res. Res. IOLSRC[1:0] IOLEN
rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. NCSSRC NCSEN Res. Res. DQSSRC DQSEN Res. Res. CLKSRC CLKEN
rw rw rw rw rw rw
10
11
9
8
7
6
5
4
3
2
1
0 MUXEN
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
OCTOSPIM _CR REQ2ACK_TIME[7:0]
0x0000
Reset value 0 0 0 0 0 0 0 0 0
DQSSRC
NCSSRC
CLKSRC
IOHSRC
IOLSRC
DQSEN
NCSEN
CLKEN
IOHEN
IOLEN
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[1:0}
[1:0}
OCTOSPIM _P1CR
0x0004
Reset value 0 1 1 0 0 1 0 1 0 1 0 1
DQSSRC
NCSSRC
CLKSRC
IOHSRC
IOLSRC
DQSEN
NCSEN
CLKEN
IOHEN
IOLEN
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[1:0}
[1:0}
OCTOSPIM _P2CR
0x0008
Reset value 1 1 1 1 0 1 1 1 1 1 1 1
21.1 Introduction
This section describes the implementation of up to 2 ADCs:
• ADC1 and ADC2 are tightly coupled and can operate in dual mode (ADC1 is master).
Each ADC consists of a 12-bit successive approximation analog-to-digital converter.
Each ADC has up to 19 multiplexed channels. A/D conversion of the various channels can
be performed in single, continuous, scan or discontinuous mode. The result of the ADC is
stored in a left-aligned or right-aligned 16-bit data register.
The ADCs are mapped on the AHB bus to allow fast data handling.
The analog watchdog features allow the application to detect if the input voltage goes
outside the user-defined high or low thresholds.
A built-in hardware oversampler allows to improve analog performances while off-loading
the related computational burden from the CPU.
An efficient low-power mode is implemented to allow very low consumption at low
frequency.
• Conversion modes
– Each ADC can convert a single channel or can scan a sequence of channels
– Single mode converts selected inputs once per trigger
– Continuous mode converts selected inputs continuously
– Discontinuous mode
• Dual ADC mode for ADC1 and 2
• Interrupt generation at ADC ready, the end of sampling, the end of conversion (regular
or injected), end of sequence conversion (regular or injected), analog watchdog 1, 2 or
3 or overrun events
• 3 analog watchdogs per ADC
• ADC input range: VREF– ≤ VIN ≤ VREF+
Figure 88 shows the block diagram of one ADC.
Cortex
AREADY
M4 with
EOSMP
ADC Interrupt FPU
EOC
EOS IRQ
OVR
JAUTO RDATA[11:0] JEOS master
AHB
JQOVF slave
AWDx
ADEN/ADDIS
ADC_JSQRx master
Analog Supply (VDDA) JDATA1[11:0]
ADC_SQRx 1.62V to 3.6 V JDATA2[11:0]
JDATA3[11:0] DMA
CONT JDATA4[11:0] AHB
single/cont interface DMA request
VTS
dac_out1 DFSDM
VREFINT Bias & Ref 16
VBAT/3 ADCAL
self calibration Oversampler DMACFG
dac_out2
VINP[18:0] Input DMAEN
ADC_INP[16:1] SAR ADC
VINN[18:0] selection & VIN
ADC_INN[16:1] scan control ROVSM
analog input CONVERTED
VREF- channels SMPx[2:0] DATA TROVS
sampling time start
Start & Stop OVSS[3:0]
Control
OVSR[2:0]
AUTDLY OVRMOD
auto delayed S/W trigger overrun mode JOVSE
ADSTP ALIGN
stop conv left/right ROVSE
RES[1:0] Oversampling
12, 10, 8 bits options
JOFFSETx[11:0]
EXT0 JOFFSETx_CH[11:0]
EXT1 h/w
EXT2 trigger
....... DISCEN
....... EXTEN[1:0] DISCNU[:0]
trigger enable Analog watchdog 1,2,3
EXT13 and edge selection Discontinuous
EXT14
mode TIMERs
EXT15
AWD1 AWD1_OUT
EXTi mapped AWD2 AWD2_OUT ETR
EXTSEL[3:0] AWD3 AWD3_OUT
at product level trigger selection
J
S/W trigger
AWD1EN
JEXT0 JAWD1EN
JEXT1 H/W AWD1SGL
JEXT2 trigger
JDISCEN AWDCH1[4:0]
.......
....... JEXTEN[1:0] JDISCNUM[2:0] LT1[11:0]
trigger enable
JEXT13 and edge selection HT1[11:0]
JQM
JEXT14 Injced Context AWDCH2[18:0]
JEXT15 Queue Mode LT2[7:0]
JEXTi mapped AWDCH3[18:0]
at product level HT2[7:0]
JEXTSEL[3:0]
trigger selection HT3[7:0]
LT3[7:0]
MSv43756V7
Input, analog reference The higher/positive reference voltage for the ADC,
VREF+
positive 1.62 V ≤ VREF+ ≤ VDDA
Analog power supply equal VDDA:
VDDA Input, analog supply
1.62 V ≤ VDDA ≤ 3.6 V
Input, analog reference The lower/negative reference voltage for the ADC.
VREF−
negative VREF− is internally connected to VSSA
Ground for analog power supply. On device package
Input, analog supply
VSSA which do not have a dedicated VSSA pin, VSSA is
ground
internally connected to VSS.
Positive analog input Connected either to ADCx_INPi external channels or
VINPi
channels for each ADC to internal channels.
Negative analog input Connected either to VREF− or to external channels:
VINNi
channels for each ADC ADCx_INNi and ADCx_INP[i+1].
Up to 16 analog input channels (x = ADC number = 1
Negative external analog or 2)
ADCx_INNi
input signals Refer to Section 21.4.4: ADC1/2 connectivity for
details.
Up to 10 analog input channels (x = ADC number = 1
Positive external analog or 2)
ADCx_INPi
input signals Refer to Section 21.4.4: ADC1/2 connectivity for
details
Bits CKMODE[1:0]
of ADCx_CCR
Analog ADC1
(master)
/1 or /2 or /4 Others
Analog ADC2
/1, 2, 4, 6, 8, 10, (slave)
ADC12_CK 00
12, 16, 32, 64,
128, 256
MSv50635V1
ADC1
Channel selection
VINP[0]
VREFINT
VINN[0] Fast channel
VREF−
VINP[1]
ADC12_INP1
VINN[1] Fast channel
ADC12_INN1 VINP[2]
ADC12_INP2 VINN[2] Fast channel
ADC12_INN2 VINP[3]
ADC12_INP3 VINN[3] Fast channel
ADC12_INN3 VINP[4]
ADC12_INP4 VINN[4] Fast channel
ADC12_INN4 VINP[5]
ADC12_INP5 VINN[5] Fast channel
ADC12_INN5 VINP[6]
ADC12_INP6 VINN[6] Slow channel
ADC12_INN6 VINP[7] VREF+
ADC12_INP7 VINN[7] Slow channel
ADC12_INN7 VINP[8] VINP
ADC12_INP8 VINN[8] Slow channel
SAR
ADC12_INN8 VINP[9]
ADC1
ADC12_INP9 VINN[9] Slow channel VINN
ADC12_INN9 VINP[10]
ADC12_INP10 VINN[10] Slow channel
ADC12_INN10 VINP[11] VREF−
ADC12_INP11 VINN[11] Slow channel
ADC12_INN11 VINP[12]
ADC12_INP12 VINN[12] Slow channel
ADC12_INN12 VINP[13]
ADC12_INP13 VINN[13] Slow channel
ADC12_INN13 VINP[14]
ADC12_INP14 VINN[14] Slow channel
ADC12_INN14 VINP[15]
ADC12_INP15 VINN[15] Slow channel
ADC12_INN15 VINP[16]
ADC12_INP16 VINN[16] Slow channel
VREF−
VINP[17]
VTS
VINN[17] Slow channel
VREF−
VINP[18]
VBAT/3
VINN[18] Slow channel
VREF−
MSv41967V5
ADC2
ADC2
Channel selection
VINP[0]
VREF−
VINN[0] Fast channel
VREF−
VINP[1]
ADC12_INP1
VINN[1] Fast channel
ADC12_INN1 VINP[2]
ADC12_INP2 VINN[2] Fast channel
ADC12_INN2 VINP[3]
ADC12_INP3 VINN[3] Fast channel
ADC12_INN3 VINP[4]
ADC12_INP4 VINN[4] Fast channel
ADC12_INN4 VINP[5]
ADC12_INP5 VINN[5] Fast channel
ADC12_INN5 VINP[6]
ADC12_INP6 VINN[6] Slow channel
ADC12_INN6 VINP[7] VREF+
ADC12_INP7 VINN[7] Slow channel
ADC12_INN7 VINP[8] VINP
ADC12_INP8 VINN[8] Slow channel
SAR
ADC12_INN8 VINP[9]
ADC2
ADC12_INP9 VINN[9] Slow channel VINN
ADC12_INN9 VINP[10]
ADC12_INP10 VINN[10] Slow channel
ADC12_INN10 VINP[11] VREF−
ADC12_INP11 VINN[11] Slow channel
ADC12_INN11 VINP[12]
ADC12_INP12 VINN[12] Slow channel
ADC12_INN12 VINP[13]
ADC12_INP13 VINN[13] Slow channel
ADC12_INN13 VINP[14]
ADC12_INP14 VINN[14] Slow channel
ADC12_INN14 VINP[15]
ADC12_INP15 VINN[15] Slow channel
ADC12_INN15 VINP[16]
ADC12_INP16 VINN[16] Slow channel
VREF−
dac_out1 VINP[17]
VINN[17] Slow channel
VREF−
dac_out2 VINP[18]
VINN[18] Slow channel
VREF−
MSv50636V4
The internal analog calibration is lost each time the power of the ADC is removed (example,
when the product enters in STANDBY or VBAT mode). In this case, to avoid spending time
recalibrating the ADC, it is possible to re-write the calibration factor into the ADC_CALFACT
register without recalibrating, supposing that the software has previously saved the
calibration factor delivered during the previous calibration.
The calibration factor can be written if the ADC is enabled but not converting (ADEN=1 and
ADSTART=0 and JADSTART=0). Then, at the next start of conversion, the calibration factor
will automatically be injected into the analog ADC. This loading is transparent and does not
add any cycle latency to the start of the conversion. It is recommended to recalibrate when
VREF+ voltage changed more than 10%.
tCAB
ADCAL
MSv30263V2
ADC state Ready (not converting) Converting channel Ready Converting channel
(Single ended) (Single ended)
Updating calibration
Internal
calibration factor[6:0] F1 F2
Start conversion
(hardware or sofware)
WRITE ADC_CALFACT
CALFACT_S[6:0] F2
by s/w by h/w
MSv30529V2
Trigger event
ADC state RDY CONV CH 1 RDY CONV CH2 RDY CONV CH3 RDY CONV CH4
Single ended (Differential (Differential (Single inputs
inputs channel) inputs channel) inputs channel) channel)
Internal
calibration factor[6:0] F2 F3 F2
CALFACT_S[6:0] F2
CALFACT_D[6:0] F3
MSv30530V2
ADEN
tSTAB
ADRDY
ADDIS
ADC REQ
state OFF Startup RDY Converting CH RDY OFF
-OF
by S/W by H/W
MSv30264V2
TCONV = TSMPL + TSAR = 83.33 ns |min + 416.67 ns |12bit = 500.0 ns (for FADC_CLK = 30 MHz)
MS30532V1
Note: In auto-injection mode (JAUTO=1), setting ADSTP bit aborts both regular and injected
conversions (JADSTP must not be used).
Trigger Trigger
JADSTART
Cleared by Cleared by
ADSTART HW REGULAR CONVERSIONS ongoing HW
(software is not allowed to configure regular conversions selection and triggers)
Set by Cleared by
ADSTP SW HW
MSv30533V2
Set Cleared
JADSTART by S/W INJECTED CONVERSIONS ongoing by H/W
(software is not allowed to configure injected conversions selection and triggers)
Set Cleared
JADSTP by S/W by H/W
MS30534V1
Table 128. Configuring the trigger polarity for regular external triggers
EXTEN[1:0] Source
Table 129. Configuring the trigger polarity for injected external triggers
JEXTEN[1:0] Source
Note: The polarity of the injected trigger can be anticipated and changed on-the-fly when the
queue is enabled (JQDIS=0). Refer to Section 21.4.21: Queue of context for injected
conversions.
The EXTSEL and JEXTSEL control bits select which out of 16 possible events can trigger
conversion for the regular and injected groups.
A regular group conversion can be interrupted by an injected trigger.
Figure 99. Triggers sharing between ADC master and ADC slave
ADC MASTER
Regular EXT0
sequencer EXT1 External regular trigger
..............
triggers
EXT15
EXTSEL[3:0]
JEXTSEL[3:0]
ADC SLAVE
EXTSEL[3:0]
JEXT0
Injected JEXT1 External injected trigger
sequencer ..............
triggers
JEXT15
JEXTSEL[3:0]
MS35356V1
Table 130 to Table 131 give all the possible external triggers of the three ADCs for regular
and injected conversion.
reset and the injected channel sequence switches are launched (all the injected
channels are converted once).
3. Then, the regular conversion of the regular group of channels is resumed from the last
interrupted regular conversion.
4. If a regular event occurs during an injected conversion, the injected conversion is not
interrupted but the regular sequence is executed at the end of the injected sequence.
Figure 100 shows the corresponding timing diagram.
Note: When using triggered injection, one must ensure that the interval between trigger events is
longer than the injection sequence. For instance, if the sequence length is 28 ADC clock
cycles (that is two conversions with a sampling time of 1.5 clock periods), the minimum
interval between triggers must be 29 ADC clock cycles.
Auto-injection mode
If the JAUTO bit in the ADC_CFGR register is set, then the channels in the injected group
are automatically converted after the regular group of channels. This can be used to convert
a sequence of up to 20 conversions programmed in the ADC_SQRy and ADC_JSQR
registers.
In this mode, the ADSTART bit in the ADC_CR register must be set to start regular
conversions, followed by injected conversions (JADSTART must be kept cleared). Setting
the ADSTP bit aborts both regular and injected conversions (JADSTP bit must not be used).
In this mode, external trigger on injected channels must be disabled.
If the CONT bit is also set in addition to the JAUTO bit, regular channels followed by injected
channels are continuously converted.
Note: It is not possible to use both the auto-injected and discontinuous modes simultaneously.
When the DMA is used for exporting regular sequencer’s data in JAUTO mode, it is
necessary to program it in circular mode (CIRC bit set in DMA_CCRx register). If the CIRC
bit is reset (single-shot mode), the JAUTO sequence will be stopped upon DMA Transfer
Complete event.
ADCCLK
Injection event
Reset ADC
(1)
max. latency
SOC
ai16049b
1. The maximum latency value can be found in the electrical characteristics of the device datasheet.
Note: The channel numbers referred to in the above example might not be available on all
microcontrollers.
When a regular group is converted in discontinuous mode, no rollover occurs (the last
subgroup of the sequence can have less than n conversions).
When all subgroups are converted, the next trigger starts the conversion of the first
subgroup. In the example above, the 4th trigger reconverts the channels 1, 2 and 3 in the
1st subgroup.
It is not possible to have both discontinuous mode and continuous mode enabled. In this
case (if DISCEN=1, CONT=1), the ADC behaves as if continuous mode was disabled.
All the parameters of the context are defined into a single register ADC_JSQR and this
register implements a queue of 2 buffers, allowing the bufferization of up to 2 sets of
parameters:
• The JSQR register can be written at any moment even when injected conversions are
ongoing.
• Each data written into the JSQR register is stored into the Queue of context.
• At the beginning, the Queue is empty and the first write access into the JSQR register
immediately changes the context and the ADC is ready to receive injected triggers.
• Once an injected sequence is complete, the Queue is consumed and the context
changes according to the next JSQR parameters stored in the Queue. This new
context is applied for the next injected sequence of conversions.
• A Queue overflow occurs when writing into register JSQR while the Queue is full. This
overflow is signaled by the assertion of the flag JQOVF. When an overflow occurs, the
write access of JSQR register which has created the overflow is ignored and the queue
of context is unchanged. An interrupt can be generated if bit JQOVFIE is set.
• Two possible behaviors are possible when the Queue becomes empty, depending on
the value of the control bit JQM of register ADC_CFGR:
– If JQM=0, the Queue is empty just after enabling the ADC, but then it can never be
empty during run operations: the Queue always maintains the last active context
and any further valid start of injected sequence will be served according to the last
active context.
– If JQM=1, the Queue can be empty after the end of an injected sequence or if the
Queue is flushed. When this occurs, there is no more context in the queue and
hardware triggers are disabled. Therefore, any further hardware injected triggers
are ignored until the software re-writes a new injected context into JSQR register.
• Reading JSQR register returns the current JSQR context which is active at that
moment. When the JSQR context is empty, JSQR is read as 0x0000.
• The Queue is flushed when stopping injected conversions by setting JADSTP=1 or
when disabling the ADC by setting ADDIS=1:
– If JQM=0, the Queue is maintained with the last active context.
– If JQM=1, the Queue becomes empty and triggers are ignored.
Note: When configured in discontinuous mode (bit JDISCEN=1), only the last trigger of the
injected sequence changes the context and consumes the Queue.The 1st trigger only
consumes the queue but others are still valid triggers as shown by the discontinuous mode
example below (length = 3 for both contexts):
• 1st trigger, discontinuous. Sequence 1: context 1 consumed, 1st conversion carried out
• 2nd trigger, disc. Sequence 1: 2nd conversion.
• 3rd trigger, discontinuous. Sequence 1: 3rd conversion.
• 4th trigger, discontinuous. Sequence 2: context 2 consumed, 1st conversion carried out.
• 5th trigger, discontinuous. Sequence 2: 2nd conversion.
• 6th trigger, discontinuous. Sequence 2: 3rd conversion.
Write JSQR
Trigger 1
ADC J context
EMPTY P1 P2 P3
(returned by reading
JQSR)
ADC state RDY Conversion1 Conversion2 Conversion3 RDY Conversion1 RDY
MS30536V2
1. Parameters:
P1: sequence of 3 conversions, hardware trigger 1
P2: sequence of 1 conversion, hardware trigger 1
P3: sequence of 4 conversions, hardware trigger 1
Write JSQR
Trigger 1
Ignored
Trigger 2
ADC J context
EMPTY P1 P2 P3
(returned by reading
JQSR)
ADC state RDY Conversion1 Conversion2 RDY Conversion1 RDY
MS30537V2
1. Parameters:
P1: sequence of 2 conversions, hardware trigger 1
P2: sequence of 1 conversion, hardware trigger 2
P3: sequence of 4 conversions, hardware trigger 1
Figure 103. Example of JSQR queue of context with overflow before conversion
P1 P2 P3 => Overflow, P4
ignored
Write JSQR
JSQR
EMPTY P1 P1, P2 P2 P2, P4
queue
Cleared by SW
JQOVF
Trigger 1
Trigger 2
ADC
J context
EMPTY P1 P2
(returned by
reading JQSR)
JEOS
MS30538V2
1. Parameters:
P1: sequence of 2 conversions, hardware trigger 1
P2: sequence of 1 conversion, hardware trigger 2
P3: sequence of 3 conversions, hardware trigger 1
P4: sequence of 4 conversions, hardware trigger 1
Figure 104. Example of JSQR queue of context with overflow during conversion
P1 P2 P3 => Overflow, P4
ignored
Write JSQR
JSQR
EMPTY P1 P1, P2 P2 P2, P4
queue
Cleared by SW
JQOVF
Trigger 1
Trigger 2
ADC
J context
(returned by EMPTY P1 P2
reading JQSR)
JEOS
MS30539V2
1. Parameters:
P1: sequence of 2 conversions, hardware trigger 1
P2: sequence of 1 conversion, hardware trigger 2
P3: sequence of 3 conversions, hardware trigger 1
P4: sequence of 4 conversions, hardware trigger 1
Figure 105. Example of JSQR queue of context with empty queue (case JQM=0)
Write JSQR
EMPTY P1 P1, P2 P2 P3
JSQR queue
Trigger 1
ADC J context
(returned by EMPTY P1 P2 P3
reading JQSR)
ADC state RDY Conversion1 RDY Conversion1 RDY Conversion1 RDY Conversion1 RDY Conv
MS30540V3
1. Parameters:
P1: sequence of 1 conversion, hardware trigger 1
P2: sequence of 1 conversion, hardware trigger 1
P3: sequence of 1 conversion, hardware trigger 1
Note: When writing P3, the context changes immediately. However, because of internal
resynchronization, there is a latency and if a trigger occurs just after or before writing P3, it
can happen that the conversion is launched considering the context P2. To avoid this
situation, the user must ensure that there is no ADC trigger happening when writing a new
context that applies immediately.
Figure 106. Example of JSQR queue of context with empty queue (case JQM=1)
JSQR
EMPTY P1 P1,P2 P2 EMPTY P3 EMPTY
queue
Ignored Ignored
Trigger 1
ADC
J context EMPTY P1 P2 EMPTY (0x0000) P3 EMPTY
(returned by reading JQSR)
ADC state RDY Conversion1 RDY Conversion1 RDY Conversion1 RDY
MS30541V1
1. Parameters:
P1: sequence of 1 conversion, hardware trigger 1
P2: sequence of 1 conversion, hardware trigger 1
P3: sequence of 1 conversion, hardware trigger 1
MS30544V2
1. Parameters:
P1: sequence of 1 conversion, hardware trigger 1
P2: sequence of 1 conversion, hardware trigger 1
P3: sequence of 1 conversion, hardware trigger 1
ADC J
context EMPTY P1 P3
(returned by reading JSQR)
ADC state RDY Conv1 STP RDY Conversion1 RDY Conversion1 RDY
(Aborted)
MS30543V1
1. Parameters:
P1: sequence of 1 conversion, hardware trigger 1
P2: sequence of 1 conversion, hardware trigger 1
P3: sequence of 1 conversion, hardware trigger 1
MS30544V1
1. Parameters:
P1: sequence of 1 conversion, hardware trigger 1
P2: sequence of 1 conversion, hardware trigger 1
P3: sequence of 1 conversion, hardware trigger 1
1. Parameters:
P1: sequence of 1 conversion, hardware trigger 1
P2: sequence of 1 conversion, hardware trigger 1
P3: sequence of 1 conversion, hardware trigger 1
ADC J context P1
(returned by reading JSQR)
MS30546V1
1. Parameters:
P1: sequence of 1 conversion, hardware trigger 1
P2: sequence of 1 conversion, hardware trigger 1
P3: sequence of 1 conversion, hardware trigger 1
MS30547V1
1. Parameters:
P1: sequence of 1 conversion, hardware trigger 1
P2: sequence of 1 conversion, hardware trigger 1
P3: sequence of 1 conversion, hardware trigger 1
ADSTART(1)
EOC
EOS
ADC state(2) RDY CH1 CH9 CH10 CH17 RDY CH1 CH9 CH10 CH17 RDY
MS30549V1
1. EXTEN[1:0]=00, CONT=0
2. Channels selected = 1,9, 10, 17; AUTDLY=0.
ADSTART(1)
EOC
EOS
ADSTP
ADC state(2) READY CH1 CH9 CH10 CH17 CH1 CH9 CH10 STP READY CH1 CH9
MS30550V1
1. EXTEN[1:0]=00, CONT=1
2. Channels selected = 1,9, 10, 17; AUTDLY=0.
ADSTART
EOC
EOS
TRGX(1)
ADC state(2) RDY CH1 CH2 CH3 CH4 READY CH1 CH2 CH3 CH4 RDY
ADC_DR D1 D2 D3 D4 D1 D2 D3 D4
ADSTART
EOC
EOS
ADSTP
TRGx(1)
ADC(2) RDY CH1 CH2 CH3 CH4 CH1 CH2 CH3 CH4 CH1 STOP RDY
ADC_DR D1 D2 D3 D4 D1 D2 D3 D4
Offset
An offset y (y=1,2,3,4) can be applied to a channel by setting the bit OFFSETy_EN=1 into
ADC_OFRy register. The channel to which the offset will be applied is programmed into the
bits OFFSETy_CH[4:0] of ADC_OFRy register. In this case, the converted value is
decreased by the user-defined offset written in the bits OFFSETy[11:0]. The result may be a
negative value so the read data is signed and the SEXT bit represents the extended sign
value.
Note: Offset correction is not supported in oversampling mode. When ROVSE and/or JOVSE bit is
set, the value of the OFFSETy_EN bit in ADC_OFRy register is ignored (considered as
reset).
Table 135 describes how the comparison is performed for all the possible resolutions for
analog watchdog 1.
Signed
00: 12-bit DATA[11:0] OFFSET[11:0] -
12-bit data
Signed The user must configure OFFSET[1:0]
01: 10-bit DATA[11:2],00 OFFSET[11:0]
10-bit data to “00”
When reading data from ADC_DR (regular channel) or from ADC_JDRy (injected channel,
y=1,2,3,4) corresponding to the channel “i”:
• If one of the offsets is enabled (bit OFFSETy_EN=1) for the corresponding channel, the
read data is signed.
• If none of the four offsets is enabled for this channel, the read data is not signed.
Figure 117, Figure 118, Figure 119 and Figure 120 show alignments for signed and
unsigned data.
12-bit data
bit15 bit7 bit0
0 0 0 0 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
10-bit data
bit15 bit7 bit0
0 0 0 0 0 0 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
8-bit data
bit15 bit7 bit0
0 0 0 0 0 0 0 0 D7 D6 D5 D4 D3 D2 D1 D0
6-bit data
bit15 bit7 bit0
0 0 0 0 0 0 0 0 0 0 D5 D4 D3 D2 D1 D0
MS31015V1
12-bit data
bit15 bit7 bit0
SEXT SEXT SEXT SEXT D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
10-bit data
bit15 bit7 bit0
SEXT SEXT SEXT SEXT SEXT SEXT D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
8-bit data
bit15 bit7 bit0
SEXT SEXT SEXT SEXT SEXT SEXT SEXT SEXT D7 D6 D5 D4 D3 D2 D1 D0
6-bit data
bit15 bit7 bit0
SEXT SEXT SEXT SEXT SEXT SEXT SEXT SEXT SEXT SEXT D5 D4 D3 D2 D1 D0
MS31016V1
12-bit data
bit15 bit7 bit0
D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 0 0 0 0
10-bit data
bit15 bit7 bit0
D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 0 0 0 0 0 0
8-bit data
bit15 bit7 bit0
D7 D6 D5 D4 D3 D2 D1 D0 0 0 0 0 0 0 0 0
6-bit data
bit15 bit7 bit0
0 0 0 0 0 0 0 0 D5 D4 D3 D2 D1 D0 0 0
MS31017V1
12-bit data
bit15 bit7 bit0
SEXT D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 0 0 0
10-bit data
bit15 bit7 bit0
SEXT D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 0 0 0 0 0
8-bit data
bit15 bit7 bit0
SEXT D7 D6 D5 D4 D3 D2 D1 D0 0 0 0 0 0 0 0
6-bit data
bit15 bit7 bit0
SEXT SEXT SEXT SEXT SEXT SEXT SEXT SEXT SEXT D5 D4 D3 D2 D1 D0 0
MS31018V1
ADSTART(1)
EOC
EOS
OVR
ADSTP
TRGx(1)
ADC state(2) RDY CH1 CH2 CH3 CH4 CH5 CH6 CH7 STOP RDY
Overun
ADC_DR read access
ADC_DR D1
(OVRMOD=0) D2 D3 D4
ADC_DR D1 D2 D3 D4 D5 D6
(OVRMOD=1)
MS31019V1
Note: There is no overrun detection on the injected channels since there is a dedicated data
register for each of the four injected channels.
Despite this, if an overrun occurs (OVR=1) because the DMA could not serve the DMA
transfer request in time, the ADC stops generating DMA requests and the data
corresponding to the new conversion is not transferred by the DMA. Which means that all
the data transferred to the RAM can be considered as valid.
Depending on the configuration of OVRMOD bit, the data is either preserved or overwritten
(refer to Section : ADC overrun (OVR, OVRMOD)).
The DMA transfer requests are blocked until the software clears the OVR bit.
Two different DMA modes are proposed depending on the application use and are
configured with bit DMACFG of the ADC_CFGR register in single ADC mode, or with bit
DMACFG of the ADC_CCR register in dual ADC mode:
• DMA one shot mode (DMACFG=0).
This mode is suitable when the DMA is programmed to transfer a fixed number of data.
• DMA circular mode (DMACFG=1)
This mode is suitable when programming the DMA in circular mode.
ADSTART(1)
EOC
EOS
ADSTP
ADC_DR read access
ADC state RDY CH1 DLY CH2 DLY CH3 DLY CH1 DLY STOP RDY
ADC_DR D1 D2 D3 D1
MS31020V1
1. AUTDLY=1
2. Regular configuration: EXTEN[1:0]=00 (SW trigger), CONT=1, CHANNELS = 1,2,3
3. Injected configuration DISABLED
Not ignored
Ignored (occurs during injected sequence)
Regular
trigger
ADC state RDY CH1 DLY CH2 DLY CH5 CH6 CH3 DLY CH1 DLY CH2
regular regular injected regular injected regular regular
DLY (CH1) DLY (CH2) DLY (CH3) DLY (CH1)
EOC
EOS
ADC_DR
read access
ADC_DR D1 D2 D3 D1
Ignored
Injected
trigger
DLY (inj)
JEOS
ADC_JDR1 D5
ADC_JDR2 D6
1. AUTDLY=1
2. Regular configuration: EXTEN[1:0]=01 (HW trigger), CONT=0, DISCEN=0, CHANNELS = 1, 2, 3
3. Injected configuration: JEXTEN[1:0]=01 (HW Trigger), JDISCEN=0, CHANNELS = 5,6
EOC
EOS
ADC_DR read access
ADC_DR D1 D2 D3 D1
Ignored Ignored
Injected
trigger
DLY (inj)
JEOS
ADC_JDR1 D5
ADC_JDR2 D6
MS31022V1
1. AUTDLY=1
2. Regular configuration: EXTEN[1:0]=01 (HW trigger), CONT=0, DISCEN=1, DISCNUM=1, CHANNELS = 1, 2, 3.
3. Injected configuration: JEXTEN[1:0]=01 (HW Trigger), JDISCEN=1, CHANNELS = 5,6
ADSTART(1)
ADC
CH1 DLY CH2 DLY CH5 CH6 DLY CH3 DLY CH1
state RDY
regular regular injected injected regular regular
DLY (CH1) DLY (CH2) DLY (CH3)
EOC
EOS
ADC_DR read access
ADC_DR D1 D2 D3
Ignored
Injected
trigger
DLY (inj)
JEOS
ADC_JDR1 D5
ADC_JDR2 D6
MS31023V3
1. AUTDLY=1
2. Regular configuration: EXTEN[1:0]=00 (SW trigger), CONT=1, DISCEN=0, CHANNELS = 1, 2, 3
3. Injected configuration: JEXTEN[1:0]=01 (HW Trigger), JDISCEN=0, CHANNELS = 5,6
ADSTART(1) No delay
ADC state RDY CH1 DLY (CH1) CH2 CH5 CH6 DLY (inj) DLY(CH2) CH3 DLY CH1
regular regular injected injected regular regular
EOC
EOS
ADC_DR D1 D2 D3
JEOS
ADC_JDR1 D5
ADC_JDR2 D6
by s/w by h/w
Indicative timings
MS31024V3
1. AUTDLY=1
2. Regular configuration: EXTEN[1:0]=00 (SW trigger), CONT=1, DISCEN=0, CHANNELS = 1, 2
3. Injected configuration: JAUTO=1, CHANNELS = 5,6
Analog voltage
ai16048
None x 0 0
All injected channels 0 0 1
All regular channels 0 1 0
All regular and injected channels 0 1 1
(1)
Single injected channel 1 0 1
Single(1) regular channel 1 1 0
(1)
Single regular or injected channel 1 1 1
1. Selected by the AWD1CH[4:0] bits. The channels must also be programmed to be converted in the
appropriate regular or injected sequence.
The AWD1 analog watchdog status bit is set if the analog voltage converted by the ADC is
below a lower threshold or above a higher threshold.
These thresholds are programmed in bits HT1[11:0] and LT1[11:0] of the ADC_TR1 register
for the analog watchdog 1. When converting data with a resolution of less than 12 bits
(according to bits RES[1:0]), the LSB of the programmed thresholds must be kept cleared
because the internal comparison is always performed on the full 12-bit raw converted data
(left aligned).
Table 135 describes how the comparison is performed for all the possible resolutions for
analog watchdog 1.
LT1[11:0] and
00: 12-bit DATA[11:0] -
HT1[11:0]
LT1[11:0] and User must configure LT1[1:0] and HT1[1:0]
01: 10-bit DATA[11:2],00
HT1[11:0] to 00
LT1[11:0] and User must configure LT1[3:0] and HT1[3:0]
10: 8-bit DATA[11:4],0000
HT1[11:0] to 0000
LT1[11:0] and User must configure LT1[5:0] and HT1[5:0]
11: 6-bit DATA[11:6],000000
HT1[11:0] to 000000
00: 12-bit DATA[11:4] LTx[7:0] and HTx[7:0] DATA[3:0] are not relevant for the comparison
01: 10-bit DATA[11:4] LTx[7:0] and HTx[7:0] DATA[3:2] are not relevant for the comparison
10: 8-bit DATA[11:4] LTx[7:0] and HTx[7:0] -
11: 6-bit DATA[11:6],00 LTx[7:0] and HTx[7:0] User must configure LTx[1:0] and HTx[1:0] to 00
ADC
RDY Conversion1 Conversion2 Conversion3 Conversion4 Conversion5 Conversion6 Conversion7
STATE
inside outside inside outside outside outside inside
EOC FLAG
ADCy_AWDx_OUT
MS31025V1
Figure 129. ADCy_AWDx_OUT signal generation (AWDx flag not cleared by software)
ADC
RDY Conversion1 Conversion2 Conversion3 Conversion4 Conversion5 Conversion6 Conversion7
STATE
inside outside inside outside outside outside inside
EOC FLAG
ADCy_AWDx_OUT
MS31026V1
ADC
Conversion1 Conversion2 Conversion1 Conversion2 Conversion1 Conversion2 Conversion1 Conversion2
STATE
outside inside outside outside
EOC FLAG
EOS FLAG
ADCy_AWDx_OUT
ADC
RDY Conversion1 Conversion2 Conversion3 Conversion4 Conversion Conversion Conversion
STATE
inside outside inside outside outside outside inside
JEOS FLAG
ADCy_AWDx_OUT
MS31028V1
21.4.30 Oversampler
The oversampling unit performs data pre-processing to offload the CPU. It is able to handle
multiple conversions and average them into a single data with increased data width, up to
16-bit.
It provides a result with the following form, where N and M can be adjusted:
n = N–1
1
Result = ----- ×
M Conversion(t n)
n=0
It allows to perform by hardware the following functions: averaging, data rate reduction,
SNR improvement, basic filtering.
The oversampling ratio N is defined using the OVFS[2:0] bits in the ADC_CFGR2 register,
and can range from 2x to 256x. The division coefficient M consists of a right bit shift up to
8 bits, and is defined using the OVSS[3:0] bits in the ADC_CFGR2 register.
The summation unit can yield a result up to 20 bits (256x 12-bit results), which is first shifted
right. It is then truncated to the 16 least significant bits, rounded to the nearest value using
the least significant bits left apart by the shifting, before being finally transferred into the
ADC_DR data register.
Note: If the intermediary result after the shifting exceeds 16-bit, the result is truncated as is,
without saturation.
19 15 11 7 3 0
Raw 20-bit data
Shifting
15 0
Truncation and rounding
MS34453V1
Figure 133 gives a numerical example of the processing, from a raw 20-bit accumulated
data to the final 16-bit result.
19 15 11 7 3
Raw 20-bit data 3 B 7 D 7
15 0
Final result after 5-bit shift
1 D B F
and rounding to nearest
MS34454V1
Table 137 gives the data format for the various N and M combinations, for a raw conversion
data equal to 0xFFF.
Table 137. Maximum output results versus N and M (gray cells indicate truncation)
No-shift 1-bit 2-bit 3-bit 4-bit 5-bit 6-bit 7-bit 8-bit
Over
Max shift shift shift shift shift shift shift shift
sampling
Raw data OVSS = OVSS = OVSS = OVSS = OVSS = OVSS = OVSS = OVSS = OVSS =
ratio
0000 0001 0010 0011 0100 0101 0110 0111 1000
2x 0x1FFE 0x1FFE 0x0FFF 0x0800 0x0400 0x0200 0x0100 0x0080 0x0040 0x020
4x 0x3FFC 0x3FFC 0x1FFE 0x0FFF 0x0800 0x0400 0x0200 0x0100 0x0080 0x0040
8x 0x7FF8 0x7FF8 0x3FFC 0x1FFE 0x0FFF 0x0800 0x0400 0x0200 0x0100 0x0080
16x 0xFFF0 0xFFF0 0x7FF8 0x3FFC 0x1FFE 0x0FFF 0x0800 0x0400 0x0200 0x0100
32x 0x1FFE0 0xFFE0 0xFFF0 0x7FF8 0x3FFC 0x1FFE 0x0FFF 0x0800 0x0400 0x0200
64x 0x3FFC0 0xFFC0 0xFFE0 0xFFF0 0x7FF8 0x3FFC 0x1FFE 0x0FFF 0x0800 0x0400
128x 0x7FF80 0xFF80 0xFFC0 0xFFE0 0xFFF0 0x7FF8 0x3FFC 0x1FFE 0x0FFF 0x0800
256x 0xFFF00 0xFF00 0xFF80 0xFFC0 0xFFE0 0xFFF0 0x7FF8 0x3FFC 0x1FFE 0x0FFF
There are no changes for conversion timings in oversampled mode: the sample time is
maintained equal during the whole oversampling sequence. A new data is provided every N
conversions, with an equivalent delay equal to N x TCONV = N x (tSMPL + tSAR). The flags are
set as follow:
• The end of the sampling phase (EOSMP) is set after each sampling phase
• The end of conversion (EOC) occurs once every N conversions, when the
oversampled result is available
• The end of sequence (EOS) occurs once the sequence of oversampled data is
completed (i.e. after N x sequence length conversions total)
Analog watchdog
The analog watchdog functionality is maintained (AWDSGL and AWDEN bits), with the
following difference:
– The RES[1:0] bits are ignored, comparison is always done on using the full 12-bit
values HT[11:0] and LT[11:0]
– the comparison is performed on the most significant 12-bit of the 16-bit
oversampled results ADC_DR[15:4]
Note: Care must be taken when using high shifting values, this will reduce the comparison range.
For instance, if the oversampled result is shifted by 4 bits, thus yielding a 12-bit data right-
aligned, the effective analog watchdog comparison can only be performed on 8 bits. The
comparison is done between ADC_DR[11:4] and HT[0:7] / LT[[0:7], and HT[11:8] / LT[11:8]
must be kept reset.
Triggered mode
The averager can also be used for basic filtering purpose. Although not a very powerful filter
(slow roll-off and limited stop band attenuation), it can be used as a notch filter to reject
constant parasitic frequencies (typically coming from the mains or from a switched mode
power supply). For this purpose, a specific discontinuous mode can be enabled with
TROVS bit in ADC_CFGR2, to be able to have an oversampling frequency defined by a
user and independent from the conversion time itself.
The Figure 134 below shows how conversions are started in response to triggers during
discontinuous mode.
If the TROVS bit is set, the content of the DISCEN bit is ignored and considered as 1.
Trigger Trigger
CONT=0
DISCEN = 1
TROVS = 0
Ch(N)0 Ch(N)1 Ch(N)2 Ch(N)3 Ch(N)0 Ch(N)1 Ch(N)2 Ch(N)3
Oversampling Oversampling
stopped continued
Regular channels Ch(N)0 Ch(N)1 Ch(N)2 Ch(N)3 Ch(M)0 Ch(M)1 Ch(M)1 Ch(M)2 Ch(M)3 Ch(O)0
Abort
Trigger
JEOC
Oversampling Oversampling
aborted resumed
Regular channels Ch(N)0 Ch(N)1 Ch(N)2 Ch(N)3 Ch(M)0 Ch(M)1 Ch(M)0 Ch(M)1 Ch(M)2 Ch(M)3
Abort
Trigger
JEOC
Oversampling Oversampling
aborted resumed
Regular channels Ch(N)0 Ch(N)1 Ch(N)2 Ch(N)3 Ch(M)0 Ch(M)1 Ch(M)0 Ch(M)1
Abort
Trigger
JEOC
Oversampling
resumed
Auto-injected mode
It is possible to oversample auto-injected sequences and have all conversions results stored
in registers to save a DMA resource. This mode is available only with both regular and
injected oversampling active: JAUTO = 1, ROVSE = 1 and JOVSE = 1, other combinations
are not supported. The ROVSM bit is ignored in auto-injected mode. The Figure 138 below
shows how the conversions are sequenced.
Regular channels N0 N1 N2 N3 N0 N1 N2 N3
Injected channels I0 I1 I2 I3 J0 J1 J2 J3 K0 K1 K2 K3 L0 L1 L2 L3
It is possible to have also the triggered mode enabled, using the TROVS bit. In this case,
the ADC must be configured as following: JAUTO = 1, DISCEN = 0, JDISCEN = 0, ROVSE
= 1, JOVSE = 1 and TROVSE = 1.
Address/data bus
channels
ADCx_INN2
ADCx_INP2 Injected
Slave ADC
channels
Internal triggers
Injected
channels
Dual mode
control
Master ADC
MSv36025V2
1. External triggers also exist on slave ADC but are not shown for the purposes of this diagram.
2. The ADC common data register (ADCx_CDR) contains both the master and slave ADC regular converted data.
Trigger
End of injected sequence on
Sampling MASTER and SLAVE ADC
Conversion
MS31900V1
ongoing regular sequence and the associated delay phases are ignored.
There is the same behavior for regular sequences occurring on the slave ADC.
Trigger
End of regular sequence on
Sampling MASTER and SLAVE ADC
Conversion ai16054b
If DISCEN=1 then each “n” simultaneous conversions of the regular sequence require a
regular trigger event to occur (“n” is defined by DISCNUM).
This mode can be combined with AUTDLY mode:
• Once a simultaneous conversion of the sequence has ended, the next conversion in
the sequence is started only if the common data register, ADCx_CDR (or the regular
data register of the master ADC) has been read (delay phase).
• Once a simultaneous regular sequence of conversions has ended, a new regular
trigger event is accepted only if the common data register (ADCx_CDR) has been read
(delay phase). Any new regular trigger events occurring during the ongoing regular
sequence and the associated delay phases are ignored.
It is possible to use the DMA to handle data in regular simultaneous mode combined with
AUTDLY mode, assuming that multi-DMA mode is used: bits MDMA must be set to 0b10 or
0b11.
When regular simultaneous mode is combined with AUTDLY mode, it is mandatory for the
user to ensure that:
• The number of conversions in the master’s sequence is equal to the number of
conversions in the slave’s.
• For each simultaneous conversions of the sequence, the length of the conversion of
the slave ADC is inferior to the length of the conversion of the master ADC. Note that
the length of the sequence depends on the number of channels to convert and the
sampling time and the resolution of each channels.
Note: This combination of regular simultaneous mode and AUTDLY mode is restricted to the use
case when only regular channels are programmed: it is forbidden to program injected
channels in this combined mode.
conversion if the complementary ADC is still sampling its input (only one ADC can sample
the input signal at a given time).
• The minimum possible DELAY is 1 to ensure that there is at least one cycle time
between the opening of the analog switch of the master ADC sampling phase and the
closing of the analog switch of the slave ADC sampling phase.
• The maximum DELAY is equal to the number of cycles corresponding to the selected
resolution. However the user must properly calculate this delay to ensure that an ADC
does not start a conversion while the other ADC is still sampling its input.
If the CONT bit is set on both master and slave ADCs, the selected regular channels of both
ADCs are continuously converted.
The software is notified by interrupts when it can read the data at the end of each
conversion event (EOC) on the slave ADC. A slave and master EOC interrupts are
generated (if EOCIE is enabled) and the software can read the ADC_DR of the slave/master
ADC.
Note: It is possible to enable only the EOC interrupt of the slave and read the common data
register (ADCx_CDR). But in this case, the user must ensure that the duration of the
conversions are compatible to ensure that inside the sequence, a master conversion is
always followed by a slave conversion before a new master conversion restarts. It is
recommended to use the MDMA mode.
It is also possible to have the regular data transferred by DMA. In this case, individual DMA
requests on each ADC cannot be used and it is mandatory to use the MDMA mode, as
following:
• Configure MDMA[1:0]=0b10 or 0b11 (depending on resolution).
• A single DMA channel is used (the one of the master). Configure the DMA master ADC
channel to read the common ADC register (ADCx_CDR).
• A single DMA request is generated each time both master and slave EOC events have
occurred. At that time, the slave ADC converted data is available in the upper half-word
of the ADCx_CDR 32-bit register and the master ADC converted data is available in the
lower half-word of ADCx_CCR register.
• Both EOC flags are cleared when the DMA reads the ADCx_CCR register.
Figure 142. Interleaved mode on 1 channel in continuous conversion mode: dual ADC
mode
SLAVE ADC
CH1 CH1
Trigger
Conversion
MSv31030V3
Figure 143. Interleaved mode on 1 channel in single conversion mode: dual ADC
mode
0.5 ADCCLK 0.5 ADCCLK
cycle cycle
Sampling
Conversion
MSv31031V3
CH11
Sampling Conversion
MS34460V1
1. When the 1st trigger occurs, all injected master ADC channels in the group are
converted.
2. When the 2nd trigger occurs, all injected slave ADC channels in the group are
converted.
3. And so on.
A JEOS interrupt, if enabled, is generated after all injected channels of the master ADC in
the group have been converted.
A JEOS interrupt, if enabled, is generated after all injected channels of the slave ADC in the
group have been converted.
JEOC interrupts, if enabled, can also be generated after each injected conversion.
If another external trigger occurs after all injected channels in the group have been
converted then the alternate trigger process restarts by converting the injected channels of
the master ADC in the group.
MASTER ADC
SLAVE ADC
MASTER ADC
SLAVE ADC
Sampling
Conversion
ai16059-m
Note: Regular conversions can be enabled on one or all ADCs. In this case the regular
conversions are independent of each other. A regular conversion is interrupted when the
ADC has to perform an injected conversion. It is resumed when the injected conversion is
finished.
The time interval between 2 trigger events must be greater than or equal to 1 ADC clock
period. The minimum time interval between 2 trigger events that start conversions on the
same ADC is the same as in the single ADC mode.
Injected discontinuous mode enabled (JDISCEN=1 for both ADC)
If the injected discontinuous mode is enabled for both master and slave ADCs:
• When the 1st trigger occurs, the first injected channel of the master ADC is converted.
• When the 2nd trigger occurs, the first injected channel of the slave ADC is converted.
• And so on.
A JEOS interrupt, if enabled, is generated after all injected channels of the master ADC in
the group have been converted.
A JEOS interrupt, if enabled, is generated after all injected channels of the slave ADC in the
group have been converted.
JEOC interrupts, if enabled, can also be generated after each injected conversions.
If another external trigger occurs after all injected channels in the group have been
converted then the alternate trigger process restarts.
Figure 146. Alternate trigger: 4 injected channels (each ADC) in discontinuous mode
1st trigger 3rd trigger 5th trigger 7th trigger
JEOC on JEOC on JEOC, JEOS on
JEOC on master ADC
master ADC master ADC master ADC
MASTER ADC
SLAVE ADC
Sampling
Conversion ai16060V2-m
Note: In combined regular simultaneous + alternate trigger mode, one must convert sequences
with the same length or ensure that the interval between triggers is longer than the long
conversion time of the 2 sequences. Otherwise, the ADC with the shortest sequence may
restart while the ADC with the longest sequence is completing the previous conversions.
ADC MASTER reg CH1 CH2 CH3 CH3 CH4 CH4 CH5
ADC SLAVE reg CH4 CH6 CH7 CH7 CH8 CH8 CH9
If a trigger occurs during an injected conversion that has interrupted a regular conversion,
the alternate trigger is served. Figure 148 shows the behavior in this case (note that the 6th
trigger is ignored because the associated alternate conversion is not complete).
ADC MASTER reg CH1 CH2 CH3 CH3 CH4 CH4 CH5 CH5 CH6
ADC MASTER inj CH14 CH14 CH14
ADC SLAVE reg CH7 CH8 CH9 CH9 CH10 CH10 CH11 CH11 CH12
ADC SLAVE inj CH15 CH15
6th trigger
2nd trigger 4th trigger (ignored)
ai16063V2
Figure 149. Interleaved single channel CH0 with injected sequence CH11, CH12
Legend:
Injected trigger Resume
(always restart with the master)
Sampling Conversion
MS34461V1
Figure 150. Two Interleaved channels (CH1, CH2) with injected sequence CH11, CH12
- case 1: Master interrupted first
Legend:
Injected trigger Resume
(always restart with the master)
Sampling Conversion
MS34462V1
Figure 151. Two Interleaved channels (CH1, CH2) with injected sequence CH11, CH12
- case 2: Slave interrupted first
Legend:
Injected trigger Resume
(always restart with the master)
Sampling Conversion
MS34463V2
In simultaneous regular and interleaved modes, it is also possible to save one DMA channel
and transfer both data using a single DMA channel. For this MDMA bits must be configured
in the ADCx_CCR register:
• MDMA=0b10: A single DMA request is generated each time both master and slave
EOC events have occurred. At that time, two data items are available and the 32-bit
register ADCx_CDR contains the two half-words representing two ADC-converted data
items. The slave ADC data take the upper half-word and the master ADC data take the
lower half-word.
This mode is used in interleaved mode and in regular simultaneous mode when
resolution is 10-bit or 12-bit.
Example:
Interleaved dual mode: a DMA request is generated each time 2 data items are
available:
1st DMA request: ADCx_CDR[31:0] = SLV_ADC_DR[15:0] | MST_ADC_DR[15:0]
2nd DMA request: ADCx_CDR[31:0] = SLV_ADC_DR[15:0] |
MST_ADC_DR[15:0]
MSv31034V2
Note: When using MDMA mode, the user must take care to configure properly the duration of the
master and slave conversions so that a DMA request is generated and served for reading
both data (master + slave) before a new conversion is available.
• MDMA=0b11: This mode is similar to the MDMA=0b10. The only differences are that
on each DMA request (two data items are available), two bytes representing two ADC
converted data items are transferred as a half-word.
This mode is used in interleaved and regular simultaneous mode when resolution is 6-
bit or when resolution is 8-bit and data is not signed (offsets must be disabled for all the
involved channels).
Example:
Interleaved dual mode: a DMA request is generated each time 2 data items are
available:
1st DMA request: ADCx_CDR[15:0] = SLV_ADC_DR[7:0] | MST_ADC_DR[7:0]
2nd DMA request: ADCx_CDR[15:0] = SLV_ADC_DR[7:0] | MST_ADC_DR[7:0]
Overrun detection
In dual ADC mode (when DUAL[4:0] is not equal to b00000), if an overrun is detected on
one of the ADCs, the DMA requests are no longer issued to ensure that all the data
transferred to the RAM are valid (this behavior occurs whatever the MDMA configuration). It
may happen that the EOC bit corresponding to one ADC remains set because the data
register of this ADC contains valid data.
DMA one shot mode/ DMA circular mode when MDMA mode is selected
When MDMA mode is selected (0b10 or 0b11), bit DMACFG of the ADCx_CCR register
must also be configured to select between DMA one shot mode and circular mode, as
explained in section Section : Managing conversions using the DMA (bits DMACFG of
master and slave ADC_CFGR are not relevant).
The uncalibrated internal temperature sensor is more suited for applications that detect
temperature variations instead of absolute temperatures. To improve the accuracy of the
temperature sensor measurement, calibration values are stored in system memory for each
device by ST during production.
During the manufacturing process, the calibration data of the temperature sensor and the
internal voltage reference are stored in the system memory area. The user application can
then read them and use them to improve the accuracy of the temperature sensor or the
internal reference (refer to the datasheet for additional information).
The temperature sensor is internally connected to the ADC input channel which is used to
convert the sensor’s output voltage to a digital value. Refer to the electrical characteristics
section of the device datasheet for the sampling time value to be applied when converting
the internal temperature sensor.
When not in use, the sensor can be put in power-down mode.
Figure 155 shows the block diagram of the temperature sensor.
Address/data bus
data
ADCx
Temperature VTS
sensor ADC input
MSv37243V3
TS_CAL2_TEMP – TS_CAL1_TEMP
Temperature ( in °C ) = -------------------------------------------------------------------------------------------------- × ( TS_DATA – TS_CAL1 ) + 30 °C
TS_CAL2 – TS_CAL1
Where:
• TS_CAL2 is the temperature sensor calibration value acquired at TS_CAL2_TEMP.
• TS_CAL1 is the temperature sensor calibration value acquired at TS_CAL1_TEMP.
• TS_DATA is the actual temperature sensor output value converted by ADC.
Refer to the device datasheet for more information about TS_CAL1 and TS_CAL2
calibration points.
Note: The sensor has a startup time after waking from power-down mode before it can output VTS
at the correct level. The ADC also has a startup time after power-on, so to minimize the
delay, the ADEN and CH17SEL bits should be set at the same time.
The above formula is given for TS_DATA measurement done with the same VREF+voltage
as TS_CAL1/TS_CAL2 values. If VREF+ is different, the formula must be adapted. For
example if VREF+ = 3.3 V and TS_CAL data are acquired at VREF+= 3.0 V, TS_DATA must
be replaced by TS_DATA x (3.3/3.0).
VBAT
ADCx
VBAT/3
ADC input
MSv37245V1
1. The CH18SEL bit must be set to enable the conversion of internal channel for VBAT/3.
VREFINT
Internal ADC input
power block
MSv34467V5
1. The VREFEN bit into ADCx_CCR register must be set to enable the conversion of internal channels
(VREFINT).
Calculating the actual VDDA voltage using the internal reference voltage
The power supply voltage applied to the device may be subject to variations or not precisely
known. When VDDA is connected to VREF+, it is possible to compute the actual VDDA voltage
using the embedded internal reference voltage (VREFINT). VREFINT and its calibration data
acquired by the ADC during the manufacturing process at VDDA_Charac can be used to
evaluate the actual VDDA voltage level.
The following formula gives the actual VDDA voltage supplying the device:
Where:
• VREFINT_CAL is the VREFINT calibration value
• VREFINT_DATA is the actual VREFINT output value converted by ADC
By replacing VREF+ by the formula provided above, the absolute voltage value is given by
the following formula
V DDA_Charac × VREFINT_CAL × ADC_DATA
V CHANNELx = ---------------------------------------------------------------------------------------------------------------------
VREFINT_DATA × FULL_SCALE
For applications where VDDA is known and ADC converted values are right-aligned, the
absolute voltage value can be obtained by using the following formula:
V DDA
V CHANNELx = ------------------------------------- × ADC_DATA
FULL_SCALE
Where:
– VDDA_Charac is the value of VDDA voltage characterized at VREFINT during the
manufacturing process.
– VREFINT_CAL is the VREFINT calibration value
– ADC_DATA is the value measured by the ADC on channel x (right-aligned)
– VREFINT_DATA is the actual VREFINT output value converted by the ADC
– FULL_SCALE is the maximum digital value of the ADC output. For example with
12-bit resolution, it will be 212 - 1 = 4095 or with 8-bit resolution, 28 - 1 = 255.
Note: If ADC measurements are done using an output format other than 16-bit right-aligned, all
the parameters must first be converted to a compatible format before the calculation is
done.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. JQOVF AWD3 AWD2 AWD1 JEOS JEOC OVR EOS EOC EOSMP ADRDY
rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
JQOVF EOSMP ADRDY
Res. Res. Res. Res. Res. AWD3IE AWD2IE AWD1IE JEOSIE JEOCIE OVRIE EOSIE EOCIE
IE IE IE
rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
ADCA ADCA DEEP ADVREG
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
L LDIF PWD EN
rs rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
JADST JADST ADSTA
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. ADSTP ADDIS ADEN
P ART RT
rs rs rs rs rs rs
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
JAWD1 AWD1 AWD1S JDISC DISC
JQDIS AWD1CH[4:0] JAUTO JQM DISCNUM[2:0]
EN EN GL EN EN
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
AUT OVR EXTSE EXTSE EXTSE EXTSE DFSD DMA DMA
Res. CONT EXTEN[1:0] ALIGN RES[1:0]
DLY MOD L3 L2 L1 L0 MCFG CFG EN
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ROV
Res. Res. Res. Res. Res. TROVS OVSS[3:0] OVSR[2:0] JOVSE ROVSE
SM
rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
SMPPL
Res. SMP9[2:0] SMP8[2:0] SMP7[2:0] SMP6[2:0] SMP5[2:1]
US
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SMP5[
SMP4[2:0] SMP3[2:0] SMP2[2:0] SMP1[2:0] SMP0[2:0]
0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. SMP18[2:0] SMP17[2:0] SMP16[2:0] SMP15[2:1]
rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SMP15[0] SMP14[2:0] SMP13[2:0] SMP12[2:0] SMP11[2:0] SMP10[2:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. SQ4[4:0] Res. SQ3[4:0] Res. SQ2[4]
rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SQ2[3:0] Res. SQ1[4:0] Res. Res. L[3:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw
Note: Some channels are not connected physically and must not be selected for conversion.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. SQ9[4:0] Res. SQ8[4:0] Res. SQ7[4]
rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SQ7[3:0] Res. SQ6[4:0] Res. SQ5[4:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw
Note: Some channels are not connected physically and must not be selected for conversion.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. SQ14[4:0] Res. SQ13[4:0] Res. SQ12[4]
rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SQ12[3:0] Res. SQ11[4:0] Res. SQ10[4:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw
Note: Some channels are not connected physically and must not be selected for conversion.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. SQ16[4:0] Res. SQ15[4:0]
rw rw rw rw rw rw rw rw rw rw
Note: Some channels are not connected physically and must not be selected for conversion.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RDATA[15:0]
r r r r r r r r r r r r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. JSQ4[4:0] Res. JSQ3[4:0] Res. JSQ2[4:2]
rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
JSQ2[1:0] Res. JSQ1[4:0] JEXTEN[1:0] JEXTSEL[3:0] JL[1:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
Note: Some channels are not connected physically and must not be selected for conversion.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
OFFSETy
OFFSETy_CH[4:0] Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
_EN
rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. OFFSETy[11:0]
rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
JDATA[15:0]
r r r r r r r r r r r r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. AWD2CH[18:16]
rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
AWD2CH[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. AWD3CH[18:16]
rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
AWD3CH[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. DIFSEL[18:16]
rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DIFSEL[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. CALFACT_D[6:0]
rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. CALFACT_S[6:0]
rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
JQOVF_ AWD3_ AWD2_ AWD1_ JEOS_ JEOC_ OVR_ EOS_ EOC_ EOSMP_ ADRDY_
Res. Res. Res. Res. Res.
SLV SLV SLV SLV SLV SLV SLV SLV SLV SLV SLV
r r r r r r r r r r r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
JQOVF_ AWD3_ AWD2_ AWD1_ JEOS_ JEOC_ OVR_ EOS_ EOC_ EOSMP_ ADRDY_
Res. Res. Res. Res. Res.
MST MST MST MST MST MST MST MST MST MST MST
r r r r r r r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
CH18S VREF
Res. Res. Res. Res. Res. Res. Res. CH17SEL PRESC[3:0] CKMODE[1:0]
EL EN
rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DMA
MDMA[1:0] Res. DELAY[3:0] Res. Res. Res. DUAL[4:0]
CFG
rw rw rw rw rw rw rw rw rw rw rw rw
In all synchronous clock modes, there is no jitter in the delay from a timer trigger to the start
of a conversion.
Note: The software is allowed to write these bits only when the ADCs are disabled
(ADCAL=0, JADSTART=0, ADSTART=0, ADSTP=0, ADDIS=0 and ADEN=0).
Bits 15:14 MDMA[1:0]: Direct memory access mode for dual ADC mode
This bitfield is set and cleared by software. Refer to the DMA controller section for more
details.
00: MDMA mode disabled
01: Enable dual interleaved mode to output to the master channel of DFSDM interface both
Master and the Slave result (16-bit data width)
10: MDMA mode enabled for 12 and 10-bit resolution
11: MDMA mode enabled for 8 and 6-bit resolution
Note: The software is allowed to write these bits only when ADSTART=0 (which ensures that
no regular conversion is ongoing).
Bit 13 DMACFG: DMA configuration (for dual ADC mode)
This bit is set and cleared by software to select between two DMA modes of operation and is
effective only when DMAEN=1.
0: DMA One Shot mode selected
1: DMA Circular mode selected
For more details, refer to Section : Managing conversions using the DMA
Note: The software is allowed to write these bits only when ADSTART=0 (which ensures that
no regular conversion is ongoing).
00001 to 01001: Dual mode, master and slave ADCs working together
00001: Combined regular simultaneous + injected simultaneous mode
00010: Combined regular simultaneous + alternate trigger mode
00011: Combined Interleaved mode + injected simultaneous mode
00100: Reserved
00101: Injected simultaneous mode only
00110: Regular simultaneous mode only
00111: Interleaved mode only
01001: Alternate trigger mode only
All other combinations are reserved and must not be programmed
Note: The software is allowed to write these bits only when the ADCs are disabled
(ADCAL=0, JADSTART=0, ADSTART=0, ADSTP=0, ADDIS=0 and ADEN=0).
21.7.3 ADC common regular data register for dual mode (ADC_CDR)
Address offset: 0x0C (this offset address is relative to the master ADC base address +
0x300)
Reset value: 0x0000 0000
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
RDATA_SLV[15:0]
r r r r r r r r r r r r r r r r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RDATA_MST[15:0]
r r r r r r r r r r r r r r r r
Table 142. ADC register map and reset values for each ADC (offset=0x000
for master ADC, 0x100 for slave ADC)
Offset Register
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
EOSMP
ADRDY
JQOVF
AWD3
AWD2
AWD1
JEOC
JEOS
OVR
EOC
EOS
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
ADC_ISR
0x00
Reset value 0 0 0 0 0 0 0 0 0 0 0
EOSMPIE
ADRDYIE
JQOVFIE
AWD3IE
AWD2IE
AWD1IE
JEOCIE
JEOSIE
OVRIE
EOCIE
EOSIE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
ADC_IER
0x04
Reset value 0 0 0 0 0 0 0 0 0 0 0
ADVREGEN
JADSTART
DEEPPWD
ADCALDIF
ADSTART
JADSTP
ADCAL
ADSTP
ADDIS
ADEN
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
ADC_CR
0x08
Reset value 0 0 1 0 0 0 0 0 0 0
DFSDMCFG
EXTEN[1:0]
AWD1SGL
JAWD1EN
OVRMOD
EXTSEL3
EXTSEL2
EXTSEL1
EXTSEL0
DMACFG
JDISCEN
AWD1EN
AUTDLY
DISCEN
DMAEN
JAUTO
JQDIS.
ALIGN
CONT
DISCNUM RES
JQM
Res.
ADC_CFGR AWD1CH[4:0]
0x0C [2:0] [1:0]
Reset value 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ROVSM
ROVSE
TROVS
JOVSE
OVSR
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
ADC_CFGR2 OVSS[3:0]
0x0C [2:0]
Reset value 0 0 0 0 0 0 0 0 0 0 0
SMPPLUS.
SMP9 SMP8 SMP7 SMP6 SMP5 SMP4 SMP3 SMP2 SMP1 SMP0
Res.
ADC_SMPR1 [2:0] [2:0] [2:0] [2:0] [2:0] [2:0] [2:0] [2:0] [2:0] [2:0]
0x14
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
SMP18 SMP17 SMP16 SMP15 SMP14 SMP13 SMP12 SMP11 SMP10
Res.
Res.
Res.
Res.
Res.
ADC_SMPR2
0x18 [2:0] [2:0] [2:0] [2:0] [2:0] [2:0] [2:0] [2:0] [2:0]
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x1C Reserved Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Table 142. ADC register map and reset values for each ADC (offset=0x000
for master ADC, 0x100 for slave ADC) (continued)
Offset Register
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
0x44-
Reserved Res.
0x48
JEXTEN[1:0]
JEXTSEL
Res.
Res.
Res.
Res.
ADC_JSQR JSQ4[4:0] JSQ3[4:0] JSQ2[4:0] JSQ1[4:0] JL[1:0]
0x4C [3:0]
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x50-
Reserved Res.
0x5C
OFFSET1_EN
OFFSET1_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
ADC_OFR1 OFFSET1[11:0]
0x60 CH[4:0]
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
OFFSET2_EN
OFFSET2_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
ADC_OFR2 OFFSET2[11:0]
0x64 CH[4:0]
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
OFFSET3_EN
OFFSET3_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
ADC_OFR3 CH[4:0] Res. OFFSET3[11:0]
0x68
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
OFFSET4_EN
OFFSET4_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
ADC_OFR4 OFFSET4[11:0]
0x6C CH[4:0]
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x70-
Reserved Res.
0x7C
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
ADC_JDR1 JDATA1[15:0]
0x80
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
ADC_JDR2 JDATA2[15:0]
0x84
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
ADC_JDR3 JDATA3[15:0]
0x88
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
ADC_JDR4 JDATA4[15:0]
0x8C
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x8C-
Reserved Res.
0x9C
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
ADC_AWD2CR AWD2CH[18:0]
0xA0
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
ADC_AWD3CR AWD3CH[18:0]
0xA4
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
0xA8-
Reserved
0xAC
Table 142. ADC register map and reset values for each ADC (offset=0x000
for master ADC, 0x100 for slave ADC) (continued)
Offset Register
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
ADC_DIFSEL DIFSEL[18:0]
0xB0
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
ADC_CALFACT CALFACT_D[6:0] CALFACT_S[6:0]
0xB4
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Table 143. ADC register map and reset values (master and slave ADC
common registers) offset = 0x300
Offset Register
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
EOSMP_MST
ADRDY_MST
JQOVF_MST
EOSMP_SLV
ADRDY_SLV
JQOVF_SLV
AWD3_MST
AWD2_MST
AWD1_MST
JEOC_MST
JEOS_MST
AWD3_SLV
AWD2_SLV
AWD1_SLV
JEOC_SLV
JEOS_SLV
OVR_MST
EOC_MST
EOS_MST
OVR_SLV
EOC_SLV
EOS_SLV
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
ADC_CSR
0x00
MDMA[1:0]
CH18SEL
CH17SEL
DMACFG
VREFEN
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
ADC_CCR PRESC[3:0] DELAY[3:0] DUAL[4:0]
0x08
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ADC_CDR RDATA_SLV[15:0] RDATA_MST[15:0]
0x0C
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
22.1 Introduction
The DAC module is a 12-bit, voltage output digital-to-analog converter. The DAC can be
configured in 8- or 12-bit mode and may be used in conjunction with the DMA controller. In
12-bit mode, the data could be left- or right-aligned. The DAC features two output channels,
each with its own converter. In dual DAC channel mode, conversions could be done
independently or simultaneously when both channels are grouped together for synchronous
update operations. An input reference pin, VREF+ (shared with others analog peripherals) is
available for better resolution. An internal reference can also be set on the same input.
Refer to voltage reference buffer (VREFBUF) section.
The DAC_OUTx pin can be used as general purpose input/output (GPIO) when the DAC
output is disconnected from output pad and connected to on chip peripheral. The DAC
output buffer can be optionally enabled to allow a high drive output current. An individual
calibration can be applied on each DAC output channel. The DAC output channels support
a low power mode, the Sample and hold mode.
Dual channel X
Output buffer X
I/O connection DAC1_OUT1 on PA4, DAC1_OUT2 on PA5
Maximum sampling time 1MSPS
Autonomous mode -
Offset calibration
Sample & Hold Registers
Control registers OTRIM1[5:0]bits
& logic Channel1 TSAMPLE1
THOLD1
TSEL1[3:0]
bits DMA_Request TREFRESH1
DAC_OUT1
DAC Buffer 1
TRIG DAC_DOR1
converter 1
12-bit
1
MODE1 bits
dac_out1
LSI clock
DAC channel 1
Offset calibration
Sample & Hold Registers
Control registers OTRIM2[5:0]bits On-chip
& logic Channel2 TSAMPLE2
Peripherals
THOLD2
TSEL2[3:0]
bits DMA_Request TREFRESH2
DAC_OUT2
TRIG
DAC
DAC_DOR2 Buffer 2
converter 2
12-bit
1
MODE2 bits
dac_out2
DAC channel 2
VSSA
MSv40461V3
1. MODEx bits in the DAC_MCR control the output mode and allow switching between the Normal mode in
buffer/unbuffered configuration and the Sample and hold mode.
2. Refer to Section 22.3: DAC implementation for channel2 availability.
Input, analog reference The higher/positive reference voltage for the DAC,
VREF+
positive VREF+ ≤ VDDAmax (refer to datasheet)
VDDA Input, analog supply Analog power supply
VSSA Input, analog supply ground Ground for analog power supply
DAC_OUTx Analog output signal DAC channelx analog output
mapped registers). The DHRx register is then loaded into the DORx register either
automatically, by software trigger or by an external event trigger.
31 24 15 7 0
8-bit right aligned
ai14710b
• Dual DAC channels (when available)
There are three possibilities:
– 8-bit right alignment: data for DAC channel1 to be loaded into the DAC_DHR8RD
[7:0] bits (stored into the DHR1[11:4] bits) and data for DAC channel2 to be loaded
into the DAC_DHR8RD [15:8] bits (stored into the DHR2[11:4] bits)
– 12-bit left alignment: data for DAC channel1 to be loaded into the DAC_DHR12LD
[15:4] bits (stored into the DHR1[11:0] bits) and data for DAC channel2 to be
loaded into the DAC_DHR12LD [31:20] bits (stored into the DHR2[11:0] bits)
– 12-bit right alignment: data for DAC channel1 to be loaded into the
DAC_DHR12RD [11:0] bits (stored into the DHR1[11:0] bits) and data for DAC
channel2 to be loaded into the DAC_DHR12RD [27:16] bits (stored into the
DHR2[11:0] bits)
Depending on the loaded DAC_DHRyyyD register, the data written by the user is shifted
and stored into DHR1 and DHR2 (data holding registers, which are internal non-memory-
mapped registers). The DHR1 and DHR2 registers are then loaded into the DAC_DOR1
and DOR2 registers, respectively, either automatically, by software trigger or by an external
event trigger.
ai14709b
Figure 161. Timing diagram for conversion with trigger disabled TEN = 0
APB1_CLK
DHR 0x1AC
Output voltage
DOR 0x1AC available on DAC_OUT pin
tSETTLING
ai14711c
DMA underrun
The DAC DMA request is not queued so that if a second external trigger arrives before the
acknowledgment for the first external trigger is received (first request), then no new request
is issued and the DMA channelx underrun flag DMAUDRx in the DAC_SR register is set,
reporting the error condition. The DAC channelx continues to convert old data.
The software must clear the DMAUDRx flag by writing 1, clear the DMAEN bit of the used
DMA stream and re-initialize both DMA and DAC channelx to restart the transfer correctly.
The software must modify the DAC trigger conversion frequency or lighten the DMA
workload to avoid a new DMA underrun. Finally, the DAC conversion could be resumed by
enabling both DMA data transfer and conversion trigger.
For each DAC channelx, an interrupt is also generated if its corresponding DMAUDRIEx bit
in the DAC_CR register is enabled.
XOR
X6 X4 X X0
X 12
11 10 9 8 7 6 5 4 3 2 1 0
12
NOR
ai14713c
The LFSR value, that may be masked partially or totally by means of the MAMPx[3:0] bits in
the DAC_CR register, is added up to the DAC_DHRx contents without overflow and this
value is then transferred into the DAC_DORx register.
If LFSR is 0x0000, a ‘1 is injected into it (antilock-up mechanism).
It is possible to reset LFSR wave generation by resetting the WAVEx[1:0] bits.
Figure 163. DAC conversion (SW trigger enabled) with LFSR wave generation
APB1_CLK
DHR 0x00
SWTRIG
ai14714b
Note: The DAC trigger must be enabled for noise generation by setting the TENx bit in the
DAC_CR register.
De
n
tio
cr
ta
em
en
en
em
ta
cr
tio
In
n
DAC_DHRx base value
0
ai14715c
Figure 165. DAC conversion (SW trigger enabled) with triangle wave generation
APB1_CLK
DHR 0xABE
SWTRIG
ai14716b
Note: The DAC trigger must be enabled for triangle wave generation by setting the TENx bit in the
DAC_CR register.
The MAMPx[3:0] bits must be configured before enabling the DAC, otherwise they cannot
be changed.
Normal mode
In Normal mode, there are four combinations, by changing the buffer state and by changing
the DAC_OUTx pin interconnections.
To enable the output buffer, the MODEx[2:0] bits in DAC_MCR register must be:
• 000: DAC is connected to the external pin
• 001: DAC is connected to external pin and to on-chip peripherals
To disable the output buffer, the MODEx[2:0] bits in DAC_MCR register must be:
• 010: DAC is connected to the external pin
• 011: DAC is connected to on-chip peripherals
The timings for the three phases above are in units of LSI clock periods. As an example, to
configure a sample time of 350 µs, a hold time of 2 ms and a refresh time of 100 µs
assuming LSI ~32 KHz is selected:
12 cycles are required for sample phase: TSAMPLEx[9:0] = 11,
62 cycles are required for hold phase: THOLDx[9:0] = 62,
and 4 cycles are required for refresh period: TREFRESHx[7:0] = 4.
In this example, the power consumption is reduced by almost a factor of 15 versus Normal
modes.
The formulas to compute the right sample and refresh timings are described in the table
below, the Hold time depends on the leakage current.
Example of the sample and refresh time calculation with output buffer on
The values used in the example below are provided as indication only. Please refer to the
product datasheet for product data.
CSH = 100 nF
VDDA= 3.0 V
Sampling phase:
tSAMP = 7 μs + (10 * 2000 * 100 * 10-9) = 2.007 ms
(where RBON = 2 kΩ)
Refresh phase:
tREFRESH = 7 μs + (2000 * 100 * 10-9) * ln(2*10) = 606.1 μs
(where NLSB = 10 (10 LSB drop during the hold phase)
Hold phase:
Dv = ileak * thold / CSH = 0.0073 V (10 LSB of 12bit at 3 V)
ileak = 150 nA (worst case on the IO leakage on all the temperature range)
thold = 0.0073 * 100 * 10-9 / (150 * 10-9) = 4.867 ms
V1
Vd
V2
t
Sampling phase Hold phase Refresh Sampling phase
LSI phase
t
DAC
ON ON ON
MSv40462V2
Like in Normal mode, the Sample and hold mode has different configurations.
To enable the output buffer, MODEx[2:0] bits in DAC_MCR register must be set to:
• 100: DAC is connected to the external pin
• 101: DAC is connected to external pin and to on chip peripherals
To disabled the output buffer, MODEx[2:0] bits in DAC_MCR register must be set to:
• 110: DAC is connected to external pin and to on chip peripherals
• 111: DAC is connected to on chip peripherals
When MODEx[2:0] bits are equal to 111, an internal capacitor, CLint, holds the voltage
output of the DAC core and then drive it to on-chip peripherals.
All Sample and hold phases are interruptible, and any change in DAC_DHRx immediately
triggers a new sample phase.
V = ( ( D ⁄ 2N – 1 ) × G × V )+V
out ref OS
Where VOUT is the analog output, D is the digital input, G is the gain, Vref is the nominal full-
scale voltage, and Vos is the offset voltage. For an ideal DAC channel, G = 1 and Vos = 0.
Due to output buffer characteristics, the voltage offset may differ from part-to-part and
introduce an absolute offset error on the analog output. To compensate the Vos, a calibration
is required by a trimming technique.
The calibration is only valid when the DAC channelx is operating with buffer enabled
(MODEx[2:0] = 000b or 001b or 100b or 101b). if applied in other modes when the buffer is
off, it has no effect. During the calibration:
• The buffer output is disconnected from the pin internal/external connections and put in
tristate mode (HiZ).
• The buffer acts as a comparator to sense the middle-code value 0x800 and compare it
to VREF+/2 signal through an internal bridge, then toggle its output signal to 0 or 1
depending on the comparison result (CAL_FLAGx bit).
Two calibration techniques are provided:
• Factory trimming (default setting)
The DAC buffer offset is factory trimmed. The default value of OTRIMx[4:0] bits in
DAC_CCR register is the factory trimming value and it is loaded once DAC digital
interface is reset.
• User trimming
The user trimming can be done when the operating conditions differs from nominal
factory trimming conditions and in particular when VDDA voltage, temperature, VREF+
values change and can be done at any point during application by software.
Note: Refer to the datasheet for more details of the Nominal factory trimming conditions
In addition, when VDD is removed (example the device enters in STANDBY or VBAT modes)
the calibration is required.
The steps to perform a user trimming calibration are as below:
1. If the DAC channel is active, write 0 to ENx bit in DAC_CR to disable the channel.
2. Select a mode where the buffer is enabled, by writing to DAC_MCR register,
MODEx[2:0] = 000b or 001b or 100b or 101b.
3. Start the DAC channelx calibration, by setting the CENx bit in DAC_CR register to 1.
4. Apply a trimming algorithm:
a) Write a code into OTRIMx[4:0] bits, starting by 00000b.
b) Wait for tTRIM delay.
c) Check if CAL_FLAGx bit in DAC_SR is set to 1.
d) If CAL_FLAGx is set to 1, the OTRIMx[4:0] trimming code is found and can be
used during device operation to compensate the output value, else increment
OTRIMx[4:0] and repeat sub-steps from (a) to (d) again.
The software algorithm may use either a successive approximation or dichotomy techniques
to compute and set the content of OTRIMx[4:0] bits in a faster way.
The commutation/toggle of CAL_FLAGx bit indicates that the offset is correctly
compensated and the corresponding trim code must be kept in the OTRIMx[4:0] bits in
DAC_CCR register.
Note: A tTRIM delay must be respected between the write to the OTRIMx[4:0] bits and the read of
the CAL_FLAGx bit in DAC_SR register in order to get a correct value.This parameter is
specified into datasheet electrical characteristics section.
If VDDA, VREF+ and temperature conditions do not change during device operation while it
enters more often in standby and VBAT mode, the software may store the OTRIMx[4:0] bits
found in the first user calibration in the flash or in back-up registers. then to load/write them
directly when the device power is back again thus avoiding to wait for a new calibration time.
When CENx bit is set, it is not allowed to set ENx bit.
22.4.12 Dual DAC channel conversion modes (if dual channels are
available)
To efficiently use the bus bandwidth in applications that require the two DAC channels at the
same time, three dual registers are implemented: DHR8RD, DHR12RD and DHR12LD. A
unique register access is then required to drive both DAC channels at the same time. For
the wave generation, no accesses to DHRxxxD registers are required. As a result, two
output channels can be used either independently or simultaneously.
11 conversion modes are possible using the two DAC channels and these dual registers. All
the conversion modes can nevertheless be obtained using separate DHRx registers if
needed.
All modes are described in the paragraphs below.
When a DAC channel1 trigger arrives, the DHR1 register is transferred into DAC_DOR1
(three APB1 clock cycles later).
When a DAC channel2 trigger arrives, the DHR2 register is transferred into DAC_DOR2
(three APB1 clock cycles later).
1. Set the two DAC channel trigger enable bits TEN1 and TEN2.
2. Configure the same trigger source for both DAC channels by setting the same value in
the TSEL1 and TSEL2 bitfields.
3. Load the dual DAC channel data to the desired DHR register (DAC_DHR12RD,
DAC_DHR12LD or DAC_DHR8RD).
When a trigger arrives, the DHR1 and DHR2 registers are transferred into DAC_DOR1 and
DAC_DOR2, respectively (after three APB1 clock cycles).
1. Set the two DAC channel trigger enable bits TEN1 and TEN2
2. Configure the same trigger source for both DAC channels by setting the same value in
the TSEL1 and TSEL2 bitfields.
3. Configure the two DAC channel WAVEx[1:0] bits as 1x and the same maximum
amplitude value using the MAMPx[3:0] bits.
4. Load the dual DAC channel data into the desired DHR register (DAC_DHR12RD,
DAC_DHR12LD or DAC_DHR8RD).
When a trigger arrives, the DAC channel1 triangle counter, with the same triangle
amplitude, is added to the DHR1 register and the sum is transferred into DAC_DOR1 (three
APB1 clock cycles later). The DAC channel1 triangle counter is then updated.
At the same time, the DAC channel2 triangle counter, with the same triangle amplitude, is
added to the DHR2 register and the sum is transferred into DAC_DOR2 (three APB1 clock
cycles later). The DAC channel2 triangle counter is then updated.
Standby The DAC peripheral is powered down and must be reinitialized after exiting
Shutdown Standby or Shutdown mode.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DMAU DMAE
Res. CEN2 MAMP2[3:0] WAVE2[1:0] TSEL2[3] TSEL2[2] TSEL2[1] TSEL2[0] TEN2 EN2
DRIE2 N2
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DMAU DMAE
HFSEL CEN1 MAMP1[3:0] WAVE1[1:0] TSEL1[3] TSEL1[2] TSEL1[1] TSEL1[0] TEN1 EN1
DRIE1 N1
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. SWTRIG2 SWTRIG1
w w
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. DACC1DHR[11:0]
rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DACC1DHR[11:0] Res. Res. Res. Res.
rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. DACC1DHR[7:0]
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. DACC2DHR[11:0]
rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DACC2DHR[11:0] Res. Res. Res. Res.
rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. DACC2DHR[7:0]
rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. DACC2DHR[11:0]
rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. DACC1DHR[11:0]
rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DACC2DHR[11:0] Res. Res. Res. Res.
rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DACC1DHR[11:0] Res. Res. Res. Res.
rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DACC2DHR[7:0] DACC1DHR[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. DACC1DOR[11:0]
r r r r r r r r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. DACC2DOR[11:0]
r r r r r r r r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
CAL_ DMAU
BWST2 Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
FLAG2 DR2
r r rc_w1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CAL_ DMAU
BWST1 Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
FLAG1 DR1
r r rc_w1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. OTRIM2[4:0]
rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. OTRIM1[4:0]
rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. MODE2[2:0]
rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. MODE1[2:0]
rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. TSAMPLE1[9:0]
rw rw rw rw rw rw rw rw rw rw
Note: It represents the number of LSI clocks to perform a sample phase. Sampling time =
(TSAMPLE1[9:0] + 1) x LSI clock period.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. TSAMPLE2[9:0]
rw rw rw rw rw rw rw rw rw rw
Note: It represents the number of LSI clocks to perform a sample phase. Sampling time =
(TSAMPLE1[9:0] + 1) x LSI clock period.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. THOLD2[9:0]
rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. THOLD1[9:0]
rw rw rw rw rw rw rw rw rw rw
Bits 25:16 THOLD2[9:0]: DAC channel2 hold time (only valid in Sample and hold mode).
Hold time= (THOLD[9:0]) x LSI clock period
Note: This register can be modified only when EN2=0.
These bits are available only on dual-channel DACs. Refer to Section 22.3: DAC
implementation.
Bits 15:10 Reserved, must be kept at reset value.
Bits 9:0 THOLD1[9:0]: DAC channel1 hold time (only valid in Sample and hold mode)
Hold time= (THOLD[9:0]) x LSI clock period
Note: This register can be modified only when EN1=0.
Note: These bits can be written only when the DAC channel is disabled and in Normal operating
mode (when bit ENx=0 and bit CENx=0 in the DAC_CR register). If ENx=1 or CENx=1 the
write operation is ignored.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. TREFRESH2[7:0]
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. TREFRESH1[7:0]
rw rw rw rw rw rw rw rw
Bits 23:16 TREFRESH2[7:0]: DAC channel2 refresh time (only valid in Sample and hold mode)
Refresh time= (TREFRESH[7:0]) x LSI clock period
Note: This register can be modified only when EN2=0.
These bits are available only on dual-channel DACs. Refer to Section 22.3: DAC
implementation.
Bits 15:8 Reserved, must be kept at reset value.
Bits 7:0 TREFRESH1[7:0]: DAC channel1 refresh time (only valid in Sample and hold mode)
Refresh time= (TREFRESH[7:0]) x LSI clock period
Note: This register can be modified only when EN1=0.
Note: These bits can be written only when the DAC channel is disabled and in Normal operating
mode (when bit ENx=0 and bit CENx=0 in the DAC_CR register). If ENx=1 or CENx=1 the
write operation is ignored.
0x2C
0x1C
0x0C
Offset
RM0432
22.7.21
DAC_
DAC_
DAC_
DAC_
DAC_
DAC_
DAC_
DAC_
DAC_
DAC_
DAC_
DAC_
DOR2
DOR1
name
DHR8R2
DHR8R1
DAC_SR
DHR8RD
DAC_CR
SWTRGR
DHR12L2
DHR12L1
DHR12R2
DHR12R1
DHR12LD
DHR12RD
Register
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
0
0
BWST2 Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 31
0
0
0
CAL_FLAG2 Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. CEN2 30
0
0
0
DMAUDR2 Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. DMAUDRIE2 29
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. DMAEN2 28
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 27
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 26
MAMP2[3:0]
0
0
0
DAC register map
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 25
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 24
DACC2DHR[11:0]
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 23
WAVE2[2:0]
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 22
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. TSEL23 21
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. TSEL22 20
DACC2DHR[11:0]
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. TSEL21 19
Table 151 summarizes the DAC registers.
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. TSEL20 18
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. TEN2 17
RM0432 Rev 6
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. EN2 16
0
0
0
0
0
0
BWST1 Res. Res. Res. Res. Res. Res. Res. Res. HFSEL 15
0
0
0
0
0
0
CAL_FLAG1 Res. Res. Res. Res. Res. Res. Res. Res. CEN1 14
0
0
0
0
0
0
DMAUDR1 Res. Res. Res. Res. Res. Res. Res. Res. DMAUDRIE1 13
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. DMAEN1 12
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Table 151. DAC register map and reset values
DACC2DHR[7:0]
MAMP1[3:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
DACC1DHR[11:0]
DACC2DHR[11:0]
DACC1DHR[11:0]
0
0
0
0
0
0
0
0
0
0
0
0
Res. Res. 7
WAVE1[1:0]
0
0
0
0
0
0
0
0
0
0
0
0
Res. Res. 6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
DACC1DHR[11:0]
DACC2DHR[11:0]
DACC1DHR[11:0]
DACC2DOR[11:0]
DACC1DOR[11:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
DACC1DHR[7:0]
DACC2DHR[7:0]
DACC1DHR[7:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
761/2301
Digital-to-analog converter (DAC)
762
0x48
0x44
0x40
0x38
0x4C
0x3C
Offset
762/2301
DAC_
DAC_
DAC_
DAC_
SHRR
SHHR
SHSR2
SHSR1
name
DAC_CCR
DAC_MCR
Register
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Res. Res. Res. Res. Res. Res. 31
Res. Res. Res. Res. Res. Res. 30
Res. Res. Res. Res. Res. Res. 29
Res. Res. Res. Res. Res. Res. 28
Res. Res. Res. Res. Res. Res. 27
Res. Res. Res. Res. Res. Res. 26
0
Digital-to-analog converter (DAC)
0
Res. Res. Res. Res. Res. 24
0
0
Res. Res. Res. Res. 23
0
0
Res. Res. Res. Res. 22
0
0
Res. Res. Res. Res. 21
0
0
X
0
0
X
0
0
0
X
Res. Res. 18
TREFRESH2[7:0]
0
0
0
X
Res. Res. 17
[2:0]
OTRIM2[4:0]
RM0432 Rev 6
MODE2
1
0
1
X
Res. Res. 16
Res. Res. Res. Res. Res. Res. 15
Res. Res. Res. Res. Res. Res. 14
Res. Res. Res. Res. Res. Res. 13
Res. Res. Res. Res. Res. Res. 12
Res. Res. Res. Res. Res. Res. 11
Res. Res. Res. Res. Res. Res. 10
0
0
0
0
0
0
0
Res. Res. 7
0
0
0
0
Res. Res. 6
0
0
0
0
Res. Res. 5
0
0
0
0
X
Res. 4
0
0
0
0
X
THOLD1[9:0]
Res. 3
TSAMPLE2[9:0]
TSAMPLE1[9:0]
0
0
0
0
0
X
2
TREFRESH1[7:0]
0
0
0
0
0
X
1
[2:0]
OTRIM1[4:0]
MODE1
1
1
0
0
0
X
0
RM0432
RM0432 Voltage reference buffer (VREFBUF)
23.1 Introduction
The STM32L4+ Series devices embed a voltage reference buffer which can be used as
voltage reference for ADCs, DACs and also as voltage reference for external components
through the VREF+ pin. When the VREF+ pin is double-bonded with VDDA pin in a
package, the voltage reference buffer is not available and must be kept disabled (refer to
datasheet for packages pinout description).
After enabling the VREFBUF by setting ENVR bit and clearing HIZ bit in the VREFBUF_CSR register,
the user must wait until VRR bit is set, meaning that the voltage reference output has reached its
expected value.
a. The minimum VDDA voltage depends on VRS setting, refer to the product datasheet.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. VRR VRS HIZ ENVR
r rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. TRIM[5:0]
rw rw rw rw rw rw
10
11
9
8
7
6
5
4
3
2
1
0 ENVR
VRR
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
VRS
HIZ
VREFBUF_CSR
0x00
Reset value 0 0 1 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
VREFBUF_CCR TRIM[5:0]
0x04
Reset value x x x x x x
24.1 Introduction
The digital camera is a synchronous parallel interface able to receive a high-speed data flow
from an external 8-, 10-, 12- or 14-bit CMOS camera module. It supports different data
formats: YCbCr4:2:2/RGB565 progressive video and compressed data (JPEG).
DMA
Control/Statusregister
interface
AHB
interface
FIFO
Data Synchronizer DCMI_PIXCLK
Data
extraction
formatter
DMA_REQ
ai15603c
8 bits DCMI_D[7:0]
10 bits DCMI_D[9:0]
Inputs DCMI data
12 bits DCMI_D[11:0]
14 bits DCMI_D[13:0]
DCMI_PIXCLK Input Pixel clock
DCMI_HSYNC Input Horizontal synchronization / Data valid
DCMI_VSYNC Input Vertical synchronization
from the camera are stable and can be sampled. The maximum DCMI_PIXCLK period must
be higher than 2.5 HCLK periods.
DCMI_PIXCLK
DCMI_D[13:0]
DCMI_HSYNC
DCMI_VSYNC
ai15606c
1. The capture edge of DCMI_PIXCLK is the falling edge, the active state of DCMI_HSYNC and
DCMI_VSYNC is 1.
2. DCMI_HSYNC and DCMI_VSYNC can change states at the same time.
8-bit data
When EDM[1:0] = 00 in DCMI_CR the interface captures 8 LSBs at its input (DCMI_D[7:0])
and stores them as 8-bit data. The DCMI_D[13:8] inputs are ignored. In this case, to capture
a 32-bit word, the camera interface takes four pixel clock cycles.
The first captured data byte is placed in the LSB position in the 32-bit word and the 4th
captured data byte is placed in the MSB position in the 32-bit word. The table below gives
an example of the positioning of captured data bytes in two 32-bit words.
Table 155. Positioning of captured data bytes in 32-bit words (8-bit width)
Byte address 31:24 23:16 15:8 7:0
10-bit data
When EDM[1:0] = 01 in DCMI_CR, the camera interface captures 10-bit data at its input
DCMI_D[9:0] and stores them as the 10 least significant bits of a 16-bit word. The remaining
most significant bits of the DCMI_DR register (bits 11 to 15) are cleared to zero. So, in this
case, a 32-bit data word is made up every two pixel clock cycles.
The first captured data are placed in the LSB position in the 32-bit word and the 2nd
captured data are placed in the MSB position in the 32-bit word as shown in the table below.
Table 156. Positioning of captured data bytes in 32-bit words (10-bit width)
Byte address 31:26 25:16 15:10 9:0
0 0 Dn+1[9:0] 0 Dn[9:0]
4 0 Dn+3[9:0] 0 Dn+2[9:0]
12-bit data
When EDM[1:0] = 10 in DCMI_CR, the camera interface captures the 12-bit data at its input
DCMI_D[11:0] and stores them as the 12 least significant bits of a 16-bit word. The
remaining most significant bits are cleared to zero. So, in this case a 32-bit data word is
made up every two pixel clock cycles.
The first captured data are placed in the LSB position in the 32-bit word and the 2nd
captured data are placed in the MSB position in the 32-bit word as shown in the table below.
Table 157. Positioning of captured data bytes in 32-bit words (12-bit width)
Byte address 31:28 27:16 15:12 11:0
0 0 Dn+1[11:0] 0 Dn[11:0]
4 0 Dn+3[11:0] 0 Dn+2[11:0]
14-bit data
When EDM[1:0] = 11 in DCMI_CR, the camera interface captures the 14-bit data at its input
DCMI_D[13:0] and stores them as the 14 least significant bits of a 16-bit word. The
remaining most significant bits are cleared to zero. So, in this case a 32-bit data word is
made up every two pixel clock cycles.
The first captured data are placed in the LSB position in the 32-bit word and the 2nd
captured data are placed in the MSB position in the 32-bit word as shown in the table below.
Table 158. Positioning of captured data bytes in 32-bit words (14-bit width)
Byte address 31:30 29:16 15:14 13:0
0 0 Dn+1[13:0] 0 Dn[13:0]
4 0 Dn+3[13:0] 0 Dn+2[13:0]
Padding data
at the end of the JPEG stream
Beginning of JPEG stream Programmable
JPEG packet size
JPEG data
DCMI_VSYNC
ai15944b
capture is enabled (CAPTURE bit set in DCMI_CR), data transfer is synchronized with the
deactivation of the DCMI_VSYNC signal (next start of frame).
Transfer can then be continuous, with successive frames transferred by DMA to successive
buffers or the same/circular buffer. To allow the DMA management of successive frames, a
VSIF (Vertical synchronization interrupt flag) is activated at the end of each frame.
detect a frame/line start or frame/line end. This means that there can be different codes for
the frame/line start and frame/line end with the unmasked bit position remaining the same.
Example
FS = 0xA5
Unmask code for FS = 0x10
In this case the frame start code is embedded in the bit 4 of the frame start code.
DCMI_HSYNC
DCMI_VSYNC
Frame 2
Frame 1 captured not captured
ai15832b
DCMI_HSYNC
DCMI_VSYNC
ai15833b
VST[12:0] in DCMI_CWSTRT
VLINE[13:0] in DCMI_CWSIZE
HOFFCNT[13:0]
in
CAPCNT[13:0] in DCMI_CWSIZE
DCMI_CWSTRT
MS35933V3
These registers specify the coordinates of the starting point of the capture window as a line
number (in the frame, starting from 0) and a number of pixel clocks (on the line, starting from
0), and the size of the window as a line number and a number of pixel clocks. The CAPCNT
value can only be a multiple of 4 (two least significant bits are forced to 0) to allow the
correct transfer of data through the DMA.
If the DCMI_VSYNC signal goes active before the number of lines is specified in the
DCMI_CWSIZE register, then the capture stops and an IT_FRAME interrupt is generated
when enabled.
DCMI_HSYNC
DCMI_VSYNC
HOFFCNT
CAPCNT
Monochrome format
Characteristics:
• Raster format
• 8 bits per pixel
The table below shows how the data are stored.
RGB format
Characteristics:
• Raster format
• RGB
• Interleaved: one buffer: R, G and B interleaved (such as BRGBRGBRG)
• Optimized for display output
The RGB planar format is compatible with standard OS frame buffer display formats.
Only 16 BPP (bits per pixel): RGB565 (2 pixels per 32-bit word) is supported.
The 24 BPP (palletized format) and gray-scale formats are not supported. Pixels are stored
in a raster scan order, that is from top to bottom for pixel rows, and from left to right within a
pixel row. Pixel components are R (red), G (green) and B (blue). All components have the
same spatial resolution (4:4:4 format). A frame is stored in a single part, with the
components interleaved on a pixel basis.
The table below shows how the data are stored.
YCbCr format
Characteristics:
• Raster format
• YCbCr 4:2:2
• Interleaved: one buffer: Y, Cb and Cr interleaved (such as CbYCrYCbYCr)
Pixel components are Y (luminance or “luma”), Cb and Cr (chrominance or “chroma” blue
and red). Each component is encoded in 8 bits. Luma and chroma are stored together
(interleaved) as shown in the table below.
0 Yn+1 Cr n Yn Cb n
4 Yn+3 Cr n + 2 Yn+2 Cb n + 2
Table 162. Data storage in YCbCr progressive video format - Y extraction mode
Byte address 31:24 23:16 15:8 7:0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. OELS LSM OEBS BSM[1:0]
rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ENABL PCKPO CAPTU
Res. Res. Res. EDM[1:0] FCRC[1:0] VSPOL HSPOL ESS JPEG CROP CM
E L RE
rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. FNE VSYNC HSYNC
r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LINE VSYNC ERR OVR FRAME
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
_RIS _RIS _RIS _RIS _RIS
r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LINE VSYNC ERR OVR FRAME
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
_IE _IE _IE _IE _IE
rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LINE VSYNC ERR OVR FRAME
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
_MIS _MIS _MIS _MIS _MIS
r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LINE VSYNC ERR OVR FRAME
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
_ISC _ISC _ISC _ISC _ISC
w w w w w
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
FEC[7:0] LEC[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LSC[7:0] FSC[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
FEU[7:0] LEU[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LSU[7:0] FSU[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. VST[12:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. HOFFCNT[13:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. VLINE[13:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. CAPCNT[13:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
BYTE3[7:0] BYTE2[7:0]
r r r r r r r r r r r r r r r r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
BYTE1[7:0] BYTE0[7:0]
r r r r r r r r r r r r r r r r
0x1C
0x0C
Offset
RM0432
24.5.12
name
DCMI_SR
DCMI_CR
DCMI_DR
DCMI_RIS
DCMI_IER
DCMI_ICR
DCMI_MIS
Register
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
DCMI_ESUR
DCMI_ESCR
DCMI_CWSIZE
DCMI_CWSTRT
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. 31
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. 30
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. 29
0
0
0
0
0
Res. Res. Res. Res. Res. Res. 28
0
0
0
0
0
Res. Res. Res. Res. Res. Res. 27
FEU[7:0]
FEC[7:0]
BYTE3[7:0]
0
0
0
0
0
Res. Res. Res. Res. Res. Res. 26
DCMI register map
0
0
0
0
0
Res. Res. Res. Res. Res. Res. 25
0
0
0
0
0
Res. Res. Res. Res. Res. Res. 24
0
0
0
0
0
Res. Res. Res. Res. Res. Res. 23
0
0
0
0
0
Res. Res. Res. Res. Res. Res. 22
VLINE[13:0]
0
0
0
0
0
Res. Res. Res. Res. Res. Res.
VST[12:0]
21
0
0
0
0
0
0
0
0
0
0
0
0
LEU[7:0]
LEC[7:0]
BYTE2[7:0]
0
0
0
0
0
0
0
0
0
0
0
0
RM0432 Rev 6
Res. Res. Res. Res. Res. 17
BSM[1:0]
0
0
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. 15
0
0
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res.
0
0
0
0
0
Res. Res. Res. Res. Res. Res. 12
0
0
0
0
0
0
LSU[7:0]
LSC[7:0]
EDM[1:0]
Table 164. DCMI register map and reset values
BYTE1[7:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
CAPCNT[13:0]
5
HOFFCNT[13:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
BYTE0[7:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
789/2301
0
789
Parallel synchronous slave interface (PSSI) applied to STM32L4P5xx and STM32LQ5xx only
The PSSI peripheral and the DCMI (digital camera interface) use the same circuitry. As a
result, these two peripherals cannot be used at the same time: when using the PSSI, the
DCMI registers cannot be accessed, and vice-versa.
In addition, the PSSI and the DCMI share the same alternate functions and interrupt vector
(see Section 25.3.2: PSSI pins and internal signals).
25.1 Introduction
The PSSI is a generic synchronous 8/16-bit parallel data input/output slave interface. It
enables the transmitter to send a data valid signal that indicates when the data is valid, and
the receiver to output a flow control signal that indicates when it is ready to sample the data.
DMA Control/Status
interface Register
AHB interface
FIFO/ PSSI_PDCK
Data
Data Synchronizer
extraction
formatter
PSSI_D[15:0]
PSSI_DE
PSSI_RDY
MSv48844V2
pssi_hclk
PSSI_D[15:0]
pssi_dma
MSv48845V3
8-bit data
The PSSI parallel interface can transfer either 8-bit (using D[7:0]) or 16-bit data (using
D[15:0]) depending on the EDM[1:0] control bits (bits 11:10 of PSSI_CR). If the 8-bit
configuration is selected (EDM[1:0] set to 00), the unused D[15:0] pins can be used for
GPIO or other functions.
When EDM[1:0] in PSSI_CR are programmed to 00, the interface transfers 8 bits using the
D[7:0] pins. In this case, D[15:8] are not used and four PSSI_PDCK cycles are required to
transfer a 32-bit word.
The least-significant byte (bits 7:0) correspond to the first byte transferred, and the most-
significant byte (bits 31:28) corresponds to the forth byte transferred. Table 167 illustrates
the positioning of the data bytes in two 32-bit words.
Table 167. Positioning of captured data bytes in 32-bit words (8-bit width)
Byte address 31:24 23:16 15:8 7:0
16-bit data
When EDM[1:0] in PSSI_CR are programmed to 11, the interface transfers 16 bits using the
D[15:0] pins. In this case, two PSSI_PDCK cycles are required to transfer a 32-bit word.
The least-significant half word (bits 15:0) correspond to the first half word transferred, and
the most-significant half-word (bits 31:16) corresponds to the second half word transferred.
Table 168 illustrates the positioning of the data in two 32-bit words.
Table 168. Positioning of captured data bytes in 32-bit words (16-bit width)
Byte address 31:16 15:0
0 Dn+1[15:0] Dn[15:0]
4 Dn+3[15:0] Dn+2[15:0]
PSSI_PDCK
PSSI_D[15:0]
PSSI_DE
MSv48846V2
If the PSSI_DE alternate output function is enabled (through DERDYCFG) in transmit mode
(OUTEN=1), the PSSI drives PSSI_DE on the same PSSI_PDCK edge that the one used to
drive the data (D[15:0]). If a new 8 or 16-bit data (as programmed in the EDM[1:0] control
bits in PSSI_CR) is available for transmission in the internal FIFO, this data is output on the
data outputs (D[15:0]) and the PSSI_DE output becomes active on the current PSSI_PDCK
edge. Otherwise (if the TX FIFO is empty), the D[15:0] outputs remains unchanged on the
next clock edge and the PSSI_DE output becomes inactive.
PSSI_PDCK
PSSI_D[15:0]
PSSI_DE
MSv48847V2
PSSI_PDCK
PSSI_D[15:0]
PSSI_DE
PSSI_RDY
MSv48848V2
If the PSSI_RDY alternate input function is enabled (through DERDYCFG) in transmit mode
(OUTEN=1), the PSSI samples the PSSI_RDY signal on the opposite PSSI_PDCK edge to
the one at which D[15:0] are driven. If the PSSI_RDY signal is inactive, the PSSI keeps the
same data (D[15:0]) and PSSI_DE signals that valid data are available during the next
PSSI_PDCK clock cycle. Otherwise, if PSSI_RDY signal is sampled as active, the next data
from the TX FIFO (if available) is output on the data outputs (D[15:0]). If no new data are
available in the TX FIFO, the PSSI keeps the data output values and outputs the PSSI_DE
signal as inactive (if enabled).
The receiving device uses the PSSI_RDY to control the data flow and avoid overrun errors
when the system (via the DMA) is unable to keep up with the data flow.
PSSI_PDCK
PSSI_D[15:0]
PSSI_DE
PSSI_RDY
MSv48849V2
PSSI_D[15:0]
PSSI_PDCK
PSSI Master transmitter
PSSI_DE_RDY
MSv48850V2
indicates
overrun in
IT_OVR IT_OVR receive mode OVR_RIS OVR_IE OVR_ISC NA
or underrun in
transmit mode
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DERDYCFG
DMAEN
OUTEN
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RDYPOL
ENABLE
DEPOL
CKPOL
Res. Res. Res. EDM[1:0] Res. Res. Res. Res. Res. Res. Res.
rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RTT1B
RTT4B
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OVR_RIS
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
PSSI_RIS gives the raw interrupt status. This register is read-only. When read, it returns the
status of the corresponding interrupt before masking with the PSSI_IER register value.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OVR_IE
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw
The PSSI_IER register is used to enable interrupts. When one of the PSSI_IER bits is set,
the corresponding interrupt is enabled. This register is accessible both in read and write
modes.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OVR_MIS
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OVR_ISC
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
The PSSI_ICR register is write-only. Writing a 1 into a bit of this register clears the
corresponding bit in the PSSI_RIS and PSSI_MIS registers. Writing a 0 has no effect.
Reading this register always gives zeros.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
BYTE3 BYTE2
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
BYTE1 BYTE0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
0x28
0x24
0x18
0x14
0x10
0x08
0x04
0x00
0x2C
0x0C
Offset
0x3EC
25.5.8
804/2301
Register
PSSI_SR
Reserved
PSSI_DR
PSSI_CR
Reserved
PSSI_RIS
PSSI_IER
PSSI_ICR
PSSI_MIS
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Res. Res. Res. Res. Res. OUTEN 31
0 1
Res. Res. Res. Res. Res. DMAEN 30
Res. Res. Res. Res. Res. Res. 29
Res. Res. Res. Res. Res. Res. 28
Res. Res. Res. Res. Res. Res. 27
BYTE3
Res. Res. Res. Res. Res. Res. 26
PSSI register map
BYTE2
0 0 0
RM0432 Rev 6
Res. Res. Res. Res. Res. Res. 17
Res. Res. Res. Res. Res. Res. 16
Res.
Res.
Res. Res. Res.am Res. Res. Res. 15
0
BYTE1
Table 170. PSSI register map and reset values
0 0
10
Res. Res. Res. Res. Res. Res. 9
BYTE0
Parallel synchronous slave interface (PSSI) applied to STM32L4P5xx and STM32LQ5xx only
0 0
0
0
0
0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res. Res. Res. Res. Res. Res. 0
RM0432 Comparator (COMP)
26 Comparator (COMP)
26.1 Introduction
The device embeds two ultra-low-power comparators COMP1, and COMP2
The comparators can be used for a variety of functions including:
• Wakeup from low-power mode triggered by an analog signal,
• Analog signal conditioning,
• Cycle-by-cycle current control loop when combined with a PWM output from a timer.
PC5 0
PB2 1
¼ VREFINT 000
½ VREFINT 001
¾ VREFINT 010
VREFINT 011
DAC Channel1 100
DAC Channel2 101
PB1 110
PC4 111
PB4 0
PB6 1
¼ VREFINT 000
½ VREFINT 001
¾ VREFINT 010
VREFINT 011
DAC Channel1 100
DAC Channel2 101
PB3 110
PB7 111
For this purpose, the comparator control and status registers can be write-protected (read-
only).
Once the programming is completed, the COMPx LOCK bit can be set to 1. This causes the
whole register to become read-only, including the COMPx LOCK bit.
The write protection can only be reset by a MCU reset.
COMPx_INP
COMPx_INP I/Os +
COMPx
COMPx_INM
COMPx_INMSEL -
COMPx_INM I/Os
.
Internal sources .
.
WINMODE
COMPx_INPSEL
COMPy_INP
+
COMPy_INP I/Os
COMPy
COMPy_INM
COMPy_INMSEL -
COMPy_INM I/Os
.
Internal sources .
.
MS35329V1
26.3.6 Hysteresis
The comparator includes a programmable hysteresis to avoid spurious output transitions in
case of noisy signals. The hysteresis can be disabled if it is not needed (for instance when
exiting from low-power mode) to be able to force the hysteresis value using external
components.
INP
INM
INM - Vhyst
COMP_OUT
MS19984V1
PWM
Current limit
Current
Blanking window
Comp out
Comp out (to TIM_BK …)
Blank
MS30964V1
Low-power sleep No effect. COMP interrupts cause the device to exit the Low-power sleep mode.
Stop 0
No effect on the comparators.
Stop 1 Comparator interrupts cause the device to exit the Stop mode.
Stop 2
Standby
The COMP registers are powered down and must be reinitialized after exiting
Standby or Shutdown mode.
Shutdown
VALUE in
COMP1 output through EXTI yes yes N/A
COMP1_CSR
VALUE in
COMP2 output through EXTI yes yes N/A
COMP2_CSR
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
SCAL BRG
LOCK VALUE Res. Res. Res. Res. Res. Res. Res. BLANKING HYST
EN EN
rs r rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
POLA INP
Res. Res. Res. Res. Res. Res. Res. INMSEL PWRMODE Res. EN
RITY SEL.
rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
SCAL BRG
LOCK VALUE Res. Res. Res. Res. Res. Res. Res. BLANKING HYST
EN EN
rs r rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
POLA WIN INP
Res. Res. Res. Res. Res. Res. INMSEL PWRMODE Res. EN
RITY MODE SEL.
rw rw rw rw rw rw
Offset Register
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
PWRMODE
POLARITY.
BLANKING
SCALEN
BRGEN.
INPSEL.
INMSEL
VALUE
LOCK
HYST
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
COMP1_CSR
EN
0x00
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
PWRMODE
POLARITY.
BLANKING
WINMODE
SCALEN.
BRGEN.
INMSEL
INPSEL
VALUE
HYST.
LOCK
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
COMP2_CSR
EN
0x04
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
27.1 Introduction
The device embeds two operational amplifiers with two inputs and one output each. The
three I/Os can be connected to the external pins, this enables any type of external
interconnections. The operational amplifier can be configured internally as a follower or as
an amplifier with a non-inverting gain ranging from 2 to 16.
The positive input can be connected to the internal DAC.
The output can be connected to the internal ADC.
STM32
GPIO
+
DAC_OUT
ADC
GPIO
MS35324V1
STM32
GPIO
+
DAC_OUT
ADC
GPIO
-
Always connected to
OPAMP output (can be
used during debug)
MS35325V1
Figure 189. PGA mode, internal gain setting (x2/x4/x8/x16), inverting input not used
STM32
GPIO
+
DAC_OUT
ADC
GPIO
-
Always connected to
OPAMP output (can be
used during debug)
MS35326V1
Figure 190. PGA mode, internal gain setting (x2/x4/x8/x16), inverting input used for
filtering
STM32
GPIO
+
DAC_OUT
ADC
GPIO
Allows optional
low-pass
filtering (1)
Equivalent to
MS35327V1
27.3.5 Calibration
At startup, the trimming values are initialized with the preset ‘factory’ trimming value.
Each operational amplifier offset can be trimmed by the user. Specific registers allow to
have different trimming values for normal mode and for low-power mode.
The aim of the calibration is to cancel as much as possible the OPAMP inputs offset voltage.
The calibration circuitry allows to reduce the inputs offset voltage to less than +/-1.5 mV
within stable voltage and temperature conditions.
For each operational amplifier and each mode two trimming values need to be trimmed, one
for N differential pair and one for P differential pair.
There are two registers for trimming the offsets for each operational amplifiers, one for
normal mode (OPAMP_OTR) and one low-power mode (OPAMP_LPOTR). Each register is
composed of five bits for P differential pair trimming and five bits for N differential pair
trimming. These are the ‘user’ values.
The user is able to switch from ‘factory’ values to ‘user’ trimmed values using the
USERTRIM bit in the OPAMP_CSR register. This bit is reset at startup and so the ‘factory’
value are applied by default to the OPAMP trimming registers.
User is liable to change the trimming values in calibration or in functional mode.
The offset trimming registers are typically configured after the calibration operation is
initialized by setting bit CALON to 1. When CALON = 1 the inputs of the operational
amplifier are disconnected from the functional environment.
• Setting CALSEL to 1 initializes the offset calibration for the P differential pair (low
voltage reference used).
• Resetting CALSEL to 0 initializes the offset calibration for the N differential pair (high
voltage reference used).
When CALON = 1, the bit CALOUT will reflect the influence of the trimming value selected
by CALSEL and OPALPM. When the value of CALOUT switches between two consecutive
trimming values, this means that those two values are the best trimming values. The
CALOUT flag needs up to 1 ms after the trimming value is changed to become steady (see
tOFFTRIMmax delay specification in the electrical characteristics section of the datasheet).
Note: The closer the trimming value is to the optimum trimming value, the longer it takes to
stabilize (with a maximum stabilization time remaining below 1 ms in any case).
Normal operating
1 0 0 X analog 0
mode
Low-power mode 1 1 0 X analog 0
Power down 0 X X X Z 0
Offset cal high for
1 0 1 0 analog X
normal mode
Offset cal low for
1 0 1 1 analog X
normal mode
Offset cal high for
1 1 1 0 analog X
low-power mode
Offset cal low for
1 1 1 1 analog X
low-power mode
Calibration procedure
Here are the steps to perform a full calibration of either one of the operational amplifiers:
1. Select correct OPA_RANGE in OPAMP_CSR, then set the OPAEN bit in OPAMP_CSR
to 1 to enable the operational amplifier.
2. Set the USERTRIM bit in the OPAMP_CSR register to 1.
3. Choose a calibration mode (refer to Table 179: Operating modes and calibration). The
steps 3 to 4 will have to be repeated 4 times. For the first iteration select
– Normal mode, offset cal high (N differential pair)
The above calibration mode correspond to OPALPM=0 and CALSEL=0 in the
OPAMP_CSR register.
4. Increment TRIMOFFSETN[4:0] in OPAMP_OTR starting from 00000b until CALOUT
changes to 1 in OPAMP_CSR.
Note: CALOUT will switch from 0 to 1 for offset cal high and from 1 to 0 for offset cal low.
Note: Between the write to the OPAMP_OTR register and the read of the CALOUT value, make
sure to wait for the tOFFTRIMmax delay specified in the electrical characteristics section of
the datasheet, to get the correct CALOUT value.
The commutation means that the offset is correctly compensated and that the
corresponding trim code must be saved in the OPAMP_OTR register.
Repeat steps 3 to 4 for:
– Normal_mode and offset cal low
– Low power mode and offset cal high
– Low power mode and offset cal low
If a mode is not used it is not necessary to perform the corresponding calibration.
All operational amplifier can be calibrated at the same time.
Note: During the whole calibration phase the external connection of the operational amplifier
output must not pull up or down currents higher than 500 µA.
During the calibration procedure, it is necessary to set up OPAMODE bits as 00 or 01 (PGA
disable) or 11 (internal follower).
Sleep No effect.
Low-power run No effect.
Low-power sleep No effect.
Stop 0 / Stop 1 No effect, OPAMP registers content is kept.
OPAMP registers content is kept. OPAMP must be disabled before entering
Stop 2
Stop 2 mode.
Standby The OPAMP registers are powered down and must be re-initialized after
Shutdown exiting Standby or Shutdown mode.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
OPA_
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
RANGE
rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CAL USER CAL VP_ OPA
CALON Res. VM_SEL Res. Res. PGA_GAIN OPAMODE OPAEN
OUT TRIM SEL SEL LPM
r rw rw rw rw rw rw rw rw rw w rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. TRIMOFFSETP[4:0] Res. Res. Res. TRIMOFFSETN[4:0]
rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. TRIMLPOFFSETP[4:0] Res. Res. Res. TRIMLPOFFSETN[4:0]
rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CALOU USERT CALSE VP_SE OPALP
CALON Res. VM_SEL Res. Res. PGA_GAIN OPAMODE OPAEN
T RIM L L M
r rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. TRIMOFFSETP[4:0] Res. Res. Res. TRIMOFFSETN[4:0]
rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. TRIMLPOFFSETP[4:0] Res. Res. Res. TRIMLPOFFSETN[4:0]
rw rw rw rw rw rw rw rw rw rw
Offset Register
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
OPA_RANGE
USERTRIM
PGA_GAIN
OPAMODE
OPALPM
CALOUT
VM_SEL
CALSEL
VP_SEL
CALON
OPAEN
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
OPAMP1_CSR
0x00
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0
TRIM TRIM
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
OPAMP1_OTR
0x04 OFFSETP[4:0] OFFSETN[4:0]
Res.
Res.
Res.
0x08 LPOTR OFFSETP[4:0] OFFSETN[4:0]
PGA_GAIN
OPAMODE
OPALPM
CALOUT
VM_SEL
CALSEL
VP_SEL
CALON
OPAEN
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
OPAMP2_CSR
0x10
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0
TRIM TRIM
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
OPAMP2_OTR
0x14 OFFSETP[4:0] OFFSETN[4:0]
Res.
Res.
Res.
28.1 Introduction
Digital filter for sigma delta modulators (DFSDM) is a high-performance module dedicated to
interface external Σ∆ modulators. It is featuring up to 8 external digital serial interfaces
(channels) and up to 4 digital filters with flexible Sigma Delta stream digital processing
options to offer up to 24-bit final ADC resolution. DFSDM also features optional parallel data
stream input from internal ADC peripherals or from device memory.
An external Σ∆ modulator provides digital data stream of converted analog values from the
external Σ∆ modulator analog input. This digital data stream is sent into a DFSDM input
channel through a serial interface. DFSDM supports several standards to connect various
Σ∆ modulator outputs: SPI interface and Manchester coded 1-wire interface (both with
adjustable parameters). DFSDM module supports the connection of up to 8 multiplexed
input digital serial channels which are shared with up to 4 DFSDM modules. DFSDM
module also supports alternative parallel data inputs from up to 8 internal 16-bit data
channels (from internal ADCs or from device memory).
DFSDM is converting an input data stream into a final digital data word which represents an
analog input value on a Σ∆ modulator analog input. The conversion is based on a
configurable digital process: the digital filtering and decimation of the input serial data
stream.
The conversion speed and resolution are adjustable according to configurable parameters
for digital processing: filter type, filter order, length of filter, integrator length. The maximum
output data resolution is up to 24 bits. There are two conversion modes: single conversion
mode and continuous mode. The data can be automatically stored in a system RAM buffer
through DMA, thus reducing the software overhead.
A flexible timer triggering system can be used to control the start of conversion of DFSDM.
This timing control is capable of triggering simultaneous conversions or inserting a
programmable delay between conversions.
DFSDM features an analog watchdog function. Analog watchdog can be assigned to any of
the input channel data stream or to final output data. Analog watchdog has its own digital
filtering of input data stream to reach the required speed and resolution of watched data.
To detect short-circuit in control applications, there is a short-circuit detector. This block
watches each input channel data stream for occurrence of stable data for a defined time
duration (several 0’s or 1’s in an input data stream).
An extremes detector block watches final output data and stores maximum and minimum
values from the output data values. The extremes values stored can be restarted by
software.
Two power modes are supported: normal mode and stop mode.
Number of channels 8
Number of filters 4
Input from internal ADC X
Supported trigger sources 32(1)
Pulses skipper X
ID registers support -
1. Refer to Table 186: DFSDM triggers connection for available trigger sources.
Number of channels 4
Number of filters 2
Input from internal ADC X
Supported trigger sources 32(1)
Pulses skipper X
ID registers support -
1. Refer to Table 186: DFSDM triggers connection for available trigger sources.
ADC 7
Sample 1 Sample 0 16
Parallel input data
register 0
Sample 1 Sample 0
16
Parallel input data
register 7
Channel multiplexer
EXTRG[1:0]
Data 0
Filter Oversampling Oversampling
Clock 0 order ratio ratio
CKOUT Clock Mode 16
control control Pulse
DATIN0 skipper Sincx filter 0 Integrator unit 0
Serial transceiver 0 Data 3 Filter Oversampling Oversampling
CKIN0
order ratio ratio
Clock Mode Clock 3
control control Pulse 16
DATIN7 skipper Sincx filter 3 Integrator unit 3
CKIN7 Serial transceiver 7
8 watchdog filters
8 watchdog comparators Right bit-shift
count
Config
Status
APB bus
1. This example shows 4 DFSDM filters and 8 input channels (max. configuration).
dfsdm_jtrg0 TIM1_TRGO
dfsdm_jtrg1 TIM1_TRGO2
dfsdm_jtrg2 TIM8_TRGO
dfsdm_jtrg3 TIM8_TRGO2
dfsdm_jtrg4 TIM3_TRGO
dfsdm_jtrg5 TIM4_TRGO
dfsdm_jtrg6 TIM16_OC1
dfsdm_jtrg7 TIM6_TRGO
dfsdm_jtrg8 TIM7_TRGO
dfsdm_jtrg[23:9] Reserved
dfsdm_jtrg24 EXTI11
dfsdm_jtrg25 EXTI15
dfsdm_jtrg26 LTIMER1
dfsdm_jtrg[31:27] Reserved
DFSDM clocks
The internal DFSDM clock fDFSDMCLK, which is used to drive the channel transceivers,
digital processing blocks (digital filter, integrator) and next additional blocks (analog
watchdog, short-circuit detector, extremes detector, control block) is generated by the RCC
block and is derived from the system clock SYSCLK or peripheral clock PCLK2 (see
Section 6.4.32: Peripherals independent clock configuration register (RCC_CCIPR2)). The
DFSDM clock is automatically stopped in stop mode (if DFEN = 0 for all DFSDM_FLTx,
x=0..3).
The DFSDM serial channel transceivers can receive an external serial clock to sample an
external serial data stream. The internal DFSDM clock must be at least 4 times faster than
the external serial clock if standard SPI coding is used, and 6 times faster than the external
serial clock if Manchester coding is used.
DFSDM can provide one external output clock signal to drive external Σ∆ modulator(s) clock
input(s). It is provided on CKOUT pin. This output clock signal must be in the range
specified in given device datasheet and is derived from DFSDM clock or from audio clock
(see CKOUTSRC bit in DFSDM_CH0CFGR1 register) by programmable divider in the
range 2 - 256 (CKOUTDIV in DFSDM_CH0CFGR1 register). Audio clock source is SAI1
clock selected by SAI1SEL[1:0] field in RCC configuration (see Section 6.4.32: Peripherals
independent clock configuration register (RCC_CCIPR2)).
CH(ymax)
Decode
DATIN(ymax)
CKIN(ymax)
. . .
. . .
. . .
FLT(xmax)
.
CHy .
Decode .
DATINy
CKINy FLT(x+1)
FLTx
CH(y-1) .
Decode .
DATIN(y-1)
.
CKIN(y-1)
FLT0
. . .
. . .
. . .
CH0
Decode
DATAIN0
CKIN0
(. . .)
CHINSEL
RCH
MSv41632V1
decoding. There are two possible settings of Manchester codings (see SITP[1:0] bits in
DFSDM_CHyCFGR1 register):
• signal rising edge = log 0; signal falling edge = log 1
• signal rising edge = log 1; signal falling edge = log 0
The recovered clock signal frequency for Manchester coding must be in the range
0 - 10 MHz and less than fDFSDMCLK/6.
To correctly receive Manchester coded data, the CKOUTDIV divider (in
DFSDM_CH0CFGR1 register) must be set with respect to expected Manchester data rate
according formula:
CKINy (SPICKSEL=0)
SPI timing : SPICKSEL = 0
twl twh tr tf
tsu th
SITP = 00
DATINy
tsu th
SITP = 01
SPICKSEL=3
CKOUT
SPICKSEL=2
SPI timing : SPICKSEL = 1, 2, 3
SPICKSEL=1
twl twh tr tf
tsu th
SITP = 0
DATINy
tsu th
SITP = 1
SITP = 2
DATINy
Manchester timing
SITP = 3
recovered clock
recovered data 0 0 1 1 0
MS30766V3
max. 8 periods
CKOUT 2 0 1 2 3 4 5 6 7 0
SPI clock presence
restart counting
CKINy
timing
error reported
MS30767V2
If Manchester data format is used, then the clock absence means that the clock recovery is
unable to perform from Manchester coded signal. For a correct clock recovery, it is first
necessary to receive data with 1 to 0 or 0 to 1 transition (see Figure 196 for Manchester
synchronization).
A clock absence flag is set (CKABF[y] = 1) and an interrupt can be invoked (if CKABIE=1) in
case of an input clock recovery error (see CKABF[7:0] in DFSDM_FLT0ISR register and
CKABEN in DFSDM_CHyCFGR1). After a clock absence flag clearing (by CLRCKABF in
DFSDM_FLT0ICR register), the clock absence flag is refreshed.
max. 2 periods
CKOUT 0 0 0 1 0
restart counting
SITP = 2
Manchester clock presence
DATINy
SITP = 3
recovered clock
recovered data 0 0 1 ? ?
CKABF[y]
error reported
MS30768V2
SPI coded stream is synchronized after first detection of clock input signal (valid
rising/falling edge).
Note: When the transceiver is not yet synchronized, the clock absence flag is set and cannot be
cleared by CLRCKABF[y] bit (in DFSDM_FLT0ICR register).
SITP = 2
DATINy
Manchester timing
SITP = 3
recovered clock
data from
modulator 0 0 1 1 0
CHEN
real start of first conversion
first conversion
start trigger first data bit toggle - end of Manchester synchronization
recovered data ? ? 1 1 0
CKABF[y]
MS30769V2
Note: When conversion is interrupted (e.g. by disabling/enabling the selected channel) the
interruption time is also counted in CNVCNT[27:0]. Therefore it is recommended to not
interrupt the conversion for correct conversion duration result.
Conversion times:
injected conversion or regular conversion with FAST = 0 (or first conversion if
FAST=1):
for Sincx filters (x=1..5):
t = CNVCNT/fDFSDMCLK = [FOSR * (IOSR-1 + FORD) + FORD] / fCKIN
for FastSinc filter:
t = CNVCNT/fDFSDMCLK = [FOSR * (IOSR-1 + 4) + 2] / fCKIN
regular conversion with FAST = 1 (except first conversion):
for Sincx and FastSinc filters:
t = CNVCNT/fDFSDMCLK = [FOSR * IOSR] / fCKIN
in case if FOSR = FOSR[9:0]+1 = 1 (filter bypassed, active only integrator):
t = IOSR / fCKIN (... but CNVCNT=0)
where:
• fCKIN is the channel input clock frequency (on given channel CKINy pin) or input data
rate (in case of parallel data input)
• FOSR is the filter oversampling ratio: FOSR = FOSR[9:0]+1 (see DFSDM_FLTxFCR
register)
• IOSR is the integrator oversampling ratio: IOSR = IOSR[7:0]+1 (see DFSDM_FLTxFCR
register)
• FORD is the filter order: FORD = FORD[2:0] (see DFSDM_FLTxFCR register)
Pulses skipper
Purpose of the pulses skipper is to implement delay line like behavior for given input
channel(s). Given number of samples from input serial data stream (serial stream only) can
be discarded before they enter into the filter. This data discarding is performed by skipping
given number of sampling input clock pulses (given serial data samples are then not
sampled by filter). The sampling clock is gated by pulses skipper function for given number
of clock pulses. When given clock pulses are skipped then the filtering continues for
following input data. With comparison to non skipped data stream this operation causes that
the final output sample (and next samples) from filter will be calculated from later input data.
This final sample then looks a bit in forward - because it is calculated from newer input
samples than the “non-skipped” sample. The final “skipped sample” is converted later
because the skipped input data samples must be replaced by followed input data samples.
The final data buffers behavior (skipped and non-skipped output data buffers comparison)
looks like the non-skipped data stream is a bit delayed - both data buffers will be phase
shifted.
Number of clock pulses to be skipped should be written into PLSSKP[5:0] field in
DFSDM_CHyDLYR register. Once PLSSKP[5:0] field is written the execution of pulses
skipping is started on given channel. PLSSKP[5:0] field can be read in order to check the
progress of pulses skipper. When PLSSKP[5:0]=0 means that pulses skipping has been
executed.
Up to 63 clock pulses can be skip with a single write operation into PLSSKP[5:0]. If more
pulses need to be skipped, then user has to write several times into the PLSSKP[5:0] field.
The application software should handle cumulative skipped clock number per each filter.
Each channel contains a 32-bit data input register DFSDM_CHyDATINR in which it can be
written a 16-bit data. Data are in 16-bit signed format. Those data can be used as input to
the digital filter which is accepting 16-bit parallel data.
If serial data input is selected (DATMPX[1:0] = 0), the DFSDM_CHyDATINR register is write
protected.
filter must perform two input samplings from channel y to empty DFSDM_CHyDATINR
register. This mode is used together with 32-bit CPU/DMA access to
DFSDM_CHyDATINR register to load two samples per write operation.
3. Dual mode (DATPACK[1:0]=2):
Two samples are written into DFSDM_CHyDATINR register. The data INDAT0[15:0] is
for channel y, the data in INDAT1[15:0] is for channel y+1. The data in INDAT1[15:0] is
automatically copied INDAT0[15:0] of the following (y+1) channel data register
DFSDM_CH[y+1]DATINR). The digital filters must perform two samplings - one from
channel y and one from channel (y+1) - in order to empty DFSDM_CHyDATINR
registers.
Dual mode setting (DATPACK[1:0]=2) is available only on even channel numbers (y =
0, 2, 4, 6). If odd channel (y = 1, 3, 5, 7) is set to Dual mode then both INDAT0[15:0]
and INDAT1[15:0] parts are write protected for this channel. If even channel is set to
Dual mode then the following odd channel must be set into Standard mode
(DATPACK[1:0]=0) for correct cooperation with even channels.
See Figure 197 for DFSDM_CHyDATINR registers data modes and assignments of data
samples to channels.
31 16 15 0 31 16 15 0 31 16 15 0
Unused Ch0 (sample 0) Ch0 (sample 1) Ch0 (sample 0) Ch1 (sample 0) Ch0 (sample 0) y=0
Unused Ch1 (sample 0) Ch1 (sample 1) Ch1 (sample 0) Unused Ch1 (sample 0) y=1
Unused Ch2 (sample 0) Ch2 (sample 1) Ch2 (sample 0) Ch3 (sample 0) Ch2 (sample 0) y=2
Unused Ch3 (sample 0) Ch3 (sample 1) Ch3 (sample 0) Unused Ch3 (sample 0) y=3
Unused Ch4 (sample 0) Ch4 (sample 1) Ch4 (sample 0) Ch5 (sample 0) Ch4 (sample 0) y=4
Unused Ch5 (sample 0) Ch5 (sample 1) Ch5 (sample 0) Unused Ch5 (sample 0) y=5
Unused Ch6 (sample 0) Ch6 (sample 1) Ch6 (sample 0) Ch7 (sample 0) Ch6 (sample 0) y=6
Unused Ch7 (sample 0) Ch7 (sample 1) Ch7 (sample 0) Unused Ch7 (sample 0) y=7
MS35354V3
The write into DFSDM_CHyDATINR register to load one or two samples must be performed
after the selected input channel (channel y) is enabled for data collection (starting
conversion for channel y). Otherwise written data are lost for next processing.
For example: for single conversion and interleaved mode, do not start writing pair of data
samples into DFSDM_CHyDATINR before the single conversion is started (any data
present in the DFSDM_CHyDATINR before starting a conversion is discarded).
Injected conversions can operate in scan mode (JSCAN=1) or single mode (JSCAN=0). In
scan mode, each of the selected channels is converted, one after another. The lowest
channel (channel 0, if selected) is converted first, followed immediately by the next higher
channel until all the channels selected by JCHG[7:0] have been converted. In single mode
(JSCAN=0), only one channel from the selected channels is converted, and the channel
selection is moved to the next channel. Writing to JCHG[7:0] if JSCAN=0 resets the channel
selection to the lowest selected channel.
Injected conversions can be launched by software or by a trigger. They are never
interrupted by regular conversions.
The regular channel is a selection of just one of the 8 channels. RCH[2:0] in the
DFSDM_FLTxCR1 register indicates the selected channel.
Regular conversions can be launched only by software (not by a trigger). A sequence of
continuous regular conversions is temporarily interrupted when an injected conversion is
requested.
Performing a conversion on a disabled channel (CHEN=0 in DFSDM_CHyCFGR1 register)
causes that the conversion will never end - because no input data is provided (with no clock
signal). In this case, it is necessary to enable a given channel (CHEN=1 in
DFSDM_CHyCFGR1 register) or to stop the conversion by DFEN=0 in DFSDM_FLTxCR1
register.
2
1 – z – FOSR – ( 2 ⋅ FOSR )
• FastSinc filter type: H ( z ) = ----------------------------
- ⋅ ( 1 + z )
1 – z–1
Gain (dB)
Table 188. Filter maximum output resolution (peak data values from filter output)
for some FOSR values
FOSR Sinc1 Sinc2 FastSinc Sinc3 Sinc4 Sinc5
For more information about Sinc filter type properties and usage, it is recommended to study
the theory about digital filters (more resources can be downloaded from internet).
Table 189. Integrator maximum output resolution (peak data values from integrator
output) for some IOSR values and FOSR = 256 and Sinc3 filter type (largest data)
IOSR Sinc1 Sinc2 FastSinc Sinc3 Sinc4 Sinc5
x +/- FOSR. x +/- FOSR2. x +/- 2.FOSR2. x +/- FOSR3. x +/- FOSR4. x +/- FOSR5. x
4 - - - +/- 67 108 864 - -
32 - - - +/- 536 870 912 - -
+/- 2 147 483
128 - - - - -
648
256 - - - +/- 232 - -
There are 2 options for comparing the threshold registers with the data values
• Option1: in this case, the input data are taken from final output data register
(AWFSEL=0). This option is characterized by:
– high input data resolution (up to 24-bits)
– slow response time - inappropriate for fast response applications like overcurrent
detection
– for the comparison the final data are taken after bit shifting and offset data
correction
– final data are available only after main regular or injected conversions are
performed
– can be used in case of parallel input data source (DATMPX[1:0] ≠ 0 in
DFSDM_CHyCFGR1 register)
• Option2: in this case, the input data are taken from any serial data receivers output
(AWFSEL=1). This option is characterized by:
– input serial data are processed by dedicated analog watchdog Sincx channel
filters with configurable oversampling ratio (1..32) and filter order (1..3) (see
AWFOSR[4:0] and AWFORD[1:0] bits setting in DFSDM_CHyAWSCDR register)
– lower resolution (up to 16-bit)
– fast response time - appropriate for applications which require a fast response like
overcurrent/overvoltage detection)
– data are available in continuous mode independently from main regular or injected
conversions activity
In case of input channels monitoring (AWFSEL=1), the data for comparison to threshold is
taken from channels selected by AWDCH[7:0] field (DFSDM_FLTxCR2 register). Each of
the selected channels filter result is compared to one threshold value pair (AWHT[23:0] /
AWLT[23:0]). In this case, only higher 16 bits (AWHT[23:8] / AWLT[23:8]) define the 16-bit
threshold compared with the analog watchdog filter output because data coming from the
analog watchdog filter is up to a 16-bit resolution. Bits AWHT[7:0] / AWLT[7:0] are not taken
into comparison in this case (AWFSEL=1).
Parameters of the analog watchdog filter configuration for each input channel are set in
DFSDM_CHyAWSCDR register (filter order AWFORD[1:0] and filter oversampling ratio
AWFOSR[4:0]).
Each input channel has its own comparator which compares the analog watchdog data
(from analog watchdog filter) with analog watchdog threshold values (AWHT/AWLT). When
several channels are selected (field AWDCH[7:0] field of DFSDM_FLTxCR2 register),
several comparison requests may be received simultaneously. In this case, the channel
request with the lowest number is managed first and then continuing to higher selected
channels. For each channel, the result can be recorded in a separate flag (fields
AWHTF[7:0], AWLTF[7:0] of DFSDM_FLTxAWSR register). Each channel request is
executed in 8 DFSDM clock cycles. So, the bandwidth from each channel is limited to 8
DFSDM clock cycles (if AWDCH[7:0] = 0xFF). Because the maximum input channel
sampling clock frequency is the DFSDM clock frequency divided by 4, the configuration
AWFOSR = 0 (analog watchdog filter is bypassed) cannot be used for analog watchdog
feature at this input clock speed. Therefore user must properly configure the number of
watched channels and analog watchdog filter parameters with respect to input sampling
clock speed and DFSDM frequency.
Analog watchdog filter data for given channel y is available for reading by firmware on field
WDATA[15:0] in DFSDM_CHyWDATR register. That analog watchdog filter data is
converted continuously (if CHEN=1 in DFSDM_CHyCFGR1 register) with the data rate
given by the analog watchdog filter setting and the channel input clock frequency.
The analog watchdog filter conversion works like a regular Fast Continuous Conversion
without the intergator. The number of serial samples needed for one result from analog
watchdog filter output (at channel input clock frequency fCKIN):
first conversion:
for Sincx filters (x=1..5): number of samples = [FOSR * FORD + FORD + 1]
for FastSinc filter: number of samples = [FOSR * 4 + 2 + 1]
next conversions:
for Sincx and FastSinc filters: number of samples = [FOSR * IOSR]
where:
FOSR ....... filter oversampling ratio: FOSR = AWFOSR[4:0]+1 (see DFSDM_CHyAWSCDR
register)
FORD ....... the filter order: FORD = AWFORD[1:0] (see DFSDM_CHyAWSCDR register)
In case of output data register monitoring (AWFSEL=0), the comparison is done after a right
bit shift and an offset correction of final data (see OFFSET[23:0] and DTRBS[4:0] fields in
DFSDM_CHyCFGR2 register). A comparison is performed after each injected or regular
end of conversion for the channels selected by AWDCH[7:0] field (in DFSDM_FLTxCR2
register).
The status of an analog watchdog event is signalized in DFSDM_FLTxAWSR register where
a given event is latched. AWHTF[y]=1 flag signalizes crossing AWHT[23:0] value on
channel y. AWLTF[y]=1 flag signalizes crossing AWLT[23:0] value on channel y. Latched
events in DFSDM_FLTxAWSR register are cleared by writing ‘1’ into the corresponding
clearing bit CLRAWHTF[y] or CLRAWLTF[y] in DFSDM_FLTxAWCFR register.
The global status of an analog watchdog is signalized by the AWDF flag bit in
DFSDM_FLTxISR register (it is used for the fast detection of an interrupt source). AWDF=1
signalizes that at least one watchdog occurred (AWHTF[y]=1 or AWLTF[y]=1 for at least one
channel). AWDF bit is cleared when all AWHTF[7:0] and AWLTF[7:0] are cleared.
An analog watchdog event can be assigned to break output signal. There are four break
outputs to be assigned to a high or low threshold crossing event (dfsdm_break[3:0]). The
break signal assignment to a given analog watchdog event is done by BKAWH[3:0] and
BKAWL[3:0] fields in DFSDM_FLTxAWHTR and DFSDM_FLTxAWLTR register.
circuit event is invoked. Each input channel has its short-circuit detector. Any channel can
be selected to be continuously monitored by setting the SCDEN bit (in DFSDM_CHyCFGR1
register) and it has its own short-circuit detector settings (threshold value in SCDT[7:0] bits,
status bit SCDF[7:0], status clearing bits CLRSCDF[7:0]). Status flag SCDF[y] is cleared
also by hardware when corresponding channel y is disabled (CHEN[y] = 0).
On each channel, a short-circuit detector event can be assigned to break output signal
dfsdm_break[3:0]. There are four break outputs to be assigned to a short-circuit detector
event. The break signal assignment to a given channel short-circuit detector event is done
by BKSCD[3:0] field in DFSDM_CHyAWSCDR register.
Short circuit detector cannot be used in case of parallel input data channel selection
(DATMPX[1:0] ≠ 0 in DFSDM_CHyCFGR1 register).
Four break outputs are totally available (shared with the analog watchdog function).
f CKIN
Datarate samples ⁄ s = -------------------------------------------------------------------------------- ...FAST = 0, FastSinc filter
F OSR ⋅ ( I OSR – 1 + 4 ) + ( 2 + 1 )
or
f CKIN
Datarate samples ⁄ s = ------------------------------- ...FAST = 1
F OSR ⋅ I OSR
f DATAIN_RATE
Datarate samples ⁄ s = ------------------------------------------------------------------------------------------------------- ...FAST = 0, Sincx filter
F OSR ⋅ ( I OSR – 1 + F ORD ) + ( F ORD + 1 )
or
f DATAIN_RATE
Datarate samples ⁄ s = -------------------------------------------------------------------------------- ...FAST = 0, FastSinc filter
F OSR ⋅ ( I OSR – 1 + 4 ) + ( 2 + 1 )
or
f DATAIN_RATE
Datarate samples ⁄ s = ------------------------------------ ...FAST=1 or any filter bypass case ( F OSR = 1 )
F OSR ⋅ I OSR
The right bit-shift of final data is performed in this module because the final data width is 24-
bit and data coming from the processing path can be up to 32 bits. This right bit-shift is
configurable in the range 0-31 bits for each selected input channel (see DTRBS[4:0] bits in
DFSDM_CHyCFGR2 register). The right bit-shift is rounding the result to nearest integer
value. The sign of shifted result is maintained - to have valid 24-bit signed format of result
data.
In the next step, an offset correction of the result is performed. The offset correction value
(OFFSET[23:0] stored in register DFSDM_CHyCFGR2) is subtracted from the output data
for a given channel. Data in the OFFSET[23:0] field is set by software by the appropriate
calibration routine.
Due to the fact that all operations in digital processing are performed on 32-bit signed
registers, the following conditions must be fulfilled not to overflow the result:
FOSR FORD . IOSR <= 231 ... for Sincx filters, x = 1..5)
2 . FOSR 2 . IOSR <= 231 ... for FastSinc filter)
Note: In case of filter and integrator bypass (IOSR[7:0]=0, FOSR[9:0]=0), the input data rate
(fDATAIN_RATE) must be limited to be able to read all output data:
fDATAIN_RATE ≤ fAPB
where fAPB is the bus frequency to which the DFSDM peripheral is connected.
Signed data format in registers: Data is in a signed format in registers for final output data,
analog watchdog, extremes detector, offset correction. The msb of output data word
represents the sign of value (two’s complement format).
The regular conversions executing in continuous mode can be stopped by writing ‘0’ to
RCONT. After clearing RCONT, the on-going conversion is stopped immediately.
In continuous mode, the data rate can be increased by setting the FAST bit in the
DFSDM_FLTxCR1 register. In this case, the filter does not need to be refilled by new fresh
data if converting continuously from one channel because data inside the filter is valid from
previously sampled continuous data. The speed increase depends on the chosen filter
order. The first conversion in fast mode (FAST=1) after starting a continuous conversion by
RSWSTART=1 takes still full time (as when FAST=0), then each subsequent conversion is
finished in shorter intervals.
Conversion time in continuous mode:
if FAST = 0 (or first conversion if FAST=1):
for Sincx filters:
t = CNVCNT/fDFSDMCLK = [FOSR * (IOSR-1 + FORD) + FORD] / fCKIN
for FastSinc filter:
t = CNVCNT/fDFSDMCLK = [FOSR * (IOSR-1 + 4) + 2] / fCKIN
if FAST = 1 (except first conversion):
for Sincx and FastSinc filters:
t = CNVCNT/fDFSDMCLK = [FOSR * IOSR] / fCKIN
in case FOSR = FOSR[9:0]+1 = 1 (filter bypassed, only integrator active):
t = IOSR / fCKIN (... but CNVCNT=0)
Continuous mode is not available for injected conversions. Injected conversions can be
started by timer trigger to emulate the continuous mode with precise timing.
If a regular continuous conversion is in progress (RCONT=1) and if a write access to
DFSDM_FLTxCR1 register requesting regular continuous conversion (RCONT=1) is
performed, then regular continuous conversion is restarted from the next conversion cycle
(like new regular continuous conversion is applied for new channel selection - even if there
is no change in DFSDM_FLTxCR1 register).
the sequence of injected conversions finishes, the continuous regular conversions start
again if RCONT is still set (and RPEND bit will signalize the delayed start on the first regular
conversion result).
Precedence also matters when actions are initiated by the same write to DFSDM, or if
multiple actions are pending at the end of another action. For example, suppose that, while
an injected conversion is in process (JCIP=1), a single write operation to DFSDM_FLTxCR1
writes ‘1’ to RSWSTART, requesting a regular conversion. When the injected sequence
finishes, the precedence dictates that the regular conversion is performed next and its
delayed start is signalized in RPEND bit.
– occurred when converted data (output data or data from analog watchdog filter -
according to AWFSEL bit setting in DFSDM_FLTxCR1 register) crosses
over/under high/low thresholds in DFSDM_FLTxAWHTR / DFSDM_FLTxAWLTR
registers
– enabled by AWDIE bit in DFSDM_FLTxCR2 register (on selected channels
AWDCH[7:0])
– indicated in AWDF bit in DFSDM_FLTxISR register
– separate indication of high or low analog watchdog threshold error by AWHTF[7:0]
and AWLTF[7:0] fields in DFSDM_FLTxAWSR register
– cleared by writing ‘1’ into corresponding CLRAWHTF[7:0] or CLRAWLTF[7:0] bits
in DFSDM_FLTxAWCFR register
• Short-circuit detector interrupt:
– occurred when the number of stable data crosses over thresholds in
DFSDM_CHyAWSCDR register
– enabled by SCDIE bit in DFSDM_FLTxCR2 register (on channel selected by
SCDEN bi tin DFSDM_CHyCFGR1 register)
– indicated in SCDF[7:0] bits in DFSDM_FLTxISR register (which also reports the
channel on which the short-circuit detector event occurred)
– cleared by writing ‘1’ into the corresponding CLRSCDF[7:0] bit in
DFSDM_FLTxICR register
• Channel clock absence interrupt:
– occurred when there is clock absence on CKINy pin (see Clock absence detection
in Section 28.4.4: Serial channel transceivers)
– enabled by CKABIE bit in DFSDM_FLTxCR2 register (on channels selected by
CKABEN bit in DFSDM_CHyCFGR1 register)
– indicated in CKABF[y] bit in DFSDM_FLTxISR register
– cleared by writing ‘1’ into CLRCKABF[y] bit in DFSDM_FLTxICR register
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DFSDM CKOUT
Res. Res. Res. Res. Res. Res. CKOUTDIV[7:0]
EN SRC
rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CHIN CKAB
DATPACK[1:0] DATMPX[1:0] Res. Res. Res. CHEN SCDEN Res. SPICKSEL[1:0] SITP[1:0]
SEL EN
rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
OFFSET[23:8]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. AWFORD[1:0] Res. AWFOSR[4:0]
rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw rw rw rw rw
2
1 – z – FOSR – ( 2 ⋅ FOSR )
FastSinc filter type transfer function: H ( z ) = ----------------------------
- ⋅ ( 1 + z )
1 – z–1
This bit can be modified only when CHEN=0 (in DFSDM_CHyCFGR1 register).
Bit 21 Reserved, must be kept at reset value.
Bits 20:16 AWFOSR[4:0]: Analog watchdog filter oversampling ratio (decimation rate) on channel y
0 - 31: Defines the length of the Sinc type filter in the range 1 - 32 (AWFOSR + 1). This number is
also the decimation ratio of the analog data rate.
This bit can be modified only when CHEN=0 (in DFSDM_CHyCFGR1 register).
Note: If AWFOSR = 0 then the filter has no effect (filter bypass).
Bits 15:12 BKSCD[3:0]: Break signal assignment for short-circuit detector on channel y
BKSCD[i] = 0: Break i signal not assigned to short-circuit detector on channel y
BKSCD[i] = 1: Break i signal assigned to short-circuit detector on channel y
Bits 11:8 Reserved, must be kept at reset value.
Bits 7:0 SCDT[7:0]: short-circuit detector threshold for channel y
These bits are written by software to define the threshold counter for the short-circuit detector. If this
value is reached, then a short-circuit detector event occurs on a given channel.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
WDATA[15:0]
r r r r r r r r r r r r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
INDAT1[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
INDAT0[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. PLSSKP[5:0]
rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
AWF RDMA RCON RSW
Res. FAST Res. Res. RCH[2:0] Res. Res. Res. RSYNC Res.
SEL EN T START
rw rw rw rw rw rw rw rw rt_w1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
JDMA JSW
Res. JEXTEN[1:0] JEXTSEL[4:0] Res. Res. JSCAN JSYNC Res. DFEN
EN START
rw rw rw rw rw rw rw rw rw rw rt_w1 rw
Bits 12:8 JEXTSEL[4:0]: Trigger signal selection for launching injected conversions
0x0-0x1F: Trigger inputs selected by the following table (internal or external trigger).
This bit can be modified only when DFEN=0 (DFSDM_FLTxCR1).
Note: synchronous trigger has latency up to one fDFSDMCLK clock cycle (with deterministic jitter),
asynchronous trigger has latency 2-3 fDFSDMCLK clock cycles (with jitter up to 1 cycle).
DFSDM_FLTx
0x00 dfsdm_jtrg0
0x01 dfsdm_jtrg1
...
0x1E dfsdm_jtrg30
0x1F dfsdm_jtrg31
Refer to Table 186: DFSDM triggers connection.
Bits 7:6 Reserved, must be kept at reset value.
Bit 5 JDMAEN: DMA channel enabled to read data for the injected channel group
0: The DMA channel is not enabled to read injected data
1: The DMA channel is enabled to read injected data
This bit can be modified only when DFEN=0 (DFSDM_FLTxCR1).
Bit 4 JSCAN: Scanning conversion mode for injected conversions
0: One channel conversion is performed from the injected channel group and next the selected
channel from this group is selected.
1: The series of conversions for the injected group channels is executed, starting over with the
lowest selected channel.
This bit can be modified only when DFEN=0 (DFSDM_FLTxCR1).
Writing JCHG if JSCAN=0 resets the channel selection to the lowest selected channel.
Bit 3 JSYNC: Launch an injected conversion synchronously with the DFSDM_FLT0 JSWSTART trigger
0: Do not launch an injected conversion synchronously with DFSDM_FLT0
1: Launch an injected conversion in this DFSDM_FLTx at the very moment when an injected
conversion is launched in DFSDM_FLT0 by its JSWSTART trigger
This bit can be modified only when DFEN=0 (DFSDM_FLTxCR1).
Bit 2 Reserved, must be kept at reset value.
Bit 1 JSWSTART: Start a conversion of the injected group of channels
0: Writing ‘0’ has no effect.
1: Writing ‘1’ makes a request to convert the channels in the injected conversion group, causing
JCIP to become ‘1’ at the same time. If JCIP=1 already, then writing to JSWSTART has no effect.
Writing ‘1’ has no effect if JSYNC=1.
This bit is always read as ‘0’.
Bit 0 DFEN: DFSDM_FLTx enable
0: DFSDM_FLTx is disabled. All conversions of given DFSDM_FLTx are stopped immediately and
all DFSDM_FLTx functions are stopped.
1: DFSDM_FLTx is enabled. If DFSDM_FLTx is enabled, then DFSDM_FLTx starts operating
according to its setting.
Data which are cleared by setting DFEN=0:
–register DFSDM_FLTxISR is set to the reset state
–register DFSDM_FLTxAWSR is set to the reset state
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CKAB ROVR JOVRI REOC JEOCI
EXCH[7:0] Res. SCDIE AWDIE
IE IE E IE E
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
SCDF[7:0] CKABF[7:0]
r r r r r r r r r r r r r r r r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. RCIP JCIP Res. Res. Res. Res. Res. Res. Res. Res. AWDF ROVRF JOVRF REOCF JEOCF
r r r r r r r
Note: For each of the flag bits, an interrupt can be enabled by setting the corresponding bit in
DFSDM_FLTxCR2. If an interrupt is called, the flag must be cleared before exiting the
interrupt service routine.
All the bits of DFSDM_FLTxISR are automatically reset when DFEN=0.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
CLRSCDF[7:0] CLRCKABF[7:0]
rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CLRR CLRJ
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
OVRF OVRF
rc_w1 rc_w1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw
2
1 – z –FOSR
FastSinc filter type transfer function: - ⋅ ( 1 + z –( 2 ⋅ FOSR ) )
H ( z ) = ----------------------------
1 – z –1
This bit can only be modified when DFEN=0 (DFSDM_FLTxCR1).
Bits 28:26 Reserved, must be kept at reset value.
Bits 25:16 FOSR[9:0]: Sinc filter oversampling ratio (decimation rate)
0 - 1023: Defines the length of the Sinc type filter in the range 1 - 1024 (FOSR = FOSR[9:0] +1). This
number is also the decimation ratio of the output data rate from filter.
This bit can only be modified when DFEN=0 (DFSDM_FLTxCR1)
Note: If FOSR = 0, then the filter has no effect (filter bypass).
Bits 15:8 Reserved, must be kept at reset value.
Bits 7:0 IOSR[7:0]: Integrator oversampling ratio (averaging length)
0- 255: The length of the Integrator in the range 1 - 256 (IOSR + 1). Defines how many samples
from Sinc filter will be summed into one output data sample from the integrator. The output data rate
from the integrator will be decreased by this number (additional data decimation ratio).
This bit can only be modified when DFEN=0 (DFSDM_FLTxCR1)
Note: If IOSR = 0, then the Integrator has no effect (Integrator bypass).
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
JDATA[23:8]
r r r r r r r r r r r r r r r r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
r r r r r r r r r r r
Note: DMA may be used to read the data from this register. Half-word accesses may be used to
read only the MSBs of conversion data.
Reading this register also clears JEOCF in DFSDM_FLTxISR. Thus, the firmware must not
read this register if DMA is activated to read data from this register.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
RDATA[23:8]
r r r r r r r r r r r r r r r r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
r r r r r r r r r r r r
Note: Half-word accesses may be used to read only the MSBs of conversion data.
Reading this register also clears REOCF in DFSDM_FLTxISR.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
AWHT[23:8]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
AWLT[23:8]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
AWHTF[7:0] AWLTF[7:0]
r r r r r r r r r r r r r r r r
Note: All the bits of DFSDM_FLTxAWSR are automatically reset when DFEN=0.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CLRAWHTF[7:0] CLRAWLTF[7:0]
rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
EXMAX[23:8]
rs_r rc_r rc_r rc_r rc_r rc_r rc_r rc_r rc_r rc_r rc_r rc_r rc_r rc_r rc_r rc_r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
EXMIN[23:8]
rc_r rs_r rs_r rs_r rs_r rs_r rs_r rs_r rs_r rs_r rs_r rs_r rs_r rs_r rs_r rs_r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
CNVCNT[27:12]
r r r r r r r r r r r r r r r r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
r r r r r r r r r r r r
Bits 31:4 CNVCNT[27:0]: 28-bit timer counting conversion time t = CNVCNT[27:0] / fDFSDMCLK
The timer has an input clock from DFSDM clock (system clock fDFSDMCLK). Conversion time
measurement is started on each conversion start and stopped when conversion finishes (interval
between first and last serial sample). Only in case of filter bypass (FOSR[9:0] = 0) is the conversion
time measurement stopped and CNVCNT[27:0] = 0. The counted time is:
if FAST=0 (or first conversion in continuous mode if FAST=1):
t = [FOSR * (IOSR-1 + FORD) + FORD] / fCKIN..... for Sincx filters
t = [FOSR * (IOSR-1 + 4) + 2] / fCKIN..... for FastSinc filter
if FAST=1 in continuous mode (except first conversion):
t = [FOSR * IOSR] / fCKIN
in case if FOSR = FOSR[9:0]+1 = 1 (filter bypassed, active only integrator):
CNVCNT = 0 (counting is stopped, conversion time: t = IOSR / fCKIN)
where: fCKIN is the channel input clock frequency (on given channel CKINy pin) or input data rate in
case of parallel data input (from internal ADC or from CPU/DMA write)
Note: When conversion is interrupted (e.g. by disable/enable selected channel) the timer counts also
this interruption time.
Bits 3:0 Reserved, must be kept at reset value.
10
11
9
8
7
6
5
4
3
2
1
0
name
DATPACK[1:0]
DATMPX[1:0]
CKOUTSRC
DFSDMEN
SPICKSEL
CHINSEL
SITP[1:0]
CKABEN
SCDEN
CHEN
DFSDM_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[1:0]
CKOUTDIV[7:0]
0x00 CH0CFGR1
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DFSDM_
Res.
Res.
Res.
OFFSET[23:0] DTRBS[4:0]
0x04 CH0CFGR2
reset value 0 0
AWFORD
DFSDM_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[1:0]
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DFSDM_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
WDATA[15:0]
0x0C CH0WDATR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DFSDM_
INDAT1[15:0] INDAT0[15:0]
0x10 CH0DATINR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DFSDM_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
PLSSKP[5:0]
0x14 CH0DLYR
reset value 0 0 0 0 0 0
0x18 -
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Reserved
0x1C
0x5C
0x4C
0x3C
0x2C
0x58 -
0x38 -
Offset
RM0432
name
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
Reserved
Reserved
CH2DLYR
CH1DLYR
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
Register
CH2CFGR2
CH2CFGR1
CH1CFGR2
CH1CFGR1
CH2WDATR
CH1WDATR
CH2DATINR
CH1DATINR
CH2AWSCDR
CH1AWSCDR
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 31
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 30
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 29
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 28
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 27
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 26
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 25
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 24
0
0
0
0
0
0
0
0
0
0
0
0
INDAT1[15:0]
INDAT1[15:0]
22
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 21
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
OFFSET[23:0]
OFFSET[23:0]
18
0
0
0
0
0
0
RM0432 Rev 6
17
AWFOSR[4:0]
AWFOSR[4:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
BKSCD[3:0]
BKSCD[3:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
WDATA[15:0]
WDATA[15:0]
INDAT0[15:0]
INDAT0[15:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
SCDT[7:0]
SCDT[7:0]
[1:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
PLSSKP[5:0]
PLSSKP[5:0]
0
0
0
0
0
0
0
0
0
0
881/2301
889
0x94
0x90
0x88
0x84
0x80
0x74
0x70
0x68
0x64
0x60
0x9C
0x8C
0x7C
0x6C
0x98 -
0x78 -
Offset
882/2301
name
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
Reserved
Reserved
CH4DLYR
CH3DLYR
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
Register
CH4CFGR2
CH4CFGR1
CH3CFGR2
CH3CFGR1
CH4WDATR
CH3WDATR
CH4DATINR
CH3DATINR
CH4AWSCDR
CH3AWSCDR
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 31
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 30
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 29
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 28
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 27
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 26
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 25
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 24
0
0
0
0
0
0
0
0
0
0
0
0
INDAT1[15:0]
INDAT1[15:0]
22
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 21
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
OFFSET[23:0]
OFFSET[23:0]
18
0
0
0
0
0
0
RM0432 Rev 6
17
AWFOSR[4:0]
AWFOSR[4:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
BKSCD[3:0]
BKSCD[3:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
WDATA[15:0]
WDATA[15:0]
INDAT0[15:0]
INDAT0[15:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
DTRBS[4:0]
DTRBS[4:0]
0
0
0
0
0
0
0
0
0
0
0
0
Res. Res. 3
SPICKSEL[1:0] SPICKSEL[1:0]
SCDT[7:0]
SCDT[7:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
PLSSKP[5:0]
PLSSKP[5:0]
0
0
0
0
0
0
0
0
0
0
0xD4
0xD0
0xC8
0xC4
0xC0
0xBC
0xAC
0xDC
0xCC
0xB8 -
0xD8 -
Offset
RM0432
name
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
Reserved
Reserved
CH6DLYR
CH5DLYR
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
Register
CH6CFGR2
CH6CFGR1
CH5CFGR2
CH5CFGR1
CH6WDATR
CH5WDATR
CH6DATINR
CH5DATINR
CH6AWSCDR
CH5AWSCDR
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 31
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 30
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 29
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 28
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 27
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 26
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 25
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 24
0
0
0
0
0
0
0
0
0
0
0
0
INDAT1[15:0]
INDAT1[15:0]
22
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 21
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
OFFSET[23:0]
OFFSET[23:0]
18
0
0
0
0
0
0
RM0432 Rev 6
17
AWFOSR[4:0]
AWFOSR[4:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
BKSCD[3:0]
BKSCD[3:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
WDATA[15:0]
WDATA[15:0]
INDAT0[15:0]
INDAT0[15:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
DTRBS[4:0]
DTRBS[4:0]
0
0
0
0
0
0
0
0
0
0
0
0
Res. Res. 3
SPICKSEL[1:0] SPICKSEL[1:0]
SCDT[7:0]
SCDT[7:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
PLSSKP[5:0]
PLSSKP[5:0]
0
0
0
0
0
0
0
0
0
0
883/2301
889
0xF4
0xF0
0xE8
0xE4
0xE0
0xFC
0xEC
0x114
0x110
0x108
0x104
0x100
0xF8 -
0x10C
Offset
884/2301
name
FLT0ISR
FLT0ICR
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
Reserved
FLT0CR2
FLT0CR1
FLT0FCR
CH7DLYR
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
Register
CH7CFGR2
CH7CFGR1
CH7WDATR
CH7DATINR
FLT0JCHGR
CH7AWSCDR
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. 31
0
0
0
0
0
0
FORD[2:0] Res. Res. AWFSEL Res. Res. Res. Res. Res. 30
0
0
0
0
0
0
Res. Res. FAST Res. Res. Res. Res. Res. 29
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. 28
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. 27
SCDF[7:0]
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. 26
CLRSCDF[7:0]
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. 25
0
0
0
0
0
0
RCH[2:0]
Res. Res. Res. Res. Res. Res. Res. 24
0
0
1
0
0
0
0
0
0
1
0
0
0
0
INDAT1[15:0]
22
0
0
1
0
0
0
0
0
0
1
0
0
0
0
FOSR[9:0]
0
0
1
0
0
0
0
0
CKABF[7:0]
0
0
1
0
0
0
0
0
AWDCH[7:0]
Res. RCONT Res. Res. Res. Res.
OFFSET[23:0]
18
CLRCKABF[7:0]
0
0
1
0
0
0
0
0
RM0432 Rev 6
17
AWFOSR[4:0]
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
EXCH[7:0]
0
0
0
0
0
0
0
0
JEXTSEL[4:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
INDAT0[15:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
IOSR[7:0]
JCHG[7:0]
SCDT[7:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
PLSSKP[5:0]
0
0
0
0
0
0
0
1
0
0
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
name
JDATACH [2:0]
DFSDM_
Res.
Res.
Res.
Res.
Res.
JDATA[23:0]
0x118 FLT0JDATAR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
RDATA
RPEND
DFSDM_
Res.
Res.
Res.
Res.
RDATA[23:0] CH[2:0]
0x11C FLT0RDATAR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DFSDM_
Res.
Res.
Res.
Res.
AWHT[23:0] BKAWH[3:0]
0x120 FLT0AWHTR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DFSDM_
Res.
Res.
Res.
Res.
AWLT[23:0] BKAWL[3:0]
0x124 FLT0AWLTR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DFSDM_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
AWHTF[7:0] AWLTF[7:0]
0x128 FLT0AWSR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DFSDM_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
CLRAWHTF[7:0] CLRAWLTF[7:0]
0x12C FLT0AWCFR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
EXMAXCH[2:0]
DFSDM_
Res.
Res.
Res.
Res.
Res.
EXMAX[23:0]
0x130 FLT0EXMAX
reset value 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
EXMINCH[2:0]
DFSDM_
Res.
Res.
Res.
Res.
Res.
FLT0EXMIN EXMIN[23:0]
0x134
reset value 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0
DFSDM_
Res.
Res.
Res.
FLT0CNVTIMR
CNVCNT[27:0] Res.
0x138
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x13C -
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
RSW START Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Reserved
0x17C
JEXTEN[1:0]
JSW START
RDMAEN
JDMAEN
AWFSEL
RCONT
RSYNC
JSCAN
JSYNC
DFEN
DFSDM_
FAST
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
RCH[2:0] JEXTSEL[4:0]
0x180 FLT1CR1
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ROVRIE
REOCIE
JEOCIE
JOVRIE
AWDIE
DFSDM_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
AWDCH[7:0] EXCH[7:0]
0x184 FLT1CR2
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ROVRF
REOCF
JOVRF
JEOCF
AWDF
DFSDM_
RCIP
JCIP
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
0x188 FLT1ISR
reset value 0 0 0 0 0 0 0
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
name
CLR ROVRF
CLR JOVRF
DFSDM_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
0x18C FLT1ICR
reset value 0 0
DFSDM_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
JCHG[7:0]
0x190 FLT1JCHGR
reset value 0 0 0 0 0 0 0 1
FORD[2:0]
DFSDM_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
FOSR[9:0] IOSR[7:0]
0x194 FLT1FCR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
JDATACH[2:0]
DFSDM_
Res.
Res.
Res.
Res.
Res.
JDATA[23:0]
0x198 FLT1JDATAR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
RDATA
RPEND
DFSDM_
Res.
Res.
Res.
Res.
RDATA[23:0] CH[2:0]
0x19C FLT1RDATAR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DFSDM_
Res.
Res.
Res.
Res.
AWHT[23:0] BKAWH[3:0]
0x1A0 FLT1AWHTR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DFSDM_
Res.
Res.
Res.
Res.
AWLT[23:0] BKAWL[3:0]
0x1A4 FLT1AWLTR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DFSDM_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
AWHTF[7:0] AWLTF[7:0]
0x1A8 FLT1AWSR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DFSDM_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
CLRAWHTF[7:0] CLRAWLTF[7:0]
0x1AC FLT1AWCFR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
EXMAXCH[2:0]
DFSDM_
Res.
Res.
Res.
Res.
Res.
EXMAX[23:0]
0x1B0 FLT1EXMAX
reset value 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
EXMINCH[2:0]
DFSDM_
Res.
Res.
Res.
Res.
Res.
FLT1EXMIN EXMIN[23:0]
0x1B4
reset value 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0
DFSDM_
Res.
Res.
Res.
Res.
CNVCNT[27:0]
0x1B8 FLT1CNVTIMR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x1BC -
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Reserved
0x1FC
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
name
RSW START
JEXTEN[1:0]
JSW START
RDMAEN
JDMAEN
AWFSEL
RCONT
RSYNC
JSCAN
JSYNC
DFEN
DFSDM_
FAST
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
RCH[2:0] JEXTSEL[4:0]
0x200 FLT2CR1
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ROVRIE
REOCIE
JOVRIE
JEOCIE
AWDIE
DFSDM_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
AWDCH[7:0] EXCH[7:0]
0x204 FLT2CR2
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ROVRF
REOCF
JOVRF
JEOCF
AWDF
DFSDM_
RCIP
JCIP
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
0x208 FLT2ISR
reset value 0 0 0 0 0 0 0
CLR ROVRF
CLR JOVRF
DFSDM_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
0x20C FLT2ICR
reset value 0 0
DFSDM_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
JCHG[7:0]
0x210 FLT2JCHGR
reset value 0 0 0 0 0 0 0 1
FORD[2:0]
DFSDM_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
FOSR[9:0] IOSR[7:0]
0x214 FLT2FCR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
JDATACH[2:0]
DFSDM_
Res.
Res.
Res.
Res.
Res.
JDATA[23:0]
0x218 FLT2JDATAR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
RDATA
RPEND
DFSDM_
Res.
Res.
Res.
Res.
RDATA[23:0] CH[2:0]
0x21C FLT2RDATAR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DFSDM_
Res.
Res.
Res.
Res.
AWHT[23:0] BKAWH[3:0]
0x220 FLT2AWHTR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DFSDM_
Res.
Res.
Res.
Res.
AWLT[23:0] BKAWL[3:0]
0x224 FLT2AWLTR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DFSDM_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
AWHTF[7:0] AWLTF[7:0]
0x228 FLT2AWSR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DFSDM_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
CLRAWHTF[7:0] CLRAWLTF[7:0]
0x22C FLT2AWCFR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x28C
0x27C
0x23C -
Offset
888/2301
name
FLT3ISR
FLT3ICR
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
Reserved
FLT3CR2
FLT3CR1
FLT3FCR
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
reset value
Register
FLT2EXMIN
FLT3JCHGR
FLT2EXMAX
FLT3JDATAR
FLT2CNVTIMR
0
0
0
0
1
Res. Res. Res. Res. Res. Res. 31
0
0
0
0
1
0
FORD[2:0] Res. Res. Res. Res. AWFSEL Res. 30
0
0
0
0
1
0
Res. Res. Res. Res. FAST Res. 29
0
0
1
Res. Res. Res. Res. Res. Res. Res. 0
28
0
0
1
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
0
RCH[2:0]
Res. Res. Res. Res. Res. 24
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
1
0
FOSR[9:0]
0
0
0
0
0
1
0
JDATA[23:0]
0
0
0
0
0
1
0
EXMIN[23:0]
AWDCH[7:0]
Res. Res. Res. RCONT Res.
EXMAX[23:0]
18
0
0
0
0
0
1
0
RM0432 Rev 6
17
0
0
0
0
1
0
0
0
0
1
0
0
0
1
0
0
0
0
Res. Res. Res. RCIP Res. 14
JEXTEN[1:0]
0
0
1
0
0
0
Res. Res. Res. JCIP 0 Res. 13
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. 7
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. 6
0
0
0
0
Res. Res. Res. Res. JDMAEN Res. Res. Res. 5
0
0
0
0
0
0
Res. Res. AWDF AWDIE JSCAN Res. Res. Res. 4
0
0
0
0
0
0
Res. CLR ROVRF ROVRF ROVRIE JSYNC Res. Res. Res. Res. 3
IOSR[7:0]
JCHG[7:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
JDATACH[2:0] Res. REOCF REOCIE JSW START Res. Res. EXMINCH[2:0] EXMAXCH[2:0] 1
0
0
0
0
0
0
1
0
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
name
RDATA
RPEND
DFSDM_
Res.
Res.
Res.
Res.
RDATA[23:0] CH[2:0]
0x29C FLT3RDATAR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DFSDM_
Res.
Res.
Res.
Res.
AWHT[23:0] BKAWH[3:0]
0x2A0 FLT3AWHTR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DFSDM_
Res.
Res.
Res.
Res.
AWLT[23:0] BKAWL[3:0]
0x2A4 FLT3AWLTR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DFSDM_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
AWHTF[7:0] AWLTF[7:0]
0x2A8 FLT3AWSR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DFSDM_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
CLRAWHTF[7:0] CLRAWLTF[7:0]
0x2AC FLT3AWCFR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
EXMAXCH[2:0]
DFSDM_
Res.
Res.
Res.
Res.
Res.
EXMAX[23:0]
0x2B0 FLT3EXMAX
reset value 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
EXMINCH[2:0]
DFSDM_
Res.
Res.
Res.
Res.
Res.
FLT3EXMIN EXMIN[23:0]
0x2B4
reset value 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0
DFSDM_
Res.
Res.
Res.
Res.
CNVCNT[27:0]
0x2B8 FLT3CNVTIMR
reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x2BC -
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Reserved
0x3FC
29.1 Introduction
The LCD-TFT (liquid crystal display - thin film transistor) display controller provides a
parallel digital RGB (red, green, blue) and signals for horizontal, vertical synchronization,
pixel clock and data enable as output to interface directly to a variety of LCD and TFT
panels.
Number of layers 2 1
Layer1
PFC LCD_HSYNC
FIFO
AHB Blending Dithering LCD_VSYNC
interface unit unit LCD_DE
Layer1 LCD-TFT
PFC LCD_CLK
FIFO panel
LCD_R[7:0]
LCD_G[7:0]
APB2 clock domain
Configuration LCD_B[7:0]
Timing
and status
generator
registers
Interrupts
MSv19675V1
The LTDC-TFT controller pins must be configured by the user application. The unused pins
can be used for other purposes.
For LTDC outputs up to 24 bits (RGB888), if less than 8 bpp are used to output for example
RGB565 or RGB666 to interface on 16- or 18-bit displays, the RGB display data lines must
be connected to the MSB of the LCD-TFT controller RGB data lines. As an example, in the
case of an LCD-TFT controller interfacing with a RGB565 16-bit display, the LCD display
R[4:0], G[5:0] and B[4:0] data lines pins must be connected to LCD-TFT controller
LCD_R[7:3], LCD_G[7:2] and LCD_B[7:3].
LTDC_LxCR
LTDC_LxCFBAR
HCLK
LTDC_LxCFBLR
LTDC_LxCFBLNR
LTDC_SRCR
LTDC_IER
PCLK2
LTDC_ISR
LTDC_ICR
LTDC_SSCR
LTDC_BPCR
LTDC_AWCR
LTDC_TWCR
LTDC_GCR
LTDC_BCCR
LTDC_LIPCR
LTDC_CPSR
LTDC_CDSR Pixel clock (LCD_CLK)
LTDC_LxWHPCR
LTDC_LxWVPCR
LTDC_LxCKCR
LTDC_LxPFCR
LTDC_LxCACR
LTDC_LxDCCR
LTDC_LxBFCR
LTDC_LxCLUTWR
Care must be taken while accessing the LTDC registers, the APB2 bus is stalled during:
• 6 PCKL2 periods + 5 LCD_CLK periods (five HCLK periods for register on AHB clock
domain) for register write access and update
• 7 PCKL2 periods + 5 LCD_CLK periods (five HCLK periods for register on AHB clock
domain) for register read access
For registers on PCLK2 clock domain, APB2 bus is stalled for six PCKL2 periods during the
register write accesses, and for seven PCKL2 periods during read accesses.
The LCD controller can be reset by setting the corresponding bit in the RCC_APB2RSTR
register. It resets the three clock domains.
horizontal and vertical synchronization timings panel signals, the pixel clock and the data
enable signals.
Total width
HBP HFP
HSYNC
width
Active width
VSYNC width
VBP
Data1, Line1
Total height
Data(n), Line(n)
VFP
MSv19674V1
Note: The HBP and HFP are respectively the horizontal back porch and front porch period.
The VBP and the VFP are respectively the vertical back porch and front porch period.
The LCD-TFT programmable synchronous timings are the following:
• HSYNC and VSYNC width: horizontal and vertical synchronization width, configured by
programming a value of HSYNC width - 1 and VSYNC width - 1 in the LTDC_SSCR
register
• HBP and VBP: horizontal and vertical synchronization back porch width, configured by
programming the accumulated value HSYNC width + HBP - 1 and the accumulated
value VSYNC width + VBP - 1 in the LTDC_BPCR register.
• Active width and active height: the active width and active height are configured by
programming the accumulated value HSYNC width + HBP + active width - 1 and the
accumulated value VSYNC width + VBP + active height - 1 in the LTDC_AWCR
register.
• Total width: the total width is configured by programming the accumulated value
HSYNC width + HBP + active width + HFP - 1 in the LTDC_TWCR register. The HFP is
the horizontal front porch period.
• Total height: the total height is configured by programming the accumulated value
VSYNC height + VBP + active height + VFP - 1 in the LTDC_TWCR register. The VFP
is the vertical front porch period.
Note: When the LTDC is enabled, the timings generated start with X/Y=0/0 position as the first
horizontal synchronization pixel in the vertical synchronization area and following the back
porch, active data display area and the front porch.
When the LTDC is disabled, the timing generator block is reset to X = total width - 1,
Y = total height - 1 and held the last pixel before the vertical synchronization phase and the
FIFO are flushed. Therefore only blanking data is output continuously.
Programmable polarity
The horizontal and vertical synchronization, data enable and pixel clock output signals
polarity can be programmed to active high or active low through the LTDC_GCR register.
Background color
A constant background color (RGB888) can programmed through the LTDC_BCCR register.
It is used for blending with the bottom layer.
Dithering
The dithering pseudo-random technique using an LFSR is used to add a small random
value (threshold) to each pixel color channel (R, G or B) value, thus rounding up the MSB in
some cases when displaying a 24-bit data on 18-bit display. Thus the dithering technique is
used to round data which is different from one frame to the other.
The dithering pseudo-random technique is the same as comparing LSBs against a
threshold value and adding a 1 to the MSB part only, if the LSB part is ≥ the threshold. The
LSBs are typically dropped once dithering was applied.
The width of the added pseudo-random value is two bits for each color channel: two bits for
red, two bits for green and two bits for blue.
Once the LCD-TFT controller is enabled, the LFSR starts running with the first active pixel
and it is kept running even during blanking periods and when dithering is switched off. If the
LTDC is disabled, the LFSR is reset.
The dithering can be switched on and off on the fly through the LTDC_GCR register.
Windowing
Every layer can be positioned and resized and it must be inside the active display area.
The window position and size are configured through the top-left and bottom-right X/Y
positions and the internal timing generator that includes the synchronous, back porch size
and the active data area. Refer to LTDC_LxWHPCR and LTDC_WVPCR registers.
The programmable layer position and size defines the first/last visible pixel of a line and the
first/last visible line in the window. It allows to display either the full image frame or only a
part of the image frame (see the figure below):
• The first and the last visible pixel in the layer are set by configuring the WHSTPOS[11:0]
and WHSPPOS[11:0] in the LTDC_LxWHPCR register.
• The first and the last visible lines in the layer are set by configuring the WVSTPOS[10:0]
and WVSPPOS[10:0] in the LTDC_LxWVPCR register.
WVSPPOS bits in
WHSTPOS bits in
LTDC_LxWVPCR
LTDC_LxWHPCR Window
WHSPPOS bits in
LTDC_LxWHPCR
MSv19676V3
ARGB4444
@+3 @+2 @+1 @
Ax+1[3:0]Rx+1[3:0] Gx+1[3:0] Bx+1[3:0] Ax[3:0] Rx[3:0] Gx[3:0] Bx[3:0]
@+7 @+6 @+5 @+4
Ax+3[3:0]Rx+3[3:0] Gx+3[3:0] Bx+3[3:0] Ax+2[3:0]Rx+2[3:0] Gx+2[3:0] Bx+2[3:0]
L8
@+3 @+2 @+1 @
Lx+3[7:0] Lx+2[7:0] Lx+1[7:0] Lx[7:0]
@+7 @+6 @+5 @+4
Lx+7[7:0] Lx+6[7:0] Lx+5[7:0] Lx+4[7:0]
AL44
@+3 @+2 @+1 @
Ax+3[3:0] Lx+3[3:0] Ax+2[3:0] Lx+2[3:0] Ax+1[3:0] Lx+1[3:0] Ax[3:0] Lx[3:0]
@+7 @+6 @+5 @+4
Ax+7[3:0] Lx+7[3:0] Ax+6[3:0] Lx+6[3:0] Ax+5[3:0] Lx+5[3:0] Ax+4[3:0] Lx+4[3:0]
AL88
@+3 @+2 @+1 @
Ax+1[7:0] Lx+1[7:0] Ax[7:0] Lx[7:0]
@+7 @+6 @+5 @+4
Ax+3[7:0] Lx+3[7:0] Ax+2[7:0] Lx+2[7:0]
Layer blending
The blending is always active and the two layers can be blended following the blending
factors configured through the LTDC_LxBFCR register.
The blending order is fixed and it is bottom up. If two layers are enabled, first the Layer1 is
blended with the Background color, then the layer2 is blended with the result of blended
color of layer1 and the background. Refer to the figure below.
Layer2
Layer1 Layer2 Layer2 +
BG Layer1 + BG Layer1 + BG
MSv48123V1
Default color
Every layer can have a default color in the format ARGB which is used outside the defined
layer window or when a layer is disabled.
The default color is configured through the LTDC_LxDCCR register.
The blending is always performed between the two layers even when a layer is disabled. To
avoid displaying the default color when a layer is disabled, keep the blending factors of this
layer in the LTDC_LxBFCR register to their reset value.
Color keying
A color key (RGB) can be configured to be representative for a transparent pixel.
If the color keying is enabled, the current pixels (after format conversion and before CLUT
respectively blending) are compared to the color key. If they match for the programmed
RGB value, all channels (ARGB) of that pixel are set to 0.
The color key value can be configured and used at run-time to replace the pixel RGB value.
The color keying is enabled through the LTDC_LxCKCR register.
The color keying is configured through the LTDC_LxCKCR register. The programmed value
depends on the pixel format as it is compared to current pixel after pixel format conversion
to ARGB888.
Example: if the a mid-yellow color (50 % red + 50 % green) is used as the transparent color
key:
• In RGB565, the mid-yellow color is 0x8400. Set the LTDC_LxCKCR to 0x848200.
• In ARGB8888, the mid-yellow color is 0x808000. Set LTDC_LxCKCR to 0x808000.
• In all CLUT-based color modes (L8, AL88, AL44), set one of the palette entry to the
mid-yellow color 0x808000 and set the LTDC_LxCKCR to 0x808000.
Line
LTDC global interrupt
Register reload
FIFO underrun
LTDC global error interrupt
Transfer error
MS19678V1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
HSPOL VSPOL DEPOL PCPOL Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. DEN
rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. DRW[2:0] Res. DGW[2:0] Res. DBW[2:0] Res. Res. Res. LTDCEN
r r r r r r r r r rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. VBR IMR
rw rw
Note: The shadow registers read back the active values. Until the reload has been done, the 'old'
value is read.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
BCGREEN[7:0] BCBLUE[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. RRIE TERRIE FUIE LIE
rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. RRIF TERRIF FUIF LIF
r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. CRRIF CTERRIF CFUIF CLIF
w w w w
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
CXPOS[15:0]
r r r r r r r r r r r r r r r r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CYPOS[15:0]
r r r r r r r r r r r r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. HSYNCS VSYNCS HDES VDES
r r r r
Note: The returned status does not depend on the configured polarity in the LTDC_GCR register,
instead it returns the current active display phase.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. CLUTEN Res. Res. COLKEN LEN
rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw rw rw rw rw
Example:
The LTDC_BPCR register is configured to 0x000E0005 (AHBP[11:0] is 0xE) and the
LTDC_AWCR register is configured to 0x028E01E5 (AAW[11:0] is 0x28E). To configure the
horizontal position of a window size of 630x460, with horizontal start offset of 5 pixels in the
active data area:
1. layer window first pixel, WHSTPOS[11:0], must be programmed to 0x14 (0xE+1+0x5)
2. layer window last pixel, WHSPPOS[11:0], must be programmed to 0x28A.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw rw rw rw
Example:
The LTDC_BPCR register is configured to 0x000E0005 (AVBP[10:0] is 0x5) and the
LTDC_AWCR register is configured to 0x028E01E5 (AAH[10:0] is 0x1E5).
To configure the vertical position of a window size of 630x460, with vertical start offset of 8
lines in the active data area:
1. layer window first line: WVSTPOS[10:0] must be programmed to 0xE (0x5 + 1 + 0x8).
2. layer window last line: WVSTPOS[10:0] must be programmed to 0x1DA.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CKGREEN[7:0] CKBLUE[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. PF[2:0]
rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DCALPHA[7:0] DCRED[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DCGREEN[7:0] DCBLUE[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. Res. Res. Res. BF1[2:0] Res. Res. Res. Res. Res. BF2[2:0]
rw rw rw rw rw rw
Note: The constant alpha value, is the programmed value in the LxCACR register divided by 255
by hardware.
Example: Only layer1 is enabled, BF1 configured to constant alpha. BF2 configured to
1 - constant alpha. The constant alpha programmed in the LxCACR register is 240 (0xF0).
Thus, the constant alpha value is 240/255 = 0.94. C: current layer color is 128.
Cs: background color is 48. Layer1 is blended with the background color.
BC = constant alpha x C + (1 - Constant Alpha) x Cs = 0.94 x 128 + (1- 0.94) x 48 = 123.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
CFBADD[31:16]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CFBADD[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw rw rw rw rw rw
Example:
• A frame buffer having the format RGB565 (2 bytes per pixel) and a width of 256 pixels
(total number of bytes per line is 256 * 2 = 512), where pitch = line length requires a
value of 0x02000203 to be written into this register.
• A frame buffer having the format RGB888 (3 bytes per pixel) and a width of 320 pixels
(total number of bytes per line is 320 * 3 = 960), where pitch = line length requires a
value of 0x03C003C3 to be written into this register.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
rw rw rw rw rw rw rw rw rw rw rw
Note: The number of lines and line length settings define how much data is fetched per frame for
every layer. If it is configured to less bytes than required, a FIFO underrun interrupt will be
generated if enabled.
The start address and pitch settings on the other hand define the correct start of every line in
memory.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
CLUTADD[7:0] RED[7:0]
w w w w w w w w w w w w w w w w
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
GREEN[7:0] BLUE[7:0]
w w w w w w w w w w w w w w w w
Note: The CLUT write register must be configured only during blanking period or if the layer is
disabled. The CLUT can be enabled or disabled in the LTDC_LxCR register.
The CLUT is only meaningful for L8, AL44 and AL88 pixel format.
0x0048
0x0044
0x0040
0x0038
0x0034
0x0024
0x0018
0x0014
0x0010
0x0008
0x003C
0x002C
0x000C
RM0432
29.8.26
LTDC_ISR
LTDC_IER
LTDC_ICR
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
LTDC_GCR
LTDC_BPCR
LTDC_SSCR
LTDC_CPSR
LTDC_CDSR
LTDC_BCCR
LTDC_SRCR
LTDC_LIPCR
LTDC_TWCR
LTDC_AWCR
Register name
0
0
Res. Res. Res. Res. Res. Res. Res. HSPOL Res. Res. Res. Res. 31
0
0
Res. Res. Res. Res. Res. Res. Res. VSPOL Res. Res. Res. Res. 30
0
0
Res. Res. Res. Res. Res. Res. Res. DEPOL Res. Res. Res. Res. 29
0
0
Res. Res. Res. Res. Res. Res. Res. PCPOL Res. Res. Res. Res. 28
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. 0 27
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. 26
LTDC register map
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
CXPOS[15:0]
Res. Res. Res. Res. Res. Res. Res. 22
0
0
0
0
0
0
AHBP[11:0]
0
0
0
0
0
0
TOTALW[11:0]
20
0
0
0
0
0
0
BCRED[7:0]
0
0
0
0
0
0
RM0432 Rev 6
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
The following table summarizes the LTDC registers.
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 15
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 14
0
0
1
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 13
0
0
0
DRW[2:0]
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 12
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 11
Table 197. LTDC register map and reset values
0
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. 10
BCGREEN[7:0]
0
0
1
0
0
0
0
0
Res. Res. Res. Res. Res. 9
0
0
0
0
0
0
0
0
Res. Res. Res. Res. Res.
DGW[2:0]
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. 7
0
0
0
0
0
0
0
0
Res. Res. Res. Res. Res.
CYPOS[15:0]
6
0
0
1
0
0
0
0
0
Res. Res. Res. Res. Res. 5
0
0
0
0
0
0
0
0
DBW[2:0]
4
AVBP[10:0]
LIPOS10:0]
TOTALH[10:0]
0
0
0
0
0
0
1
0
0
0
0
HSYNCS CRRIF RRIF RRIE Res. Res. 3
0
0
0
0
0
0
1
0
0
0
0
BCBLUE[7:0]
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
921/2301
LCD-TFT display controller (LTDC)
923
LCD-TFT display controller (LTDC) RM0432
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
COLKEN
CLUTEN
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
LEN
LTDC_L1CR
0x0084
Res.
Res.
Res.
Res.
LTDC_L1WHPCR WHSPPOS[11:0] WHSTPOS[11:0]
0x0088
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
LTDC_L1WVPCR WVSPPOS[10:0] WVSTPOS[10:0]
0x008C
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
LTDC_L1PFCR PF[2:0]
0x0094
Reset value 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
LTDC_L1CACR CONSTA[7:0]
0x0098
Reset value 1 1 1 1 1 1 1 1
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
LTDC_L1BFCR BF1[2:0] BF2[2:0]
0x00A0
Reset value 1 1 0 1 1 1
LTDC_L1CFBAR CFBADD[31:0]
0x00AC
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
LTDC_L1CFBLNR CFBLNBR[10:0]
0x00B4
Reset value 0 0 0 0 0 0 0 0 0 0 0
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
COLKEN
CLUTEN
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
LEN
LTDC_L2CR
0x0104
Reset value 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
LTDC_L2WVPCR WVSPPOS[10:0] WVSTPOS[10:0]
0x010C
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
LTDC_L2PFCR PF[2:0]
0x0114
Reset value 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
LTDC_L2CACR CONSTA[7:0]
0x0118
Reset value 1 1 1 1 1 1 1 1
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
LTDC_L2BFCR BF1[2:0] BF2[2:0]
0x0120
Reset value 1 1 0 1 1 1
LTDC_L2CFBAR CFBADD[31:0]
0x012C
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
LTDC_L2CFBLNR CFBLNBR[10:0]
0x0134
Reset value 0 0 0 0 0 0 0 0 0 0 0
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
30.1 Introduction
The Display Serial Interface (DSI) is part of a group of communication protocols defined by
the MIPI® Alliance. The MIPI® DSI Host Controller is a digital core that implements all
protocol functions defined in the MIPI® DSI Specification.
It provides an interface between the system and the MIPI® D-PHY, allowing the
communication with a DSI-compliant display.
DSI Host
LTDC
Ctrl FIFO DATAP1
LTDC
RGB
Interface LTDC DATAN1
Pixel FIFO DATAP0
D-PHY PPI
Packet DATAN0
APB to Interface D-PHY
Generic FIFO Handler
Generic Control CLKP
CLKN
Video Mode
Pattern
Generator
MS35899V1
standard procedure to estimate the minimum lane rate and the minimum number of lanes
that support a specific display device.
The basic assumptions for estimates are:
• clock lane frequency is 250 MHz, resulting in a bandwidth of 500 Mbps for each data
lane;
• the display should be capable of buffering the pixel data at the speed at which it is
delivered in the DSI link;
• no significant control traffic is present on the link when the pixel data is being
transmitted.
Regulator
PLL
MSv37300V1
D23 - - - - - R[7]
D22 - - - - - R[6]
The LTDC interface can be configured to increase flexibility and promote correct use of this
interface for several systems. The following configuration options are available:
• Polarity control: All the control signals are programmable to change the polarity
depending on the LTDC configuration.
• After the core reset, DSI Host waits for the first VSYNC active transition to start signal
sampling, including pixel data, thus avoiding starting the transmission of the image data
in the middle of a frame.
• If interface pixel color coding is 18 bits and the 18-bit loosely packed stream is
disabled, the number of pixels programmed in the VPSIZE field must be a multiple of
four. This means that in this mode, the two LSBs in the configuration are always
inferred as zero. The specification states that in this mode, the pixel line size should be
a multiple of four.
• To avoid FIFO underflows and overflows, the configured number of pixels is assumed
to be received from the LTDC at all times.
• To keep the memory organized with respect to the packet scheduling, the number of
pixels per packet parameter is used to separate the memory space of different video
packets.
For SHTDN and COLM sampling and transmission, the video streaming from the LTDC
must be active. This means that if the LTDC is not actively generating the video signals like
VSYNC and HSYNC, these signals are not transmitted through the DSI link. Because of
such constraints and for commands to be correctly transmitted, the first VSYNC active pulse
should occur for the command sampling and transmission. When shutting down the display,
it is necessary for the LTDC to be kept active for one frame after the command being issued.
This ensures that the commands are correctly transmitted before actually disabling the
video generation at the LTDC interface.
The SHTDN and COLM values can be programmed in the DSI Wrapper Control Register
(DSI_WCR).
For all of the data types, one entire pixel is received per each clock cycle. The number of
pixels of payload is restricted to a multiple of a value, as shown in Table 199.
Table 199. Multiplicity of the payload size in pixels for each data type
Value Data Types
16-bit
1 18-bit loosely packed
24-bit
2 Loosely packed pixel stream
4 18-bit non-loosely packed
Burst mode
In this mode, the entire active pixel line is buffered into a FIFO and transmitted in a single
packet with no interruptions. This transmission mode requires that the DPI Pixel FIFO has
the capacity to store a full line of active pixel data inside it. This mode is optimally used
when the difference between the pixel required bandwidth and DSI link bandwidth is
significant, it enables the DSI Host to quickly dispatch the entire active video line in a single
burst of data and then return to Low-power mode.
Non-Burst mode
In this mode, the processor uses the partitioning properties of the DSI Host to divide the
video line transmission into several DSI packets. This is done to match the pixel required
bandwidth with the DSI link bandwidth. With this mode, the controller configuration does not
require a full line of pixel data to be stored inside the LTDC interface pixel FIFO. It requires
only the content of one video packet.
Figure 206. Flow to update the LTDC interface configuration using shadow registers
Active Accepted
UR
MSv35855V1
Immediate update
When the shadow register feature is active, the auxiliary registers requires the LTDC
configuration before the video engine starts. This means that, after a reset, Update Register
(UR) bit is immediately granted.
In situations when it is required to immediately update the active registers without the reset
(as illustrated in Figure 207), ensure that the Enable (EN) and Update Register (UR) bits of
the DSI Host Video Shadow Control Register (DSI_VSCR) are set to 0.
UR=0 UR=1
MSv35856V2
UR=0 UR=1
MSv35857V2
genIF:
set_co
lumn_a
ddress
DCS: s
et_colu
mn_ad
genIF: dress
set_pa
ge_add
ress
DCS: s
et_pag
e_addre
LTDCIF ss
: vsync
= 1, dp
idataen
=1
DCS: w
rite_me
mory_s
tart
DCS: w
rite_me
mory_c
ontinue
1
DCS: w
rite_me
mory_c
ontinue
LTDCIF 2
: vsync DCS: w
= 0, dp rite_me
idataen mory_c
=0 ontinue
3
MSv35860V1
When the Command mode (CMDM) bit of the DSI Host mode Configuration Register
(DSI_CFGR) is set to 1, the LTDC interface assume the behavior corresponding to the
Adapted Command mode.
In this mode, the host processor can use the LTDC interface to transmit a continuous
stream of pixels to be written in the local frame buffer of the peripheral. It uses a pixel input
bus to receive the pixels and controls the flow automatically to limit the stream of continuous
pixels. When the first pixel is received, the current value of the Command Size (CMDSIZE)
field of the DSI Host LTDC Command Configuration Register (DSI_LCCR), is shadowed to
the internal interface function. The interface increments a counter on every valid pixel that is
input through the interface. When this pixel counter reaches Command Size (CMDSIZE), a
command is written into the command FIFO and the packet is ready to be transmitted
through the DSI link.
If the last pixel arrives before the counter reaches the value of shadowed Command Size
(CMDSIZE), a WMS command is issued to the command FIFO with Word Count (WC) set to
the amount of bytes that correspond to the value of the counter. If more than CMDSIZE
number of pixels are received (shadowed value), a WMS command is sent to the command
FIFO with WC set to the number of bytes that correspond to Command Size (CMDSIZE)
and the counter is restarted.
After the first WMS command has been written to the FIFO, the circuit behaves in a similar
way, but issues WMC commands instead of WMS commands. The process is repeated until
the last pixel of the image is received. The core automatically starts sending a new packet
when the last pixel of the image is received falls or Command Size (CMDSIZE) limit is
reached.
If the Tearing Effect Interrupt Enable (TEIE) bit of the DSI Wrapper Interrupt Enable Register
(DSI_WIER) is set, an interrupt is generated.
[31 …………………. 0]
8 bit 8 bit 8 bit 8 bit
Write_mem
pwdata(0) B0[7:0] G0[7:0] R0[7:0]
Command
Pixel
pwdata(1) R2[7:0] B1[7:0] G1[7:0] R1[7:0] 24 bpp
R0
[7:0]
pwdata(2) G3[7:0] R3[7:0] B2[7:0] G2[7:0]
G0
[7:0]
MSv35861V1
[31 ………………….0]
8 bit 8 bit 8 bit 8 bit
Write_mem
pwdata(0) B0[5:0] 2'd0 G0[5:0] 2'd0 R0[5:0] 2'd0
Command
Pixel
pwdata(1) R2[5:0] 2'd0 B1[5:0] 2'd0 G1[5:0] 2'd0 R1[5:0] 2'd0 18 bpp
R0
[5:0]
pwdata(2) G3[5:0] 2'd0 R3[5:0] 2'd0 B2[5:0] 2'd0 G2[5:0] 2'd0
G0
[5:0]
MSv35862V1
[31 …………………. 0]
8 bit 8 bit 8 bit 8 bit
Write_mem
pwdata(0) R1[4:0] G1[5:3] G0[2:0] B0[4:0] R0[4:0] G0[5:3]
Command Pixel
16 bpp
pwdata(1) R3[4:0] G3[5:3] G2[2:0] B2[4:0] R2[4:0] G2[5:3] G1[2:0] B1[4:0] R0
[4:0]
G0
pwdata(2) R5[4:0] G5[5:3] G4[2:0] B4[4:0] R4[4:0] G4[5:3] G3[2:0] B3[4:0] [5:0]
B0
[4:0]
pwdata(3) R7[4:0] G7[5:3] G6[2:0] B6[4:0] R6[4:0] G6[5:3] G5[2:0] B5[4:0]
MSv35863V1
[31 …………………. 0]
8 bit 8 bit 8 bit 8 bit
G1 B1 B0 R1 R0 G0 Write_mem
pwdata(0) [3:0] [3:0] [3:0] [3:0] [3:0] [3:0] Command Pixel
12 bpp
R4 G4 G3 B3 B2 R3 R2 G2
pwdata(1) [3:0] [3:0] [3:0] [3:0] [3:0] [3:0] [3:0] [3:0]
R0
[3:0]
B6 R7 R6 G6 G5 B5 B4 R5 G0
pwdata(2) [3:0] [3:0] [3:0] [3:0] [3:0] [3:0] [3:0] [3:0] [3:0]
B0
G9 B9 B8 R9 R8 G8 G7 B7 [3:0]
pwdata(3) [3:0] [3:0] [3:0] [3:0] [3:0] [3:0] [3:0] [3:0]
MSv35864V1
[31 …………………. 0]
8 bit 8 bit 8 bit 8 bit
Pixel
8 bpp
R2 G2 B2 R1 G1 B1 R0 G0 B0 Write_mem R0
pwdata(0) [2:0] [2:0] [1:0] [2:0] [2:0] [1:0] [2:0] [2:0] [1:0] Command [2:0]
G0
R6 G6 B6 R5 G5 B5 R4 G4 B4 R3 G3 B3
pwdata(1) [2:0] [2:0] [1:0] [2:0] [2:0] [1:0] [2:0] [2:0] [1:0] [2:0] [2:0] [1:0]
[2:0]
B0
R10 G10 B10 R9 G9 B9 R8 G8 B8 R7 G7 B7 [1:0]
pwdata(2) [2:0] [2:0] [1:0] [2:0] [2:0] [1:0] [2:0] [2:0] [1:0] [2:0] [2:0] [1:0]
MSv35865V1
Time units for these 16-bit counters are configured in cycles defined in the Timeout Clock
Division (TOCKDIV) field in the DSI Host Clock Control Register (DSI_CCR).
The value written to the Timeout Clock Division (TOCKDIV) field in the DSI Host Clock
Control Register (DSI_CCR) defines the time unit for the timeout limits using the Lane byte
clock as input.
This mechanism increases the range to define these limits.
If that counter reaches the value defined by the Low-Power Reception Timeout Counter
(LPRX_TOCNT) field of the DSI Host Timeout Counter Configuration Register 1
(DSI_TCCR0), the Timeout Low-Power Reception (TOLPRX) bit in the DSI Host Interrupt
and Status Register 1 (DSI_ISR1) is asserted and an internal soft reset is generated to the
DSI Host.
If the Timeout Low-Power Reception Interrupt Enable (TOLPRXIE) bit of the DSI Host
Interrupt Enable Register 1 (DSI_IER1) is set, an interrupt is generated. Once the software
gets notified by the interrupt, it must reset the D-PHY by de-asserting and asserting the
Digital Enable (DEN) bit of the DSI Host PHY Control Register (DSI_PCTLR).
The DSI Host ensures that, on sending an event that triggers a timeout, the D-PHY switches
to the Stop state and a counter starts running until it reaches the value of that timeout. The
link remains in the LP-11 state and unused until the timeout ends, even if there are other
events ready to be transmitted.
Figures 215 to 217 illustrate the flow of counting in the PRESP_TO counter for the three
categories listed in Table 201.
Host Device
BTA
pt
ror R
ck & Er
rigg er | A
Ack T
BTA
PRESP_TO
Timer < PRESP_TO
LP-11
Device Ready
Arbitra
ry even
t after B
TA
MSv35866V1
Host Device
READ
Reque
st
LP-11
Timer < PRESP_TO
PRESP_TO
Device Ready
BTA
pt
ror R
& Er
Ack
DR esp |
REA
BTA
MSv35867V1
Host Device
WRITE
Reque
st
LP-11
Timer < PRESP_TO
PRESP_TO
Arbitra Device Ready
ry even
t after W
RITE R
eq.
MSv35868V1
Table 202 describes the fields used for the configuration of the PRESP_TO counter.
After sending a
DSI_TCCR1 HSRD_TOCNT
High-Speed read operation
Period for which the DSI Host After sending a
DSI_TCCR2 LPRD_TOCNT
keeps the link still Low-Power read operation
After completing a
DSI_TCCR5 BTA_TOCNT
Bus-Turn-Around (BTA)
After sending a
DSI_TCCR3 HSWR_TOCNT
Period for which the DSI Host High-Speed write operation
keeps the link inactive After sending a
DSI_TCCR4 LPWR_TOCNT
Low-Power write operation
The values in these registers are measured in number of cycles of the Lane byte clock.
These registers are only used in Command mode because in Video mode, there is a rigid
timing schedule to be met to keep the display properly refreshed and it must not be broken
by these or any other timeouts. Setting a given timeout to 0 disables going into LP-11 state
and timeout for events of that category.
The read and the write requests in High-Speed mode are distinct from the read and the write
requests in Low-Power mode. For example, if HSRD_TOCNT is set to zero and
LPRD_TOCNT is set to a non-zero value, a generic read with no parameters does not
activate the PRESP_TO counter in High-Speed, but it activates the PRESP_TO in Low-
Power.
The DSI Host Timeout Counter Configuration Register 4 (DSI_TCCR3) includes a special
Presp mode (PM) bit to change the normal behavior of PRESP_TO in Adaptive Command
mode for High-Speed write operation timeout. When set to 1, this bit allows the PRESP_TO
from HSWR_TOCNT to be used only once, when both of the following conditions are met:
• the LTDC VSYNC signal rises and falls;
• the packets originated from the LTDC interface in Adapted Command mode are
transmitted and its FIFO is empty again.
In this scenario, non-Adapted Command mode requests are not sent to the D-PHY, even if
there is traffic from the Generic interface ready to be sent, returning them to the Stop state.
When it happens, the PRESP_TO counter is activated and only when it is completed, the
DSI Host sends any other traffic that is ready, as illustrated in Figure 218.
dpivsync_edpiwms
dpidataen
dpidata[29:0] A10 A20 A30
edpi_fifo_empty
gen_wr_en
gen_data[31:0] B3
link_state[1:0] LP HS LP HS LP
link_data[31:0]
PRESP_TO_active
MSv35880V1
VSS
VSA and
or BLLP
VBP lines
HSS
BLLP in
HSS+HBP RGB burst HFP VACT lines
mode
MSv35869V1
Commands are transmitted in the blanking periods after the following packets/states:
• Vertical Sync Start (VSS) packets, if the Video Sync pulses are not enabled
• Horizontal Sync End (HSE) packets, in the VSA, VBP, and VFP regions
• Horizontal Sync Start (HSS) packets, if the Video Sync pulses are not enabled in the
VSA, VBP, and VFP regions
• Horizontal Active (HACT) state
Besides the areas corresponding to BLLP, large commands can also be sent during the last
line of a frame. In that case, the line time for the Video mode is violated and the edpihalt
signal is set to request the DPI video timing signals to remain inactive. Only if a command
does not fit into any BLLP area, it is postponed to the last line, causing the violation of the
line time for the Video mode, as illustrated in Figure 220.
dpivsync
dpihsync
dpidataen
edpihalt
Only one command is transmitted per line, even in the case of the last line of a frame but
one command is possible for each line.
There can be only one command sent in Low-Power per line. However, one Low-Power
command is possible for each line. In High-Speed, the DSI Host can send more than one
command, as many as it determines to fit in the available time.
The DSI Host avoids sending commands in the last line because it is possible that the last
line is shorter than the other ones. For instance, the line time (tL) could be half a cycle longer
than the tL on the LTDC interface, that is, each line in the frame taking half a cycle from time
for the last line. This results in the last line being (½ cycle) x (number of lines -1) shorter
than tL.
The COLM and SHTDN bits of the DSI Wrapper Control Register (DSI_WCR) are also able
to trigger the sending of command packets. The commands are:
• Color mode ON
• Color mode OFF
• Shut Down Peripheral
• Turn On Peripheral
These commands are not sent in the VACT region. If the Low-Power Command Enable
(LPCE) bit of the DSI Host Video mode Configuration Register (DSI_VMCR) is set, these
commands are sent in Low-Power mode.
In Low-Power mode, the Largest Packet Size (LPSIZE) field of the DSI Host Low-power
mode Configuration Register (DSI_LPMCR) is used to determine if these commands can be
transmitted. It is assumed that Largest Packet Size (LPSIZE) is greater than or equal to four
bytes (number of bytes in a short packet), because the DSI Host does not transmit these
commands on the last line.
If the Frame Bus-Turn-Around Acknoledge Enable (FBTAAE) bit is set in the DSI Host Low-
power mode Configuration Register (DSI_LPMCR), a BTA is generated by DSI Host after
the last line of a frame. This may coincide with a write command or a read command. In
either case, the LTDC interface is halted until an acknowledge is received (control of the DSI
bus is returned to the host).
Calculating the time to transmit commands in LP mode in the VSA, VBP, and
VFP regions
The Largest Packet Size (LPSIZE) field of the DSI Host Low-Power mode Configuration
Register (DSI_LPMCR) indicates the time available (in bytes) to transmit a command in
Low-Power mode (based on the escape clock) on a line during the VSA, VBP, and the VFP
regions.
Calculation of Largest Packet Size (LPSIZE) depends on the used Video mode.
Figure 221 illustrates the timing intervals for the Video mode in Non-Burst with sync pulses,
while Figure 222 refers to Video mode in Burst and Non-Burst with sync events.
2 tESCCLK
EscExit
LPDT
HSS
HSE
MSv35870V1
command
EscEntry
2 tESCCLK
EscExit
LPDT
HSS
HSÆLP outvact_lpcmd_time LPÆHS
MSv35871V1
command
EscEntry
2 tESCCLK
EscExit
LPDT
HSS
HSE
HACT with
HSA HBP HSÆLP invact_lpcmd_time LPÆHS
Blanking Non-Burst
MSv35872V1
2 tESCCLK
EscExit
LPDT
HSS
HACT with
HSA HBP HSÆLP invact_lpcmd_time LPÆHS
Blanking Non-Burst
MSv35890V1
2 tESCCLK
EscExit
LPDT
HSS
MSv35873V1
where
• tL = line time;
• tHSA = time of the HSA pulse (DSI_VHSACR.HSA);
• tHBP = time of Horizontal back porch (DSI_VHBPCR.HBP);
• tHACT = time of Video active. For Burst mode, the Video active is time compressed and
is calculated as tHACT = VPSIZE * Bytes_per_Pixel /Number_Lanes * tLane_byte_clk;
• tESCCLK = escape clock period as programmed in TXECKDIV field of the DSI_CCR
register.
The VLPSIZE field can be compared directly with the size of the command to be transmitted
to determine if there is time to transmit the command.
Consider an example of a frame with 16.4 μs per line and assume an escape clock
frequency of 20 MHz and a Lane bit rate of 800 Mbits/s. In this case, it is possible to send
420 bits in escape mode (that is, 164 bits = 16.4 μs * 20 MHz / 2). Still, since it is the Vertical
Active region of the frame, take into consideration the HSA, HBP, and HACT timings apart
from the D-PHY protocol and PHY timings. The following assumptions are made:
• number of active lanes is 4;
• Lane byte clock period (lanebyteclkperiod) is 10 ns (800 Mbits per Lane);
• escape clock period is 50 ns (DSI_CCR.TXECKDIV = 5);
• D-PHY takes 180 ns to pass from Low-Power to High-Speed mode
(DSI_DLTCR.LP2HS_TIME = 18);
• D-PHY takes 200 ns to pass from High-Speed to Low-Power mode
(DSI_DLTCR.HS2LP_TIME = 20);
• tHSA = 420 ns;
• tHBP = 800 ns;
• tHACT = 12800 ns to send 1280 pixel at 24 bpp;
• video is transmitted in Non-Burst mode;
• DSI Host is configured for four lanes.
In this example, consider that you send video in Non-Burst mode. The VLPSIZE is
calculated as follows:
VLPSIZE = (16.4 µs -(420 ns + 800 ns + 12.8 µs + 180 ns +200 ns +
(22 × 50 ns + 2 × 50 ns)) / (2 × 8 × 50 ns) = 1 byte
Only one byte can be transmitted in this period. A short packet (for example, generic short
write) requires a minimum of four bytes. Therefore, in this example, commands are not sent
in the VACT region.
If Burst mode is enabled, more time is available to transmit the commands in the VACT
region, because HACT is time compressed.
VLPSIZE = (16.4 µs - (420 ns + 800 ns + (1280 × 3 / 4 × 10 ns) + 180 ns + 200 ns +
(22 × 50 ns + 2 × 50 ns) / (2 × 8 × 50 ns) = 5 bytes
For Burst mode, the VLPSIZE is 5 bytes and then a 4-byte short packet can be sent.
Figure 226 illustrates the meaning of VLPSIZE and LPSIZE, matching them with the shaded
areas and the VACT region.
VSS
VSA and
or BLLP
VBP lines
HSS
BLLP in
HSS+HBP RGB burst HFP VACT lines
mode
DSI_LPMCR.LPSIZE
DSI_LPMCR.VLPSIZE
MSv35874V1
The DSI Host decides the best approach to follow regarding power saving out of the three
possible scenarios:
• there is no enough time to go to the Low-Power mode. Therefore, blanking period is
added as shown in Figure 227;
• there is enough time for the data lanes to go to the Low-Power mode but not enough
time for the clock lane to enter the Low-Power mode, see Figure 228.
• there is enough time for both data lanes and clock lane to go to the Low-Power mode,
as in Figure 229.
It is also possible to address the multiple displays with only the Generic interface using
different Virtual Channels. Because the Generic interface is not restricted to any particular
Virtual Channel through configuration, it is possible to issue the packets with different Virtual
Channels. This enables the interface to time multiplex the packets to be provided to the
displays with different Virtual Channels.
You can use the following configuration registers to select the Virtual Channel ID associated
with transmissions over the LTDC and APB slave generic interfaces:
• DSI_LVCID.VCID field configures the Virtual Channel ID that is indexed to the Video
mode packets using the LTDC interface.
• DSI_GHCR register configures the Packet Header (which includes the Virtual Channel
ID to be used) for transmissions using APB slave generic interface.
• DSI_GVIDR.VCID field configures the Virtual Channel ID of the read responses to
store and return to the Generic interface.
Vertical pattern
The width of each color bar is determined by the division of horizontal resolution (pixels) for
eight test pattern colors. If the horizontal resolution is not divisible by eight, the last color
(black) is extended to fill the resolution.
In the example in Figure 234, the horizontal resolution is 103.
Horizontal pattern
The width of each color bar is determined by the division of the number of vertical resolution
(lines) for eight test pattern colors. If the vertical resolution is not divisible by eight, the last
color (black) will be extended to fill the resolution, as shown in Figure 235.
Timing definition
The MIPI® D-PHY manages all the communication timing with dedicated timers. As all the
timings are specified in nanoseconds (ns), it’s mandatory to configure the Unit Interval Field
to ensure the good duration of all the timings.
Unit Interval is configure through the DSI_WPCR0.UIX4 field. This value defines the bit
period in High-Speed mode in unit of 0.25ns. If this period is not a multiple of 0.25 ns, the
value driven should be rounded down.
As an example, for a 300 Mbit/s link, the unit interval is 3.33 ns, so UIX4 shall be 13.33. In
this case a value of 13 (0x0D) should be written.
The default values for all this parameters is 2’h00. All this values can be programmed only
when the DSI is stopped (DSI_WCR.DSIEN = 0 and CR.EN = 0).
All this values can be programmed only when the DSI is stopped (CR.DSIEN = 0 and
CR.EN = 0).
Pull-down on lanes
The D-PHY embedded pull-down on each lane to prevent from floating states when the
lanes are unused.
When set, the PDEN bit of the DSI_WPCR0 register enables the pull-down on the lanes.
7
NDIV<6:0>
MSv35895V1
The PLL output frequency is configured through the DSI_WRPCR register fields. The VCO
frequency and the PLL output frequency are calculated as follows:
FVCO = (CLKIN / IDF) * 2 * NDIV,
PHI = FVCO / (2 *ODF)
where:
• CLKIN is in the range of 4 to 100 MHz;
• DSI_WRPCR.NDIV is in the range of 10 to 125;
• DSI_WRPCR.IDF is in the range of 1 to 7;
• INFIN is in the range of 4 to 25 MHz;
• FVCO is in the range of 500 MHz to 1 GHz;
• DSI_WRPCR.ODF can be 1, 2, 4 or 8;
• PHI is in the range of 31.25 to 500 MHz.
The PLL is enabled setting the PLLEN bit in the DSI_WRPCR register.
Once the PLL is locked, the PLLLIF bit is set in the DSI_WISR. If the PLLLIE bit is set in the
DSI_WIER, an interrupt is generated.
The PLL status (lock or unlock) can be monitored with the PLLLS flag in the DSI_WISR
register.
If the PLL gets unlocked, the PLLUIF bit of the DSI_WISR is set. If the PLLUIE bit of the
DSI_WIER register is set, an interrupt is generated.
The DSI PLL setting can be changed only when the PLL is disabled.
The light yellow boxes in Figure 237 illustrate the location of some of the errors.
DPI_PAYLOAD_WR_ERR
Packet Handler
LTDC
ctrl FIFO
LTDC
LTDC Video Mode FSM
Interface
LTDC
pixel FIFO
GEN_PAYLOAD_SEND_ERR
GEN_PAYLOAD_RECV_ERR
GEN_COMMAND_WR_ERR
GEN Comm
FIFOs
GEN Pld
RCV FIFOs
GEN_PAYLOAD_WR_ERR
ECC_SINGLE_ERR
Packet Analyzer
GEN Pld ECC_MULTI_ERR
GEN_PAYLOAD_RD_ERR
Send FIFOs
VC ECC/CRC CRC_ERR
GEN Pld Router Analysis
RCV FIFOs PKT_SIZE_ERR
EOTP_ERR
ACK_WITH_ERR
MSv35896V2
Table 209 explains the reasons that set off these interrupts and also explains how to recover
from these interrupts.
The D-PHY reports the LP1 Recover the D-PHY from contention.
contention error. Reset the DSI Host and transmit the
0 20 PE4 The D-PHY host detects the packets again. If this error is recurrent,
contention while trying to drive carefully analyze the connectivity between
the line high. the Host and the Device.
D-PHY reports the LP0 Recover the D-PHY from contention.
contention error. Reset the DSI Host and transmit the
0 19 PE3 The D-PHY Host detects the packets again. If this error is recurrent,
contention while trying to drive carefully analyze the connectivity between
the line low. the Host and the Device.