RM0438
RM0438
Reference manual
STM32L552xx and STM32L562xx advanced Arm®-based
32-bit MCUs
Introduction
This reference manual targets application developers. It provides complete information on
how to use the STM32L552xx and STM32L562xx microcontrollers memory and peripherals.
STM32L552xx and STM32L562xx belong to the STM32L5x2 line of microcontrollers with
different memory sizes, packages and peripherals.
For ordering information, mechanical and electrical device characteristics please refer to the
corresponding datasheets.
For information on the Arm® Cortex®-M33 core, refer to the Cortex®-M33 Technical
Reference manual.
Related documents
• Cortex®-M33 Technical Reference Manual available at http://infocenter.arm.com
• STM32L552xx and STM32L562xx datasheets
Contents
1 Documentation conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
1.1 General information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
1.2 List of abbreviations for registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
1.3 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
1.4 Availability of peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
3 Boot configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
21.4.23 End of conversion, end of sampling phase (EOC, JEOC, EOSMP) . . 719
21.4.24 End of conversion sequence (EOS, JEOS) . . . . . . . . . . . . . . . . . . . . . 719
21.4.25 Timing diagrams example (single/continuous modes,
hardware/software triggers) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 720
21.4.26 Data management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722
21.4.27 Managing conversions using the DFSDM . . . . . . . . . . . . . . . . . . . . . . 727
21.4.28 Dynamic low-power features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728
21.4.29 Analog window watchdog (AWD1EN, JAWD1EN, AWD1SGL,
AWD1CH, AWD2CH, AWD3CH, AWD_HTx, AWD_LTx, AWDx) . . . . . 733
21.4.30 Oversampler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737
21.4.31 Dual ADC modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 743
21.4.32 Temperature sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 756
21.4.33 VBAT supply monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 758
21.4.34 Monitoring the internal voltage reference . . . . . . . . . . . . . . . . . . . . . . 759
21.5 ADC interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 760
21.6 ADC registers (for each ADC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 762
21.6.1 ADC interrupt and status register (ADC_ISR) . . . . . . . . . . . . . . . . . . . 762
21.6.2 ADC interrupt enable register (ADC_IER) . . . . . . . . . . . . . . . . . . . . . . 764
21.6.3 ADC control register (ADC_CR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 766
21.6.4 ADC configuration register (ADC_CFGR) . . . . . . . . . . . . . . . . . . . . . . 769
21.6.5 ADC configuration register 2 (ADC_CFGR2) . . . . . . . . . . . . . . . . . . . 773
21.6.6 ADC sample time register 1 (ADC_SMPR1) . . . . . . . . . . . . . . . . . . . . 775
21.6.7 ADC sample time register 2 (ADC_SMPR2) . . . . . . . . . . . . . . . . . . . . 776
21.6.8 ADC watchdog threshold register 1 (ADC_TR1) . . . . . . . . . . . . . . . . . 777
21.6.9 ADC watchdog threshold register 2 (ADC_TR2) . . . . . . . . . . . . . . . . . 777
21.6.10 ADC watchdog threshold register 3 (ADC_TR3) . . . . . . . . . . . . . . . . . 778
21.6.11 ADC regular sequence register 1 (ADC_SQR1) . . . . . . . . . . . . . . . . . 779
21.6.12 ADC regular sequence register 2 (ADC_SQR2) . . . . . . . . . . . . . . . . . 780
21.6.13 ADC regular sequence register 3 (ADC_SQR3) . . . . . . . . . . . . . . . . . 781
21.6.14 ADC regular sequence register 4 (ADC_SQR4) . . . . . . . . . . . . . . . . . 782
21.6.15 ADC regular data register (ADC_DR) . . . . . . . . . . . . . . . . . . . . . . . . . 782
21.6.16 ADC injected sequence register (ADC_JSQR) . . . . . . . . . . . . . . . . . . 783
21.6.17 ADC offset y register (ADC_OFRy) . . . . . . . . . . . . . . . . . . . . . . . . . . . 785
21.6.18 ADC injected channel y data register (ADC_JDRy) . . . . . . . . . . . . . . . 786
21.6.19 ADC analog watchdog 2 configuration register (ADC_AWD2CR) . . . . 786
21.6.20 ADC analog watchdog 3 configuration register (ADC_AWD3CR) . . . . 787
21.6.21 ADC differential mode selection register (ADC_DIFSEL) . . . . . . . . . . 787
List of tables
Table 1. Example of memory map security attribution versus SAU regions configuration . . . . . . . . 82
Table 2. Securable peripherals by TZSC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Table 3. TrustZone-aware peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Table 4. STM32L552xx and STM32L562xx memory map and peripheral register boundary
addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Table 5. SRAM2 organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Table 6. Boot modes when TrustZone is disabled (TZEN=0). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Table 7. Boot modes when TrustZone is enabled (TZEN=1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Table 8. Boot space versus RDP protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Table 9. Configuring security attributes with IDAU and SAU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Table 10. MPCWMx instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Table 11. MPCBBx instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Table 12. DMA channel usage (security) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Table 13. DMA channel usage (privilege) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Table 14. Secure Alternate function between peripherals and allocated I/Os . . . . . . . . . . . . . . . . . 116
Table 15. Summary of the I/Os that cannot be connected to a non-secure peripheral when secure 116
Table 16. Summary of the I/Os that can be secured and connected to a non-secure peripheral. . . 117
Table 17. Internal tampers in TAMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Table 18. Effect of low-power modes on TAMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Table 19. Accelerated cryptographic operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Table 20. Main product lifecycle transitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Table 21. Typical product lifecycle phases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Table 22. Debug protection with RDP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Table 23. Software intellectual property protection with RDP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Table 24. MPCWMx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Table 25. MPCBBx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Table 26. GTZC_TZSC register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Table 27. GTZC_MPCBB1 register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Table 28. GTZC_MPCBB2 register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Table 29. GTZC_TZIC register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Table 30. Flash module - 512 KB dual bank organization (64 bits read width). . . . . . . . . . . . . . . . . 179
Table 31. Flash module - 512 KB single bank organization (128 bits read width) . . . . . . . . . . . . . . 179
Table 32. Number of wait states according to CPU clock (HCLK) frequency . . . . . . . . . . . . . . . . . . 181
Table 33. User option byte organization mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
Table 34. Default secure option bytes after TZEN activation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Table 35. Secure watermark-based area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Table 36. Secure, HDP protections summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Table 37. Flash security state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Table 38. User accesses via bootloader or JTAG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Table 39. Non-secure peripherals, IRQn and IOs for bootloader execution . . . . . . . . . . . . . . . . . . . 202
Table 40. WRP protection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
Table 41. Flash memory readout protection status (TZEN=0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
Table 42. Access status versus protection level and execution modes when TZEN=0 . . . . . . . . . . 207
Table 43. Flash memory readout protection status (TZEN=1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Table 44. Access status versus protection level and execution modes when TZEN=1 . . . . . . . . . . 209
Table 45. Flash access versus RDP level when TrustZone is active (TZEN=1) . . . . . . . . . . . . . . . 212
Table 46. Flash access versus RDP level when TrustZone is disabled (TZEN=0) . . . . . . . . . . . . . 212
Table 47. Flash mass erase versus RDP level when TrustZone is active (TZEN = 1) . . . . . . . . . . . 213
Table 48. Flash system memory, RSS and OTP accesses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Table 49. Flash registers access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Table 50. Flash interrupt request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Table 51. Flash interface - register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Table 52. ICACHE features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Table 53. TAG memory dimensioning parameters
for n-way set associative operating mode (default) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Table 54. TAG memory dimensioning parameters
for direct mapped cache mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Table 55. ICACHE cacheability for AHB transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
Table 56. Configurations of product memories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
Table 57. ICACHE remap region size, base address and remap address . . . . . . . . . . . . . . . . . . . . 251
Table 58. ICACHE interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Table 59. ICACHE register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
Table 60. SMPS modes summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
Table 61. SMPS step down converter operating mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
Table 62. SMPS step down converter versus low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
Table 63. PVM features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
Table 64. Low-power mode summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
Table 65. Functionalities depending on the working mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
Table 66. Low-power run . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
Table 67. Sleep mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Table 68. Low-power sleep. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
Table 69. Stop 0 mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Table 70. Stop 1 mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
Table 71. Stop 2 mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Table 72. Standby mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
Table 73. Shutdown mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
Table 74. PWR Security configuration summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Table 75. PWR register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
Table 76. RCC input/output signals connected to package pins or balls . . . . . . . . . . . . . . . . . . . . . 329
Table 77. Clock source frequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Table 78. RCC security configuration summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
Table 79. Interrupt sources and control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
Table 80. RCC register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
Table 81. CRS features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
Table 82. Effect of low-power modes on CRS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432
Table 83. Interrupt control bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432
Table 84. CRS register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438
Table 85. Port bit configuration table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441
Table 86. GPIO secured bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
Table 87. GPIO register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458
Table 88. TrustZone security and privilege register accesses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
Table 89. BOOSTEN and ANASWVDD set/reset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463
Table 90. SYSCFG register map and reset values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470
Table 91. STM32L552xx and STM32L562xx peripherals interconnect matrix . . . . . . . . . . . . . . . . 472
Table 92. DMA1 and DMA2 implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
Table 93. DMA internal input/output signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
Table 94. Programmable data width and endian behavior (when PINC = MINC = 1) . . . . . . . . . . . 491
Table 95. DMA interrupt requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493
Table 96. DMA register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
Table 97. DMAMUX instantiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510
List of figures
Figure 248. Update rate examples depending on mode and TIMx_RCR register settings . . . . . . . . 1092
Figure 249. External trigger input block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1093
Figure 250. TIM1 ETR input circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1093
Figure 251. TIM8 ETR input circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1093
Figure 252. Control circuit in normal mode, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . 1094
Figure 253. TI2 external clock connection example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1095
Figure 254. Control circuit in external clock mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1096
Figure 255. External trigger input block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1096
Figure 256. Control circuit in external clock mode 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1097
Figure 257. Capture/compare channel (example: channel 1 input stage) . . . . . . . . . . . . . . . . . . . . . 1098
Figure 258. Capture/compare channel 1 main circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1099
Figure 259. Output stage of capture/compare channel (channel 1, idem ch. 2 and 3) . . . . . . . . . . . 1099
Figure 260. Output stage of capture/compare channel (channel 4). . . . . . . . . . . . . . . . . . . . . . . . . . 1100
Figure 261. Output stage of capture/compare channel (channel 5, idem ch. 6) . . . . . . . . . . . . . . . . 1100
Figure 262. PWM input mode timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1102
Figure 263. Output compare mode, toggle on OC1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1104
Figure 264. Edge-aligned PWM waveforms (ARR=8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1105
Figure 265. Center-aligned PWM waveforms (ARR=8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1106
Figure 266. Generation of 2 phase-shifted PWM signals with 50% duty cycle . . . . . . . . . . . . . . . . . 1108
Figure 267. Combined PWM mode on channel 1 and 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1109
Figure 268. 3-phase combined PWM signals with multiple trigger pulses per period . . . . . . . . . . . . 1110
Figure 269. Complementary output with dead-time insertion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1111
Figure 270. Dead-time waveforms with delay greater than the negative pulse . . . . . . . . . . . . . . . . . 1111
Figure 271. Dead-time waveforms with delay greater than the positive pulse. . . . . . . . . . . . . . . . . . 1112
Figure 272. Break and Break2 circuitry overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1114
Figure 273. Various output behavior in response to a break event on BRK (OSSI = 1) . . . . . . . . . . 1116
Figure 274. PWM output state following BRK and BRK2 pins assertion (OSSI=1) . . . . . . . . . . . . . . 1117
Figure 275. PWM output state following BRK assertion (OSSI=0) . . . . . . . . . . . . . . . . . . . . . . . . . . 1118
Figure 276. Output redirection (BRK2 request not represented) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1119
Figure 277. Clearing TIMx OCxREF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1120
Figure 278. 6-step generation, COM example (OSSR=1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1121
Figure 279. Example of one pulse mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1122
Figure 280. Retriggerable one pulse mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1124
Figure 281. Example of counter operation in encoder interface mode. . . . . . . . . . . . . . . . . . . . . . . . 1125
Figure 282. Example of encoder interface mode with TI1FP1 polarity inverted. . . . . . . . . . . . . . . . . 1126
Figure 283. Measuring time interval between edges on 3 signals . . . . . . . . . . . . . . . . . . . . . . . . . . . 1127
Figure 284. Example of Hall sensor interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1129
Figure 285. Control circuit in reset mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1130
Figure 286. Control circuit in Gated mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1131
Figure 287. Control circuit in trigger mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1132
Figure 288. Control circuit in external clock mode 2 + trigger mode . . . . . . . . . . . . . . . . . . . . . . . . . 1133
Figure 289. General-purpose timer block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1182
Figure 290. Counter timing diagram with prescaler division change from 1 to 2 . . . . . . . . . . . . . . . . 1184
Figure 291. Counter timing diagram with prescaler division change from 1 to 4 . . . . . . . . . . . . . . . . 1184
Figure 292. Counter timing diagram, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1185
Figure 293. Counter timing diagram, internal clock divided by 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1186
Figure 294. Counter timing diagram, internal clock divided by 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1186
Figure 295. Counter timing diagram, internal clock divided by N. . . . . . . . . . . . . . . . . . . . . . . . . . . . 1187
Figure 296. Counter timing diagram, Update event when ARPE=0 (TIMx_ARR not preloaded). . . . 1187
Figure 297. Counter timing diagram, Update event when ARPE=1 (TIMx_ARR preloaded). . . . . . . 1188
Figure 298. Counter timing diagram, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1189
Figure 299. Counter timing diagram, internal clock divided by 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1189
Figure 349. Update rate examples depending on mode and TIMx_RCR register settings . . . . . . . . 1265
Figure 350. Control circuit in normal mode, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . 1266
Figure 351. TI2 external clock connection example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1266
Figure 352. Control circuit in external clock mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1267
Figure 353. Capture/compare channel (example: channel 1 input stage) . . . . . . . . . . . . . . . . . . . . . 1268
Figure 354. Capture/compare channel 1 main circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1268
Figure 355. Output stage of capture/compare channel (channel 1). . . . . . . . . . . . . . . . . . . . . . . . . . 1269
Figure 356. Output stage of capture/compare channel (channel 2 for TIM15) . . . . . . . . . . . . . . . . . 1269
Figure 357. PWM input mode timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1271
Figure 358. Output compare mode, toggle on OC1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1273
Figure 359. Edge-aligned PWM waveforms (ARR=8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1274
Figure 360. Combined PWM mode on channel 1 and 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1275
Figure 361. Complementary output with dead-time insertion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1276
Figure 362. Dead-time waveforms with delay greater than the negative pulse. . . . . . . . . . . . . . . . . 1276
Figure 363. Dead-time waveforms with delay greater than the positive pulse. . . . . . . . . . . . . . . . . . 1277
Figure 364. Break circuitry overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1279
Figure 365. Output behavior in response to a break . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1281
Figure 366. Output redirection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1283
Figure 367. Example of one pulse mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1285
Figure 368. Retriggerable one pulse mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1286
Figure 369. Measuring time interval between edges on 2 signals . . . . . . . . . . . . . . . . . . . . . . . . . . . 1288
Figure 370. Control circuit in reset mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1289
Figure 371. Control circuit in gated mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1290
Figure 372. Control circuit in trigger mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1291
Figure 373. Basic timer block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1343
Figure 374. Counter timing diagram with prescaler division change from 1 to 2 . . . . . . . . . . . . . . . . 1345
Figure 375. Counter timing diagram with prescaler division change from 1 to 4 . . . . . . . . . . . . . . . . 1345
Figure 376. Counter timing diagram, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1346
Figure 377. Counter timing diagram, internal clock divided by 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1347
Figure 378. Counter timing diagram, internal clock divided by 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1347
Figure 379. Counter timing diagram, internal clock divided by N. . . . . . . . . . . . . . . . . . . . . . . . . . . . 1348
Figure 380. Counter timing diagram, update event when ARPE = 0 (TIMx_ARR not
preloaded). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1348
Figure 381. Counter timing diagram, update event when ARPE=1 (TIMx_ARR
preloaded). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1349
Figure 382. Control circuit in normal mode, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . 1350
Figure 383. Low-power timer block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1357
Figure 384. Glitch filter timing diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1360
Figure 385. LPTIM output waveform, single counting mode configuration
when repetition register content is different than zero (with PRELOAD = 1) . . . . . . . . . 1362
Figure 386. LPTIM output waveform, Single counting mode configuration
and Set-once mode activated (WAVE bit is set) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1363
Figure 387. LPTIM output waveform, Continuous counting mode configuration . . . . . . . . . . . . . . . . 1363
Figure 388. Waveform generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1365
Figure 389. Encoder mode counting sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1369
Figure 390. Continuous counting mode when repetition register LPTIM_RCR
different from zero (with PRELOAD = 1). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1370
Figure 391. IRTIM internal hardware connections with TIM16 and TIM17 . . . . . . . . . . . . . . . . . . 1385
Figure 392. Independent watchdog block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1386
Figure 393. Watchdog block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1396
Figure 394. Window watchdog timing diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1397
Figure 395. RTC block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1403
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 STMicroelectronics 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.
• RAZ: read-as-zero.
• WI: writes ignored.
• RAZ/WI: read-as-zero, writes ignored.
The bus matrix provides access from a master to a slave, enabling concurrent access and
efficient operation even when several high-speed peripherals work simultaneously. This
architecture is shown in Figure 1:
Slave Interface
S-bus
FLASH
512 KB
MPCBB1 SRAM1
MPCBB2 SRAM2
AHB1
peripherals
AHB2
OTFDEC peripherals
MPCWM1 OctoSPI1
MPCWM2 FSMC
MPCWM3
BusMatrix-S
2.1.3 S-bus
This bus connects the system bus of the Cortex®-M33 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 SRAMs, the AHB1 peripherals including the APB1 and APB2
peripherals, the AHB2 peripherals and the external memories through the OCTOSPI or the
FSMC.
The SRAM2 is also accessible on this bus to allow continuous mapping with SRAM1.
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 and SRAM2, the AHB1 peripherals including the APB1 and APB2
peripherals, the AHB2 peripherals and the external memories through the OCTOSPI or the
FSMC.
2.1.6 BusMatrix
The BusMatrix manages the access arbitration between masters. The arbitration uses a
Round Robin algorithm. The BusMatrix is composed of up to six masters (CPU AHB,
system bus, Fast C-bus, Slow C-bus, DMA1, DMA2, SDMMC1) and up to seven slaves
(FLASH, SRAM1, SRAM2, AHB1 (including APB1 and APB2), AHB2, OCTOSTPI1 and
FSMC).
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.3.2: Memory map and register boundary addresses on page 88 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 the user has 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.
implementation (refer to Figure 2). It is then combined with the results from the SAU
security attribution and the most secure level between the two is selected.
Based on IDAU security attribution, the Flash, system SRAMs and peripherals memory
space is aliased twice for secure and non-secure state. However, the external memories
space is not aliased.
Table 1 shows an example of typical eight SAU regions mapping based on IDAU regions.
The user can split and choose the secure, non-secure or NSC regions for external
memories as needed.
Table 1. Example of memory map security attribution versus SAU regions configuration(1)
SAU security
Region IDAU security Final security
Address range attribution typical
description attribution attribution
configuration
0x0800_0000
Non-secure Non-secure Non-secure
Code - Flash and 0x0BFF_FFFF
SRAM 0x0C00_0000
NSC Secure or NSC Secure or NSC
0x0FFF_FFFF
0x1000_0000
Non-secure Non-secure Non-secure
Code - external 0x17FF_FFFF
memories 0x1800_0000
Non-secure Non-secure Non-secure
0x1FFF_FFFF
0x2000_0000
Non-secure Non-secure Non-secure
0x2FFF_FFFFF
SRAM
0x3000_0000
NSC Secure or NSC Secure or NSC
0x3FFF_FFFFF
0x4000_0000
Non-secure Non-secure Non-secure
0x4FFF_FFFFF
Peripherals
0x5000_0000
NSC Secure or NSC Secure or NSC
0x5FFF_FFFFF
0x6000_0000 Secure or non- Secure or non-
External memories Non-secure
0xDFFF_FFFF secure or NSC secure or NSC
1. Different colors highlights the different configurations
Pink: Non-secure
Green: NSC (non-secure callable)
Lighter green: Secure or non-secure or NSC
OCTOSPI1 registers
AHB3
FMC registers
SDMMC1
PKA
RNG
AHB 2
HASH
AES
ADC
ICACHE registers
AHB1 TSC
CRC
DFSDM1
SAI2
SAI1
TIM17
TIM16
TIM15
APB2
USART1
TIM8
SPI1
TIM1
COMP
VREFBUF
UCPD1
USB FS
FDCAN1
LPTIM3
LPTIM2
I2C4
LPUART1
LPTIM1
OPAMP
DAC1/DAC2
CRS
I2C3
I2C2
I2C1
APB1
UART5
UART4
USART3
USART2
SPI3
SPI2
IWDG
WWDG
TIM7
TIM6
TIM5
TIM4
TIM3
TIM2
GPIOH
GPIOG
GPIOF
GPIOE
AHB2 GPIOD
GPIOC
GPIOB
GPIOA
OTFDEC1(1)
GTZC
EXTIT
Flash memory
AHB1 RCC
DMAMUX1
DMA2
DMA1
APB2 SYSCFG
PWR
APB1 RTC
TAMP
1. Always secure when TZEN = 1.
2.3.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.
FMC bank 3
Non-secure
0x5000 0000
0x8000 0000 Reserved
0x4402 2000
0x7000 0000 AHB3
0x4402 0000
FMC bank 1 Reserved
0x420C 8400
Non-secure AHB2
0x6000 0000 0x4202 0000
Reserved
0x4003 3400
AHB1
0x4002 0000
Peripherals Reserved
0x4001 6800
Non-secure callable APB2
0x5000 0000 0x4001 0000
Reserved
0x4000 E000
APB1
0x4000 0000
Peripherals
Non-secure
0x4000 0000 0x1000 0000
Reserved
0x0FF8 27FF
RSS
SRAM2 0x0FF8 0000
Reserved
Non-secure callable 0x0E04 0000
SRAM2
0x3003 0000 0x0E03 0000
SRAM1 SRAM1
0x0E00 0000
Non-secure callable Reserved
0x3000 0000 0x0C08 0000
FLASH
SRAM 2 0x0C00 0000
Non-secure
0x2003 0000
SRAM 1 0x0C00 0000
Non-secure Reserved
0x0BFB 0000
0x2000 0000 OTP
0x0BFA 0000
Code Reserved
Non-secure 0x0BF9 7FFF
System memory
0x1000 0000 0x0BF9 0000
Code Reserved
0x0A04 0000
Non-secure callable SRAM2
0x0C00 0000 0x0A03 0000
SRAM1
Code 0x0A00 0000
Non-secure Reserved
0x0000 0000 0x0808 0000
FLASH
0x0800 0000
External memories remap
Non-secure 0x0000 0000
Non-secure callable
MSv49340V3
All the memory map areas that are not allocated to memories and peripherals are
considered “Reserved”. 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 4. STM32L552xx and STM32L562xx memory map and peripheral register boundary
addresses
Non-secure boundary Size Peripheral register
Bus Secure boundary address Peripheral
address (bytes) map
0x5402 1400 - 0x5FFF FFFF 0x4402 1400 - 0x4FFF FFFF 129 MB Reserved -
OCTOSPI1 Section 20.7.28:
0x5402 1000 - 0x5402 13FF 0x4402 1000 - 0x4402 13FF 1 KB
registers OCTOSPI register map
AHB3
Table 4. STM32L552xx and STM32L562xx memory map and peripheral register boundary
addresses (continued)
Non-secure boundary Size Peripheral register
Bus Secure boundary address Peripheral
address (bytes) map
Table 4. STM32L552xx and STM32L562xx memory map and peripheral register boundary
addresses (continued)
Non-secure boundary Size Peripheral register
Bus Secure boundary address Peripheral
address (bytes) map
Section 35.6.21:
0x5001 4400 - 0x5001 47FF 0x4001 4400 - 0x4001 47FF 1 KB TIM16 TIM16/TIM17 register
map
Section 35.5.21: TIM15
0x5001 4000 - 0x5001 43FF 0x4001 4000 - 0x4001 43FF 1 KB TIM15
register map
0x5001 3C00 - 0x5001 3FFF 0x4001 3C00 - 0x4001 3FFF 1 KB Reserved -
Section 44.8.15:
0x5001 3800 - 0x5001 3BFF 0x4001 3800 - 0x4001 3BFF 1 KB USART1
USART register map
Section 33.4.33: TIM8
0x5001 3400 - 0x5001 37FF 0x4001 3400 - 0x4001 37FF 1 KB TIM8
register map
Section 46.6.8: SPI
0x5001 3000 - 0x5001 33FF 0x4001 3000 - 0x4001 33FF 1 KB SPI1
register map
Section 33.4.32: TIM1
0x5001 2C00 - 0x5001 2FFF 0x4001 2C00 - 0x4001 2FFF 1 KB TIM1
register map
Table 4. STM32L552xx and STM32L562xx memory map and peripheral register boundary
addresses (continued)
Non-secure boundary Size Peripheral register
Bus Secure boundary address Peripheral
address (bytes) map
Table 4. STM32L552xx and STM32L562xx memory map and peripheral register boundary
addresses (continued)
Non-secure boundary Size Peripheral register
Bus Secure boundary address Peripheral
address (bytes) map
Table 4. STM32L552xx and STM32L562xx memory map and peripheral register boundary
addresses (continued)
Non-secure boundary Size Peripheral register
Bus Secure boundary address Peripheral
address (bytes) map
Note: When enabling the RAM parity check, it is advised to initialize by software the whole RAM
memory at the beginning of the code, to avoid getting parity errors when reading non-
initialized locations.
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 that writing ‘1’ on a bit will setup the write protection for that page of SRAM
and it can be removed/cleared by a system reset only.
3 Boot configuration
When TrustZone is enabled by setting the TZEN option bit, the boot space must be in
secure area. The SECBOOTADD0[24:0] option bytes are used to select the boot secure
memory address.
A unique boot entry option can be selected by setting the BOOT_LOCK option bit. All other
boot options are ignored.
The boot address option bytes enables the possibility to program any boot memory address.
However, the allowed address space depends on Flash read protection RDP level.
If the programmed boot memory address is out of the allowed memory mapped area when
RDP level is 0.5 or more, the default boot fetch address is forced to:
• 0x0800 0000 (when TZEN = 0)
• RSS (when TZEN = 1)
Refer to the Table 8.
Table 8. Boot space versus RDP protection
RDP TZEN = 1 TZEN = 0
1. In RDP level 2, the boot is done from the address programmed in NSBOOTADD0 or NSBOOTADD1
depending on the boot configuration before setting the RDP level 2 and if the programmed address is
within the user Flash memory.
If the programmed NSBOOTADD0 or NSBOOTADD1 is not a valid address, the boot if forced at 0x800
0000.
The BOOT0 value (either coming from the pin or the option bit) is latched upon reset
release. It is up to the user to set nBOOT0 or BOOT0 values to select the required boot
mode.
The BOOT0 pin or user option bit (depending on the nSWBOOT0 bit value in the
FLASH_OPTR register) is also re-sampled when exiting from Standby mode. Consequently,
they must be kept in the required Boot mode configuration in Standby mode.After startup
delay, the selection of the boot area is done before releasing the processor reset.
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.
4 System security
4.1 Introduction
The STM32L552xx and STM32L562xx have been designed with a comprehensive set of
security features, some of which being based on standard Arm TrustZone® technology.
These security features should simplify the process of evaluating IoT devices against
security standards. They also significantly reduce the cost and complexity of software
development for OEMs and third party developers by facilitating the re-use, improving the
interoperability, and minimizing the API fragmentation.
This section explains the different security features available on the STM32L552xx and
STM32L562xx devices.
The SFI native service leverages the following hardware security features:
• Secure boot (see Section 4.4)
• Resource isolation using TrustZone® (see Section 4.6)
• Temporal isolation using hide protection (see Section 4.7.1)
• Secure execution (see Section 4.8)
• Secure storage, with associated cryptographic engines (see Section 4.9 and
Section 4.10)
Further information can be found in application note AN4992 - Overview secure firmware
install (SFI) available on www.st.com.
4.4.1 Introduction
Secure boot is an immutable code that is always executed after a system reset. As a root of
trust, this code checks the STM32L552xx and STM32L562xx static protections and
activates available STM32L552xx and STM32L562xx runtime protections, reducing the risk
that invalid or malicious code runs on the platform. As root of trust, secure boot also checks
integrity and authenticity of the next level firmware before executing it.
The actual functions of secure boot depend on availability of TrustZone® features, and the
firmware stored in the device. However it would typically initializes secure storage, and
install on-the-fly decryption keys in OTFDEC to be able to use encrypted firmware stored in
external Flash memory.
The STM32L552xx and STM32L562xx Trusted Firmware-M (TFM) application, supported
by the STM32 ecosystem, provides a root of trust solution including secure boot functions.
For more information, refer to user manual UM2671 - Getting started with STM32CubeL5
TFM application available from www.st.com.
In the STM32L552xx and STM32L562xx devices, the secure boot takes benefit of hardware
security features such as:
• Resource isolation using TrustZone® (see Section 4.6)
• Temporal isolation using hide protection (see Section 4.7.1)
• Secure execution (see Section 4.8)
• Secure install and update (see Section 4.3 and Section 4.5)
• Secure storage, with associated cryptographic engines if available (see Section 4.9
and Section 4.10)
This section describes the features specifically designed for secure boot.
Note: As long as it is cleared, the BOOT_LOCK option byte can be set without any constraint. But
once set the BOOT_LOCK option bit cannot be cleared.
For more information on STM32L552xx and STM32L562xx boot mechanisms, refer to
Section 3: Boot configuration.
4.6.1 Introduction
In the STM32L552xx and STM32L562xx devices, the hardware and software resources can
be partitioned so that they exist either in the secure world or in the non-secure world, as
shown on Figure 3.
Note: The initial partitioning of the platform is under the responsibility of the secure firmware
executed after reset of the device.
Thanks to this resource isolation technology, the secure world can be used to protect critical
code against intentional or unintentional tampering from the more exposed code running in
the non-secure world.
Note: Typically secure code is small and rarely modified, while non-secure code is more exposed,
and prone to firmware updates.
Figure 4. Sharing memory map between CPU in secure and non-secure state
Non-secure Secure Non-secure Secure
memory view memory view memory view memory view
0xFFFF FFFF
System region MPU-NS*
0xF000 0000
hidden SCB-NS*
System control and debug
SysTick-NS*
0xE000 0000
DEBUG
External peripherals
hidden SAU
0xA000 0000
MPU-NS MPU-S
External memories
SCB-NS SCB-S
0x6000 0000
Periph-NS NVIC
hidden Periph-S SysTick-NS SysTick-S
0x4000 0000
SRAM-NS ITM / DWT / FBP
hidden SRAM-S
0x2000 0000
Flash-NS
hidden Flash-S
0x0000 0000 (*) Aliased addresses
MSv64440V1
®
The Cortex processor state (and associated rights) depends on the security attribute
assigned to the memory region where it is executing. More specifically:
• A processor in a non-secure state only executes from non-secure (NS) program
memory, while a processor in a secure state only executes from secure (S) program
memory.
• While running in secure state the processor can access data from both S and NS
memories. Running in non-secure state the CPU is limited to non-secure memories.
In order to manage transitions to secure world, developers must create non-secure callable
(NSC) regions that contain valid entry points to the secure libraries. The first instruction in
these entry points must be the new secure gate (SG) instruction, used by non-secure
code to call a secure function. It is illustrated on Figure 5.
Non-secure
callable
call
Secure call / branch
return entry point
Non-secure
application Secure
library
return
MSv64441V1
Secure Secure
Non-secure Secure-NSC Secure-NSC
Non-secure Non-secure
Secure Secure
Secure-NSC
Non-secure Secure-NSC
1. Defined regions are aligned to 32-byte boundaries.
The SAU can only be configured by the Cortex®-M33 in the secure privileged state. When
TrustZone® is enabled, the SAU defaults all addresses as secure (S). A secure boot
application can then program SAU to create NSC or NS regions, as shown in Table 9.
The SAU/IDAU settings are applicable to only the Cortex®-M33. The other masters like
DMA are not affected by those policies.
For more information on memory security attribution using IDAU/SAU on STM32L552xx and
STM32L562xx, please refer to AN5347 on STMicroelectronics website.
Device boundary
MPU
Flash memory
SRAM
External
OTFDEC
Flash memory
External
SRAM
I/O I/O
TrustZone®-aware peripherals
MSv64450V1
The MPCBB instances in GTZC provide the capability to configure the security of
embedded SRAM blocks, as defined in Table 11.
When TrustZone® is activated, peripherals are set as non-secure and non-privilege after
reset.
Embedded Flash
When the TrustZone® security is enabled through option bytes (TZEN = 1), the whole Flash
memory is secure after reset and the following protections, shown on Figure 7, are available
to the application:
• Non-volatile user secure areas, defined with non-volatile secure user option bytes
– Watermark-based secure only area (x2 in dual bank configuration)
– Secure hide protection (HDP) area, stickily hidden after boot (x2 in dual bank
configuration)
• Volatile user secure pages, defined with volatile secure registers (lost after reset)
– Any page set as non-secure (example: outside watermark-based secure only
area), can be set as secure on-the-fly using the block-based configuration
registers
Note: All areas aligned on Flash memory page granularity.
Flash memory area can be configured as secure while they are tagged as non-secure in
Cortex®-M33 IDAU/SAU. In this case non-secure accesses by the CPU to the Flash
memory is denied.
Erase or program operation can be performed in secure or non-secure mode with
associated configuration bits.
Non-secure pages
Secure pages
Non-secure pages
Secure pages
User Flash memory
Non-secure pages
Flash memory-S(*)
(HDP)
Boot
Boot
Bootloader Bootloader-NS
Read-only system
Boot
Flash memory
Hidden RSS(*) (HDP)
Boot
®
As shown above, when TrustZone is activated (TZEN=1) the application code can use the
HDP area that is part of the Flash watermark-based secure area. Indeed, when application
sets HDPxACCDIS bit, data read, write and instruction fetch on this hide protection area are
denied until next system reset. For example, the software code in the secure Flash hide
protected area can be executed only once, with any further access to this area denied until
next system reset. Additionally, any Flash memory page belonging to an active HDP area
cannot be erased anymore.
When TrustZone® is disabled (TZEN=0) the volatile/non-volatile secure areas features are
deactivated and all secure registers are RAZ/WI.
See Section 6: Embedded Flash memory (FLASH) for details.
Note: When a DMA transfer error occurs during a DMA read or write access, the faulty channel x
is automatically disabled, and TEIFx bit is set in DMA_ISR register.
See Section 14: Direct memory access controller (DMA) and Section 15: DMA request
multiplexer (DMAMUX) for details.
STM32L562xx add a secure alternate function gate on the path between the peripheral and
its allocated I/Os:
• If the peripheral is secure, the I/O pin must also be secure to allow input/output of data
• If the peripheral is not secure, the connection is allowed regardless of the I/O pin state.
TrustZone®-aware logic around GPIO ports used as alternate function is summarized in
Table 14.
Table 14. Secure Alternate function between peripherals and allocated I/Os
Security configuration Alternate function logic
Comment
Peripheral Allocated I/O pin Input Output
Secure -
Secure I/O data Peripheral data
Non-secure Out of reset configuration
Secure Zero Zero
Non-secure -
Non-secure I/O data Peripheral data
When analog function with analog switch is used, the connection to the peripherals
described in Table 15 is blocked by hardware when the peripheral is non-secure and the I/O
is secure.
Table 15. Summary of the I/Os that cannot be connected to a non-secure peripheral
when secure
Peripheral Analog function(1) Output Input
Finally, regarding GPIO and security, Table 16 summarizes the list of I/Os that do not have
an hardware protection linked to TrustZone®. More specifically the listed signals (input
and/or outputs) are not blocked when the I/O is set as secure and the associated peripheral
is non secure.
For example, when secure application sets PA4 as secure to be used as LPTIM2_OUT, if
the DAC peripheral is non-secure it can be programmed to output data to PA4, potentially
causing malfunction to the secure application.
Similarly, when secure application sets PA0 as secure to be used as UART4_TX, if the
TAMP peripheral is non-secure it can be programmed to capture the USART input traffic
through the TAMP_IN signal.
Hence it is important that for each case described in Table 16 secure application decides if a
potential effect on data integrity or confidentiality is critical or not. For example, if the USART
situation described above is not acceptable (data transiting on secure USART is
confidential) then the secure application should configure the TAMP peripheral as secure
even if it is not used by the secure application.
Table 16. Summary of the I/Os that can be secured and connected to a non-secure
peripheral
How to set the peripheral or
Peripheral Signal (1) Output Input
function as secure
TSC_G1_IOy (y= 1 to 3) - X
TSC_G2_IOy (y= 1 to 4) - X
Set TSCSEC bit in the
TSC TSC_G3_IOy (y= 2 to 4) - X GTZC_TZSC_SECCFGR2 register
TSC_Gx_IOy
- X
(x=4 to 8, y=1 to 4)
TAMP_INx (x= 1 to 8) - X Set TAMPDPROT bit in the
TAMP
TAMP_OUTy (x= 1 to 8) X - TAMP_SMCR register
For more detailed information on the topic refer to Section 11: General-purpose I/Os
(GPIO).
See Section 17: Extended interrupts and event controller (EXTI) for details.
Note: Such RDP regression triggers the erase of embedded memories (SRAM2, flash), and the
reset of all peripherals, including the on-the-fly decryption and all the crypto engines.
After the TrustZone® deactivation, most features mentioned in Section 4.6 are no more
available. More specifically:
• Non-volatile secure area of embedded Flash memory is deactivated, including the HDP
area
• NVIC only manages non-secure interrupts
• All secure registers in TrustZone®-aware peripherals are RAZ/WI.
Note: When TrustZone® is disabled GTZC can still be used to configure the privilege access to
securable peripherals.
For more information please refer to application AN5347 available at www.st.com.
When HDPxEN and HDPxACCDIS bits are set, data read, write and instruction fetch on the
area defined by SECWMx_STRT and HDPx_PEND are denied until next device reset.
User User
applications applications
Secure Secure
Flash memory Flash memory
Secure area
applications applications
2) Jump to secure code and hide area
Secure boot
code and data Hidden
(HDP)
Note: Bank erase aborts when it contains a write-protected area (WRP or HDP area).
HDP area can be resized by secure application if the area is not hidden and if RDP level is
different than 2.
4.8.1 Introduction
Through a mix of special software and hardware features, STM32L552xx and
STM32L562xx devices ensure the correct operation of their functions against abnormal
situations caused by programmer errors, software attacks through network access or local
attempt for tampering code execution.
This section describes the hardware features specifically designed for secure execution.
Response to tampers
Each source of tamper in the device can be configured to trigger the following events:
• Generate an interrupt, capable of waking up the device from Stop and Standby modes
(see TAMPxMSK bits in TAMP_CR2 register)
• Generate a hardware trigger for the low-power timers
• Erase of device secrets if corresponding TAMPxNOER bit is cleared in TAMP_CR2
register (for tamper pins) or TAMP_CR3 register (for internal tamper). These erasable
secrets are:
– Symmetric keys stored in backup registers (x32), in AES, HASH and in OTFDEC
(encrypted Flash memory regions are read as zero)
– Asymmetric keys stored in PKA SRAM
– Other secrets stored in SRAM2 and CPU instruction cache memory
Note: Device secrets erase are also triggered by setting the BKERASE bit in the TAMP_CR2
register, or by performing an RDP regression as defined in Section 4.11.2: Lifecycle
management with readout protection (RDP).
Device secrets are not reset by system reset or when the device wakes up from Standby
mode.
4.9.1 Introduction
A critical feature of any security system is how root keys are stored, protected, and
provisioned. Such keys are typically used for loading a boot image, or handling of critical
user data.
Figure 9 shows how key management service application can use the AES engine for
example to compute external image decryption keys. Embedded non-volatile key can be
stored in the secure HDP area (see Section 4.7.1), while volatile key storage consists in the
battery-powered, tamper-protected SRAM or registers in TrustZone®-aware TAMP
peripheral.
Details on tamper protection is found in Section 4.8.4, while TrustZone® features of TAMP is
briefly described in Section 4.6.6.
Embedded
key
non-volatile storage
AES
(secure or non-secure)
Embedded
volatile storage key
(tamper resistant)
key
OTFDEC
4.9.2 Unique ID
The STM32L552xx and STM32L562xx store a 96-bit ID that is unique to each device. It is
stored at the address 0x0BFA 0590.
Application services can use this unique identity key to identify the product in the cloud
network, or make it difficult for counterfeit devices or clones to inject untrusted data into the
network.
4.10.1 Introduction
STM32L552xx and STM32L562xx devices implement state-of-the-art cryptographic
algorithms featuring key sizes and computing protection as recommended by national
security agencies such as NIST for the U.S.A, BSI for Germany or ANSSI for France. Those
algorithms are used to support privacy, authentication, integrity, entropy and identity
attestation.
4.11.1 Introduction
A typical IoT device lifecycle is summarized in Figure 10. For each step, STM32L552xx and
STM32L562xx devices propose secure lifecycle management mechanisms embedded in
the hardware.
Vendor states
User states
Virgin device
Device manufacturing
Fie
Decommissioning ld
ret
urn
MSv64454V1
More details on the various phases and associated transitions, found either at the vendor or
end user premises, are summarized on Table 20.
Level Secure(1) and Boot address must target a secure area when TrustZone® is enabled
Device is open
0 non-secure (secure SRAM, secure Flash memory, RSS in system Flash memory).
Boot address must target a secure area when TrustZone® is enabled
Device is partially (secure user or system Flash memory). boot on SRAM is not
Level Non-secure
(2) closed (closed- permitted.
0.5 only
secure) Access to non-secure Flash memory is allowed when debug is
connected.
Boot address must target the secure user Flash memory.
Non-secure
Level Device memories Accesses to non-secure Flash memory, encrypted Flash memory(3),
only
1 are protected SRAM2 and backup registers are not allowed when debug is
(conditioned)
connected.
Level None Boot address must target the user Flash memory (secure if TZEN=1).
Device is closed
2 (JTAG fuse) Option bytes are read-only, hence RDP level 2 cannot be changed.
1. Debug is not available when executing RSS code.
2. Only applicable when TrustZone® security is activated in the product.
3. External Flash memory area decrypted on-the-fly with OTFDEC peripheral.
Full Flash
memory erase +
secret erase
RDP1
RDP1
Non-secure
Full Flash
Flash memory
memory erase +
erase +
secret erase
secret erase
RDP2 RDP0
MSv64463V1
As shown on Figure 11, the user Flash memory is automatically erased, either partially or in
totality, during a RDP regression. During the transition from RDP1 to RDP0.5 only non-
secure embedded Flash memory is erased, keeping functional for example the secure boot
and the secure firmware update. In all regressions OTP area in Flash memory is kept, and
device secrets are erased, hence no secrets shall be stored in OTP as they are revealed
after a regression to RDP0. Those secrets, erased as response to tamper, are defined in
Section 4.8.4: Tamper detection and response.
Note: Enabling TrustZone® using option byte TZEN is only possible when RDP level is 0.
For more details on RDP please refer to Section 6: Embedded Flash memory (FLASH).
4.12.1 Introduction
The device restricts access to embedded debug features, in order to guarantee the
confidentiality of customer assets against unauthorized usage of debug & trace features.
4.13.1 Introduction
Thanks to software intellectual property protection and collaborative model the
STM32L552xx and STM32L562xx devices allow to integrate and implement with third-party
libraries innovative solutions.
Collaborative development is summarized on Figure 12. Starting from a personalized device
sold by STMicroelectronics, a vendor A can integrate a portion of hardware and software on
a platform A, that can then be used by a vendor B that will do the same before deploying a
final product to the end users.
Note: Each platform vendor can provision individual platforms for development, not to be
connected to a production cloud network (“Development Platform X”).
STM32 personalized
device
Decommissioning
Decommissioned product
MSv64455V1
The features described hereafter contribute to securing the software intellectual property
within such a collaborative development.
Provisioning
STM32
SRAM2
Secure Flash
JTAG 3
bootloader
part II
Option
bytes Octo-
2 Flash
USART OTF SPI
memory
DEC
SPI 4 5 6
ROM
Secure
I2C
bootloader
Host FDCAN part I SRAM
1
1 USB
Secure boot
STM32
Application
Octo-
Flash 1 OTF Flash
SPI
Secure boot memory
DEC
2
tamper
Provisioning
Assuming the device is virgin, the first step is to provision both Flash memories, as detailed
below:
1. User creates an SFI image, composed of:
– Encrypted internal firmware and data (including external Flash memory drivers)
– Encrypted external firmware and data AES key (up to 4)
– Encrypted external firmware and data image
2. The secure bootloader stored in system memory loads the second part of the secure-
bootloader in SRAM2 through the supported communication ports (USART, SPI, I2C,
FDCAN, USB and JTAG). This second part runs in secure SRAM2 and is responsible
for executing the SFI process, applying the SFI protocol thanks to the commands
received through the above mentioned supported communication ports.
3. Internal Flash memory is programmed with decrypted option bytes, internal firmware
and data, and external firmware and data AES key(s). Alternatively, device unique
external firmware AES keys could be used instead of such global keys.
4. OTFDEC is properly initialized with encrypted region(s) information, including the
corresponding external firmware and data AES key.
5. Running the SFI process, chunks of encrypted external firmware and data image are
decrypted in the device, then re-encrypted in OTFDEC.
6. After chunk OTFDEC re-encryption, user external Flash memory programmer is
responsible for programming those last encrypted chunks to external SPI Flash
memories through OCTOSPI peripheral.
Secure boot
After provisioning, each time the device initializes on trusted firmware, the following actions
are required:
1. Secure boot firmware executes, programming the external firmware and data AES
key(s) to OTFDEC write-only key registers, along with the other needed information.
2. Application reads or executes the encrypted external firmware and data through
OCTOSPI memory mapped mode, unless a tamper event is detected. In this case all
OTFDEC keys are erased and encrypted regions read as zero until OTFDEC is
properly initialized again.
For more information on above secure firmware install (SFI) solutions for STM32L552xx and
STM32L562xx devices please refer to AN4992 on STMicroelectronics website.
Application information
The TZSC, MPCBB and TZIC sub-blocks can be used in one of the following ways:
• programmed during secure Boot only, locked and not changed afterwards
• dynamically re-programmed when using specific application code or secure kernel
(microvisor). When not locked, MPC secure blocks or region size can be changed by
secure software executing from the secure FLASH memory region or secure SRAM.
Same remark applies to the GTZC_TZSC_SECCFRGx and
GTZC_TZSC_PRIVCFGRx registers that define secure/privilege state of each
peripheral.
The Armv8-M security architecture with secure, securable and TrustZone-aware peripherals
is shown in Figure 14.
AHB
Armv8-M AHB
Masters...
MCU masters
Master sec/priv
Security master wrapper
AHB
AHB2/APB bridge
MPC
TZIC
Sec/priv gate BBx
Periph
sec / priv
Periph
sec / priv
AHB-PPC
TZSC stub
UART
MPCWMx
MPCBBx Crypto
Crypto
APB (AES)
GTZC (AES)
Block 1- NS NS
Block 2 - S
Block 3 - S
Block 4 - NS Securable
Timer ... peripherals
SPI NS
SPI Timer ...
Block N-1 - S
Block N - NS
External memories
Internal SRAM
Securable peripherals Securable memories
MSv48198V2
The secure configuration bit a given peripheral can be modified only with a secure-privilege
transaction if the peripheral has been configured as privilege, otherwise a secure
transaction (non-privileged) is sufficient.
TZEN
(from option bytes)
GTZC
TZSC
Sec/NSec
AHB Priv/NPriv
SECCFGR
PRIVCFGR
TZSC_ILA_event
MPCWMR
MPCBB
AHB MPCBBVCT
MPCBB_VCTR
MPCBB_ILA_event
TZIC
IER
AHB SR GTZC_IRQn
TZIC_ILA_event
(to NVIC)
FCR
Concerning the MPCBB controller, there is an option to ignore secure data read/write
access on non-secure SRAM blocks, by setting the SRWILADIS configuration bit in the
GTZC_MPCBBx_CR register. Secure read and write data transactions are then
allowed on non-secure SRAM blocks, while secure execution access remains not
allowed.
Any secure execute transaction trying to access a non-secure peripheral register or
memory is considered as illegal and generates a bus error.
• Illegal non-privilege access
Any non-privilege transaction trying to acces a privilege resource is considered as
illegal. There is no illegal access event generated for this type of illegal access. The
addressed resource follows a silent-fail behavior, returning all zero data for read and
ignoring any write. No bus error is generated.
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. LCK
rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
VREFBUFSEC
LPUART1SEC
FDCAN1SEC
OPAMPSEC
LPTIM3SEC
LPTIM2SEC
LPTIM1SEC
UCPD1SEC
USBFSSEC
COMPSEC
DAC1SEC
TIM1SEC
SPI1SEC
CRSSEC
I2C4SEC
I2C3SEC
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
USART3SEC
USART2SEC
WWDGSEC
UART5SEC
UART4SEC
IWDGSEC
TIM7SEC
TIM6SEC
TIM5SEC
TIM4SEC
TIM3SEC
TIM2SEC
SPI3SEC
SPI2SEC
I2C2SEC
I2C1SEC
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
OCTOSPI1_REGSEC
FMC_REGSEC
SDMMC1SEC
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ICACHE_REGSEC
DFSDM1SEC
USART1SEC
TIM17SEC
TIM16SEC
TIM15SEC
HASHSEC
TIM8SEC
RNGSEC
CRCSEC
SAI2SEC
SAI1SEC
ADCSEC
TSCSEC
PKASEC
AESSEC
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
VREFBUFPRIV
LPUART1PRIV
FDCAN1PRIV
OPAMPPRIV
LPTIM3PRIV
LPTIM2PRIV
LPTIM1PRIV
UCPD1PRIV
USBFSPRIV
COMPPRIV
DAC1PRIV
TIM1PRIV
SPI1PRIV
I2C4PRIV
CRSPRIV
I2C3PRIV
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
USART3PRIV
USART2PRIV
WWDGPRIV
UART5PRIV
UART4PRIV
IWDGPRIV
TIM7PRIV
TIM6PRIV
TIM5PRIV
TIM4PRIV
TIM3PRIV
TIM2PRIV
SPI3PRIV
SPI2PRIV
I2C2PRIV
I2C1PRIV
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
OCTOSPI1_REGPRIV
FMC_REGPRIV
SDMMC1PRIV
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ICACHE_REGPRIV
DFSDM1PRIV
USART1PRIV
TIM17PRIV
TIM16PRIV
TIM15PRIV
HASHPRIV
TIM8PRIV
RNGPRIV
SAI2PRIV
SAI1PRIV
CRCPRIV
ADCPRIV
PKAPRIV
AESPRIV
TSCPRIV
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. NSWM1LGTH[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. Res. NSWM1STRT[10:0]
rw rw rw rw rw rw rw rw rw rw rw
Note: If NSWM1LGTH = 0, the region 1 is disabled and the only non-secure memory space is
defined by NSWMPxWM2.
If both NSWMPxWM1 and NSWMPxWM2 have the reset value 0x0000 0000, all the
memory space of the external memory x (FMC NOR/SRAM or OCTOSPI) is secure.
If NSWM1LGTH = 0x800 and NSWM1STRT = 0, the whole 256-Mbyte memory space is
non-secure (independent of NSWMPxWM2 value).
If NSWM1LGTH = 0x001 and NSWM1STRT = 0x7FF, only one 128-Kbyte block is defined
as non-secure (at address offset = 0x0FFE 0000, ending at 0x0FFF FFFF).
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Res. Res. Res. Res. NSWM2LGTH[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. Res. NSWM2STRT[10:0]
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
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.
LCK
GTZC_TZSC_CR
0x000
Reset value 0
0x004 to
Reserved Reserved
0x00C
VREFBUFSEC
LPUART1SEC
FDCAN1SEC
USART3SEC
USART2SEC
OPAMPSEC
LPTIM3SEC
LPTIM2SEC
LPTIM1SEC
UCPD1SEC
WWDGSEC
USBFSSEC
UART5SEC
UART4SEC
COMPSEC
IWDGSEC
DAC1SEC
TIM1SEC
TIM7SEC
TIM6SEC
TIM5SEC
TIM4SEC
TIM3SEC
TIM2SEC
SPI1SEC
SPI3SEC
SPI2SEC
CRSSEC
I2C4SEC
I2C3SEC
I2C2SEC
I2C1SEC
GTZC_TZSC
0x010 _SECCFGR1
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
OCTOSPI1_REGSEC
ICACHE_REGSEC
FMC_REGSEC
SDMMC1SEC
DFSDM1SEC
USART1SEC
TIM17SEC
TIM16SEC
TIM15SEC
HASHSEC
TIM8SEC
RNGSEC
CRCSEC
SAI2SEC
SAI1SEC
ADCSEC
TSCSEC
PKASEC
AESSEC
GTZC_TZSC
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
0x014 _SECCFGR2
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x018 to
Reserved Reserved
0x01C
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
VREFBUFPRIV
LPUART1PRIV
FDCAN1PRIV
USART3PRIV
USART2PRIV
OPAMPPRIV
LPTIM3PRIV
LPTIM2PRIV
LPTIM1PRIV
WWDGPRIV
UCPD1PRIV
USBFSPRIV
UART5PRIV
UART4PRIV
COMPPRIV
IWDGPRIV
DAC1PRIV
TIM1PRIV
TIM7PRIV
TIM6PRIV
TIM5PRIV
TIM4PRIV
TIM3PRIV
TIM2PRIV
SPI1PRIV
SPI3PRIV
SPI2PRIV
CRSPRIV
I2C4PRIV
I2C3PRIV
I2C2PRIV
I2C1PRIV
GTZC_TZSC
0x020 _PRIVCFGR1
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
OCTOSPI1_REGPRIV
ICACHE_REGPRIV
FMC_REGPRIV
SDMMC1PRIV
DFSDM1PRIV
USART1PRIV
TIM17PRIV
TIM16PRIV
TIM15PRIV
HASHPRIV
RNGPRIV
CRCPRIV
SAI2PRIV
SAI1PRIV
ADCPRIV
PKAPRIV
AESPRIV
TSCPRIV
GTZC_TZSC
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
0x024 _PRIVCFGR2
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x028 to
Reserved Reserved
0x02C
GTZC_TZSC
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
NSWM1LGTH[11:0] NSWM1STRT[10:0]
0x030 _MPCWM1ANSR
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
GTZC_TZSC
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
NSWM2LGTH[11:0] NSWM2STRT[10:0]
0x034 _MPCWM1BNSR
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
GTZC_TZSC
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
NSWM1LGTH[11:0] NSWM1STRT[10:0]
0x038 _MPCWM2ANSR
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
GTZC_TZSC
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
_MPCWM2BNSR
NSWM2LGTH[11:0] Res. NSWM2STRT[10: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
GTZC_TZSC
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
NSWM1LGTH[11:0] NSWM1STRT[10:0]
0x040 _MPCWM3ANSR
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
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
INVSECSTATE
SRWILADIS
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 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. Res. Res. Res. Res. Res. Res. Res. Res. Res. LCK
rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
LCKSB23
LCKSB22
LCKSB21
LCKSB20
LCKSB19
LCKSB18
LCKSB17
LCKSB16
Res. Res. Res. Res. Res. Res. Res. Res.
LCKSB14
LCKSB13
LCKSB12
LCKSB10
LCKSB11
LCKSB9
LCKSB8
LCKSB7
LCKSB6
LCKSB5
LCKSB4
LCKSB3
LCKSB2
LCKSB1
LCKSB0
rwo rwo rwo rwo rwo rwo rwo rwo rwo rwo rwo rwo rwo rwo rwo rwo
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
LCKSB7
LCKSB6
LCKSB5
LCKSB4
LCKSB3
LCKSB2
LCKSB1
LCKSB0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
B(31 + 32 * y)
B(30 + 32 * y)
B(29 + 32 * y)
B(28 + 32 * y)
B(27 + 32 * y)
B(26 + 32 * y)
B(25 + 32 * y)
B(24 + 32 * y)
B(23 + 32 * y)
B(22 + 32 * y)
B(21 + 32 * y)
B(20 + 32 * y)
B(19 + 32 * y)
B(18 + 32 * y)
B(17 + 32 * y)
B(16 + 32 * y)
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
B(15 + 32 * y)
B(14 + 32 * y)
B(13 + 32 * y)
B(12 + 32 * y)
B(10 + 32 * y)
B(11 + 32 * y)
B(9 + 32 * y)
B(8 + 32 * y)
B(7 + 32 * y)
B(6 + 32 * y)
B(5 + 32 * y)
B(4 + 32 * y)
B(3 + 32 * y)
B(2 + 32 * y)
B(1 + 32 * y)
B(32 * y)
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
Bits 31:0 B[31+ 32 * y:32 * y]: define secure access mode for the super-block y
0x0000 0000: all blocks of super-block y are non-secure.
....
0x0000 00FF: only blocks 0 to 7 of super-block y are secure.
.....
0x8000 0001: only blocks 0 and 31 of super-block y are secure.
....
0xFFFF FFFF: all super-blocks are secure.
0x80C
0xC10
0xC00
0x8FC
5.6.6
5.6.5
0xC0C
0xCFC
Offset
Offset
0x04 *y
(y =0 to
0x900 +
(y = 0 to
0xD00 +
0x814 to
0x804 to
0x004 *y
0xC14 to
0xC04 to
156/2194
_CR
_CR
_VCTRy
_VCTRy
Reserved
Reserved
Reserved
Reserved
Register
Register
_LCKVTR1
_LCKVTR1
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
GTZC_MPCBB2
GTZC_MPCBB2
GTZC_MPCBB2
GTZC_MPCBB1
GTZC_MPCBB1
GTZC_MPCBB1
1
0
1
0
B(31 + 32 * y) Res. SRWILADIS 31 B(31 + 32 * y) Res. SRWILADIS 31
1
0
1
0
B(30 + 32 * y) Res. INVSECSTATE 30 B(30 + 32 * y) Res. INVSECSTATE 30
1
1
B(29 + 32 * y) Res. Res. 29 B(29 + 32 * y) Res. Res. 29
1
1
B(28 + 32 * y) Res. Res. 28 B(28 + 32 * y) Res. Res. 28
1
1
B(27 + 32 * y) Res. Res. 27 B(27 + 32 * y) Res. Res. 27
1
1
B(26 + 32 * y) Res. Res. 26 B(26 + 32 * y) Res. Res. 26
1
1
Global TrustZone® controller (GTZC)
1
1
B(24 + 32 * y) Res. Res. 24 B(24 + 32 * y) Res. Res. 24
1
1
0
B(23 + 32 * y) Res. Res. 23 B(23 + 32 * y) LCKSB23 Res. 23
1
1
B(22 + 32 * y) Res. Res. 22 B(22 + 32 * y) 0 LCKSB22 Res. 22
1
1
0
B(21 + 32 * y) Res. Res. 21 B(21 + 32 * y) LCKSB21 Res. 21
1
1
0
1
1
0
1
1
0
RM0438 Rev 7
1
1
0
1
1
0
1
1
0
Reserved
Reserved
Reserved
Reserved
1
1
0
1
1
0
1
1
0
1
1
0
1
1
0
1
1
0
1
1
0
1
1
0
0
B(7 + 32 * y) LCKSB7 Res. 7 B(7 + 32 * y) LCKSB7 Res. 7
1
1
0
0
B(6 + 32 * y) LCKSB6 Res. 6 B(6 + 32 * y) LCKSB6 Res. 6
1
1
0
0
B(5 + 32 * y) LCKSB5 Res. 5 B(5 + 32 * y) LCKSB5 Res. 5
1
1
0
0
B(4 + 32 * y) LCKSB4 Res. 4 B(4 + 32 * y) LCKSB4 Res. 4
1
1
0
0
B(3 + 32 * y) LCKSB3 Res. 3 B(3 + 32 * y) LCKSB3 Res. 3
1
1
0
0
B(2 + 32 * y) LCKSB2 Res. 2 B(2 + 32 * y) LCKSB2 Res. 2
1
1
0
0
B(1 + 32 * y) LCKSB1 Res. 1 B(1 + 32 * y) LCKSB1 Res. 1
1
1
0
0
0
0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
VREFBUFIE
LPUART1IE
FDCAN1IE
OPAMPIE
LPTIM3IE
LPTIM2IE
LPTIM1IE
UCPD1IE
USBFSIE
COMPIE
DAC1IE
TIM1IE
SPI1IE
I2C4IE
I2C3IE
CRSIE
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
USART3IE
USART2IE
WWDGIE
UART5IE
UART4IE
IWDGIE
TIM7IE
TIM6IE
TIM5IE
TIM4IE
TIM3IE
TIM2IE
SPI3IE
SPI2IE
I2C2IE
I2C1IE
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
OCTOSPI1_REGIE
FLASH_REGIE
DMAMUX1IE
FMC_REGIE
OTFDEC1IE
SDMMC1IE
SYSCFGIE
FLASHIE
DMA2IE
DMA1IE
PWRIE
EXTIIE
RCCIE
RTCIE
Res. Res.
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
ICACHE_REGIE
DFSDM1IE
USART1IE
TIM17IE
TIM16IE
TIM15IE
HASHIE
TIM8IE
RNGIE
CRCIE
SAI2IE
SAI1IE
ADCIE
PKAIE
AESIE
TSCIE
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
OCTOSPI1_MEMIE
MPCBB2_REGIE
MPCBB1_REGIE
FMC_MEMIE
SRAM2IE
SRAM1IE
TZSCIE
TZICIE
rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
VREFBUFF
LPUART1F
FDCAN1F
OPAMPF
LPTIM3F
LPTIM2F
LPTIM1F
UCPD1F
USBFSF
COMPF
DAC1F
TIM1F
SPI1F
I2C4F
CRSF
I2C3F
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
USART3F
USART2F
WWDGF
UART5F
UART4F
IWDGF
TIM7F
TIM6F
TIM5F
TIM4F
TIM3F
TIM2F
SPI3F
SPI2F
I2C2F
I2C1F
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
OCTOSPI1_REGF
FLASH_REGF
DMAMUX1F
FMC_REGF
OTFDEC1F
SDMMC1F
SYSCFGF
FLASHF
DMA2F
DMA1F
PWRF
EXTIF
RCCF
RTCF
Res. Res.
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
ICACHE_REGF
DFSDM1F
USART1F
TIM17F
TIM16F
TIM15F
HASHF
TIM8F
RNGF
CRCF
SAI2F
SAI1F
ADCF
PKAF
AESF
TSCF
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
OCTOSPI1_MEMF
MPCBB2_REGF
MPCBB1_REGF
FMC_MEMF
SRAM2F
SRAM1F
TZSCF
TZICF
r r r r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
VREFBUFFC
LPUART1FC
FDCAN1FC
OPAMPFC
LPTIM3FC
LPTIM2FC
LPTIM1FC
UCPD1FC
USBFSFC
COMPFC
DAC1FC
TIM1FC
SPI1FC
I2C4FC
CRSFC
I2C3FC
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
USART3FC
USART2FC
WWDGFC
UART5FC
UART4FC
IWDGFC
TIM7FC
TIM6FC
TIM5FC
TIM4FC
TIM3FC
TIM2FC
SPI3FC
SPI2FC
I2C2FC
I2C1FC
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
OCTOSPI1_REGFC
FLASH_REGFC
DMAMUX1FC
FMC_REGFC
OTFDEC1FC
SDMMC1FC
SYSCFGFC
FLASHFC
DMA2FC
DMA1FC
PWRFC
EXTIFC
RCCFC
RTCFC
Res. Res.
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
ICACHE_REGFC
DFSDM1FC
USART1FC
TIM17FC
TIM16FC
TIM15FC
HASHFC
TIM8FC
RNGFC
SAI2FC
SAI1FC
CRCFC
ADCFC
PKAFC
AESFC
TSCFC
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
OCTOSPI1_MEMFC
MPCBB2_REGFC
MPCBB1_REGFC
FMC_MEMFC
SRAM2FC
SRAM1FC
TZSCFC
TZICFC
w w w w w w w w
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
VREFBUFIE
LPUART1IE
FDCAN1IE
USART3IE
USART2IE
OPAMPIE
LPTIM3IE
LPTIM2IE
LPTIM1IE
UCPD1IE
WWDGIE
USBFSIE
UART5IE
UART4IE
COMPIE
IWDGIE
DAC1IE
TIM1IE
TIM7IE
TIM6IE
TIM5IE
TIM4IE
TIM3IE
TIM2IE
SPI1IE
SPI3IE
SPI2IE
I2C4IE
I2C3IE
I2C2IE
I2C1IE
CRSIE
GTZC_TZIC_IER1
0x400
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
OCTOSPI1_REGIE
ICACHE_REGIE
FLASH_REGIE
DMAMUX1IE
FMC_REGIE
OTFDEC1IE
SDMMC1IE
SYSCFGIE
DFSDM1IE
USART1IE
FLASHIE
TIM17IE
TIM16IE
TIM15IE
DMA2IE
DMA1IE
HASHIE
PWRIE
TIM8IE
EXTIIE
RNGIE
RCCIE
CRCIE
SAI2IE
SAI1IE
ADCIE
RTCIE
PKAIE
AESIE
TSCIE
Res.
Res.
GTZC_TZIC_IER2
0x404
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
0x41C
0x40C
Offset
176/2194
Reserved
Reserved
Register
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
GTZC_TZIC_SR3
GTZC_TZIC_SR2
GTZC_TZIC_SR1
GTZC_TZIC_IER3
GTZC_TZIC_FCR3
GTZC_TZIC_FCR2
GTZC_TZIC_FCR1
0
0
Res. Res. SPI1FC Res. Res. SPI1F Res. 31
0
0
Res. Res. TIM1FC Res. Res. TIM1F Res. 30
0
0
0
0
Res. OTFDEC1FC COMPFC Res. OTFDEC1F COMPF Res. 29
0
0
0
0
Res. EXTIFC VREFBUFFC Res. EXTIF VREFBUFF Res. 28
0
0
0
0
Res. FLASH_REGFC UCPD1FC Res. FLASH_REGF UCPD1F Res 27
0
0
0
0
Res. FLASHFC USBFSFC Res. FLASHF USBFSF Res. 26
0
0
0
0
Global TrustZone® controller (GTZC)
0
0
0
0
Res. DMAMUX1FC LPTIM3FC Res. DMAMUX1F LPTIM3F Res. 24
0
0
0
Res. DMA2FC LPTIM2FC Res. DMA2F 0 LPTIM2F Res. 23
0
0
0
0
Res. DMA1FC I2C4FC Res. DMA1F I2C4F Res. 22
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
RM0438 Rev 7
0
0
0
0
0
0
0
0
0
0
0
0
Reserved
Reserved
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
6.1 Introduction
The Flash memory interface manages accesses to the Flash memory, maximizing
throughput to the CPU, instruction cache and DMAs. It implements the Flash memory erase
and program operations as well as the read and write protection mechanisms. It also
implements the security and privilege access control features.
Table 30. Flash module - 512 KB dual bank organization (64 bits read width)
Flash area Flash memory address Size Name
Bank 1 - - -
- - -
- - -
0x0803 F800 - 0x0803 FFFF 2 Kbytes Page 127
Main memory
0x08040000 - 0x0804 07FF 2 Kbytes Page 0
0x0804 0800 - 0x0804 0FFF 2 Kbytes Page 1
- - -
Bank 2
- - -
- - -
0x0807 F800 - 0x0807 FFFF 2 Kbytes Page 127
Note: The secure information block is only available when TrustZone is active.
Table 31. Flash module - 512 KB single bank organization (128 bits read width)
Flash area Flash memory address Size Name
Note: The secure information block is only available when TrustZone is active.
When an ECC error is reported, a new read at the failing address may not generate an ECC
error if the data is still present in the current buffer, even if ECCC and ECCD are cleared.
In this case, a NMI is generated. The user has to read ECCD and ECCD2 to see which part
of the 128-bits data has error detection (either 63:0, 127:64 or both).
When an ECC error is detected, the address of the failing the two times double word is
saved into ADDR_ECC[18:0] in FLASH_ECCR. ADDR_ECC[18:0] contains an address of a
two times double word.
The ADDR_ECC[3:0] are always cleared. BK_ECC is not used in this mode.
When ECCC/ECCC2 or ECCD/ECCD2 is/are set, if a new ECC error occurs, the
ADDR_ECC is not updated. The FLASH_ECCR is updated only if the ECC flags
(ECCC/ECCC2/ECCD/ECCD2) are cleared.
Note: For a virgin data: 0xFF FFFF FFFF FFFF FFFF, one error is detected and corrected but two
errors detection is not supported.
When an ECC error is reported, a new read at the failing address may not generate an ECC
error if the data is still present in the current buffer, even if ECCC and ECCD are cleared.
Table 32. Number of wait states according to CPU clock (HCLK) frequency
HCLK (MHz)
Wait states (WS)
(Latency)
VCORE Range 0 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:
Flash memory while the application is running. Nevertheless, part of the application must
have been previously programmed in the Flash memory using ICP.
The contents of the Flash memory are not guaranteed if a device reset occurs during a
Flash memory program or erase operation.
In dual bank mode, an on-going Flash memory operation does not block the CPU as long as
the CPU does not access the same Flash memory bank. Code or data fetches are possible
on one bank while a write/erase operation is performed to the other bank (refer to
Section 6.3.9: 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 0 and 1.
Note: At power-on reset or a system reset, the main regulator voltage range 2 is selected by
default. Consequently, the voltage scaling range must be programmed to range 0 or range 1
via VOS[1:0] bits in the PWR_CR1 register prior to any Flash erase and programming
operation.
On the contrary, during a program/erase operation to the Flash memory, any attempt to read
the same Flash memory bank stalls the bus. The read operation proceeds correctly once
the program/erase operation has been completed.
The MCU supports Arm® TrustZone® which defines secure and non-secure areas in Flash.
All program and erase operations can be performed in secure mode through the secure
registers or in non-secure mode through the non-secure registers. For more information,
refer to Section 6.5: Flash TrustZone security and privilege protections.
Secure bank 1, bank 2 mass erase (available only in dual-bank mode when
DBANK=1)
To perform a secure bank mass erase, follow the procedure below:
1. Check that no Flash memory operation is ongoing by checking the SECBSY bit in the
FLASH_SECSR register.
2. Check and clear all secure error programming flags due to a previous programming. If
not, SECPGSERR is set.
3. Set the SECMER1 bit or SECMER2 (depending on the bank) in the FLASH_SECCR
register. Both banks can be selected in the same operation, in that case it corresponds
to a mass erase.
4. Set the SECSTRT bit in the FLACH_SECCR register.
5. Wait for the SECBSY bit to be cleared in the FLASH_SECSR register
6. The SECMER1 or SECMER2 bit can be cleared if no more secure bank erase is
requested.
Note: When DBANK=0, if only the NSMERA or the NSMERB bit is set, NSPGSERR 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), NSWRPERR is set and the mass erase request is aborted (for both banks if both are
selected).
Non-secure programming
The Flash memory programming sequence is as follows:
1. Check that no Flash main memory operation is ongoing by checking the NSBSY bit in
the FLASH_NSSR.
2. Check and clear all non-secure error programming flags due to a previous
programming. If not, NSPGSERR is set.
3. Set the NSPG bit in the FLASH_NSCR register.
4. Perform the data write operation at the desired memory non-secure address, or in the
OTP area. Only double word can be programmed.
– Write a first word in an address aligned with double word
– Write the second word in the same double-word.
5. Wait until the NSBSY bit is cleared in the FLASH_NSSR register.
6. Check that NSEOP flag is set in the FLASH_NSSR register (meaning that the
programming operation has succeed), and clear it by software.
7. Clear the NSPG bit in the FLASH_NSSR register if there no more programming
request anymore.
Secure programming
The Flash memory programming sequence is as follows:
1. Check that no Flash main memory operation is ongoing by checking the SECBSY bit in
the FLASH_SECSR.
2. Check and clear all secure error programming flags due to a previous programming. If
not, SECPGSERR is set.
3. Set the SECPG bit in the FLASH_SECCR register.
4. Perform the data write operation at the desired memory secure address. Only double
word can be programmed.
– Write a first word in an address aligned with double word
– Write the second word in the same double-word.
5. Wait until the SECBSY bit is cleared in the FLASH_SECSR register.
6. Check that SECEOP flag is set in the FLASH_SECSR register (meaning that the
programming operation has succeed), and clear it by software.
7. Clear the SECPG bit in the FLASH_SECSR register if there is no more programming
request anymore.
Note: When the Flash interface has received a good sequence (a double word), programming is
automatically launched and SECBSY/NSBSY bit is set. The internal oscillator HSI16
(16 MHz) is enabled automatically when SECPG/NSPG bit is set, and disabled
automatically when SECPG/NSPG 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.
If an error occurs during a a secure or non-secure program or erase operation, one of the
following programming error flags is set:
– Non-secure programming error flags: NSPROGERR, NSSIZERR, NSPGAERR,
NSPGSERR, OPTWRERR or NSWRPERR is set in the FLASH_NSSR register.
– If the non-secure error interrupt enable bit NSERRIE is set in the Flash non-secure
control register (FLASH_NSCR), an interrupt is generated and the operation error
flag NSOPERR is set in the FLASH_NSSR register.
• Secure programming error flags: SECPROGERR, SECSIZERR, SECPGAERR,
SECPGSERR or SECWRPERR is set in the FLASH_SECSR register.
– If the secure error interrupt enable bit SECERRIE is set in the Flash secure control
register (FLASH_SECCR), an interrupt is generated and the operation error flag
SECOPERR is set in the FLASH_SECSR 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 NSBSY or SECBSY
bit in the FLASH_NSSR or FLASH_SECSR register (NSBSY, SECBSY are set when
erase/program operation is on going in bank 1 or bank 2).
2. Set NSPER or SECPER bit, NSPSB or SECPSB to select the non-secure or secure
page and NSBKER or SECBER to select the bank following the security state non-
secure or secure.
3. Set the NSSTRT or SECSTRT bit in the FLASH_NSCR/FLASH_SECCR register.
4. Wait for the NSBSY or SECBSY bit to be cleared (or use the NSEOP or SECEOP
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 NSBSY/SECBSY
bit in the FLASH_NSSR/FLASH_SECSR register (NSBSY, SECBSY are active when
erase/program operation is on going in bank 1 or bank 2).
2. Non-secure bank erase, set the NSMER1 or NSMER2 in the FLASH_NSCR register.
For secure bank erase, set the SECMER1 or SECMER2 in the FLASH_SECCR
register.
3. Set the NSSTRT/SECSTRT bit in the FLASH_NSCR/FLASH_SECCR register.
4. Wait for the NSBSY or SECBSY bit to be cleared (or use the NSEOP or SECEOP
interrupt).
Register map
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
IWDG_STDBY
BOR_LEV[2:0]
nRST_STDBY
PA15_PUPEN
SWAP_BANK
nRST_SHDW
SRAM2_RST
IWDG_STOP
nRST_STOP
nSWBOOT0
WWDG_SW
SRAM2_PE
IDWG_SW
nBOOT0
DB256K
DBANK
RDP
Res.
Res.
Res.
Res.
Res.
register (FLASH_OPTR)
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.
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.
Register map
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
Section 6.9.22: Flash WPR2
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
WRP2A_PEND[6:0] WRP2A_PSTRT[6:0] area A address register
(FLASH_WRP2AR)
Section 6.9.23: Flash WPR2
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
WRP2B_PEND[6:0] WRP2B_PSTRT[6:0] area B address register
(FLASH_WRP2BR)
user, they reflects the options states of the system. See Section 6.4.2: Option bytes
programming for more details.
Activating dual-bank mode (switching from DBANK=0 to DBANK=1)
When switching from one Flash mode to another (for example from single to dual bank) it is
recommended to execute the code from the SRAM or use the bootloader. To avoid reading
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.
• If any secure Flash protection is enabled (watemark or block-based), all must be
disabled.
• Disable the instruction cache if it is enabled
• 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=1 memory mapping.
– Set the new secure protection if needed.
The new software is ready to be run using the bank configuration.
When the TrustZone is active (TZEN=1), additional security features are available:
• Secure watermark-based user options bytes defining secure, HDP areas.
• Secure or non-secure block-based areas can be configured on-the-fly after reset. This
is a volatile secure area.
• An additional RDP protection: RDP level 0.5.
• Erase or program operation can be performed in secure or non-secure mode with
associated configuration bit.
When the TrustZone is disabled (TZEN=0), the above features are deactivated and all
secure registers are RAZ/WI.
All other option bytes not listed above, can be modified without any constraints.
SECWM1_PSTRT = 0
SECWM1_PEND = 0x7F
0 All Flash memory is secure
SECWM2_PSTRT = 0x7F
SECWM2_PEND = 0
Caution: Switching a Flash memory area from secure to non-secure does not erase its content. The
user secure software must perform the needed operation to erase the secure area before
switching an area to non-secure attribute whenever is needed. It is also recommended to
flush the instruction cache.
The secure HDP area is enabled by the HDPxEN (x=1,2 for area 1 and area 2). When the
HDPxEN bit is reset, there is no HDP area. The HDPxEN bit can be set or reset by the
secure firmware if the HDPx_ACCDIS bit is reset.
The secure HDP area size is defined by the end page offset using the HDPx_PEND option
bytes while the start page offset is already defined by SECWMx_PSTRT option bytes.These
offsets are defined in the Secure watermark registers address registers Flash bank 1 secure
watermak1 register (FLASH_SECWM1R1), Flash secure watermak1 register 2
(FLASH_SECWM1R2), Flash secure watermak2 register (FLASH_SECWM2R1), Flash
secure watermak2 register 2 (FLASH_SECWM2R2).
The HDPxEN and HDPx_PEND option bytes can only be modified by secure firmware when
the HDPxACCDIS bit is reset.
If the HDPxACCDIS bit is set, the HDPxEN and HDPx_PEND cannot be modified until next
system reset.
If an invalid secure HDP area is defined as described in Table 36: Secure, HDP protections
summary, the OPTWERR flag error is set and option bytes modification is discarded.
SECWMx_PSTRT >
x No secure area.
SECWMx_PEND
SECWMx_PSTRT <= No secure HDP area.
0
SECWMx_PEND Secure area bewteen SECWMx_STRT and SECWMx_PEND
The area between SECWMx_STRT and HDPx_PEND is
SECWMx_STRT <= HDPx-
secure HDP protected.
_PEND <=
– If SECWMx_STRT=HDPx_PEND, one page defined in
1 SECWMx_PEND
HDPx_PEND is secure HDP protected.
Invalid secure area.
Others
HDP area is defined outside the secure area.
0 Non secure
None
1 Secure
0 Secure
Yes
1 Non secure
6.6.1 Introduction
Secure system memory stores RSS (root secure services) firmware that is programmed by
ST during STM32L552xx and STM32L562xx production. The RSS provides secure services
to the bootloader and the user firmware. These services are described hereafter in this
section.
The RSS services are only available after the user enables the microcontroller TrustZone®
feature thanks to TZEN bitfield set to 1 within FLASH_OPTR option byte register.
At boot time, the RSS firmware enables and jumps to bootloader; the RSS provides services
to secure user firmware at runtime.
Non secure peripherals, IRQn and IOs allocated to non-secure for bootloader execution are
described within Table 39.
Table 39. Non-secure peripherals, IRQn and IOs for bootloader execution
HW resource type Resource description
For IRQn and IO bootloader detailed usage, please refer to AN2606 – STM32
microcontroller system memory boot mode.
the user must read this ID using BL_ID C defined macro from the CMSIS device header file
(BL_ID is one-byte long value). Then, the user firmware must call the right function
according to bootloader ID value.
RSSLIB functions are split between non-secure callable and secure callable function.
The RSS library functions are described within sections hereafter.
CloseExitHDP_BL90
Bootloader ID:
CloseExitHDP_BL90 function is compliant for bootloader ID 0x90.
Secure attribute:
Secure callable function.
Prototype:
uint32_t CloseExitHDP_BL90(uint32_t HdpArea, uint32_t
VectorTableAddr)
Arguments:
• HdpArea:
Input parameter, bitfield that identifies which HDP area to close. Values can be either:
RSSLIB_HDP_AREA1_Msk, RSSLIB_HDP_AREA2_Msk or
RSSLIB_HDP_AREA1_Msk |RSSLIB_HDP_AREA2_Msk.
• VectorTableAddr:
Input parameter,address of the next vector table to apply.
The vector table format is the one used by the Cortex®-M33 core.
Description:
User calls CloseExitHDP_BL90 to close Flash HDP secure memory area and jump to
the reset handler embedded within the vector table which address is passed as input
parameter.
CloseExitHDP_BL90 sets the SP provided by the passed vector table, however it is up
to the caller to first set the new vector table. Then it clears all general-purpose Cortex®-
M33 registers (r0, r1, …) before jumping to new vector table reset handler.
On successful execution, the function does not return and does not push LR onto the
stack.
In case of failure (bad input parameter value), this function returns RSSLIB_ERROR.
Please refer to section Section 6.5.3: Secure hide protection (HDP) to get more details
on Flash memory HDP protection.
CloseExitHDP_BL91
Bootloader ID:
CloseExitHDP_BL91 function is compliant for bootloader ID 0x91 up to 0x9F.
Secure attribute:
Secure callable function.
Prototype:
uint32_t CloseExitHDP_BL91(uint32_t HdpArea, uint32_t
VectorTableAddr)
Arguments:
• HdpArea:
Input parameter, bitfield that identifies which HDP area to close. Values can be either:
RSSLIB_HDP_AREA1_Msk, RSSLIB_HDP_AREA2_Msk or
RSSLIB_HDP_AREA1_Msk |RSSLIB_HDP_AREA2_Msk.
• VectorTableAddr:
Input parameter,address of the next vector table to apply.
The vector table format is the one used by the Cortex®-M33 core.
Description:
The user calls CloseExitHDP_BL91 to close Flash HDP secure memory area and jump
to the reset handler embedded within the vector table which address is passed as input
parameter.
CloseExitHDP_BL91 sets the SP provided by the passed vector table, however it is up
to the caller to first set the new vector table. Then it clears all general-purpose
ACortex®-M33 registers (r0, r1, …) before jumping to new vector table reset handler.
On successful execution, the function does not return and does not push LR onto the
stack.
In case of failure (bad input parameter value), this function returns RSSLIB_ERROR.
Please refer to section Section 6.5.3: Secure hide protection (HDP) to get more details
on Flash memory HDP protection.
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
0xAA Level 0
Any value except 0xAA or 0xCC Level 1
0xCC Level 2
Level 0: no protection
Read, program and erase operations into the Flash main memory area are possible. The
option bytes, the SRAMs and the backup registers are also accessible by all operations.
Level 2: no debug
• The protection level 1 is guaranteed.
• All debug features are disabled.
• The boot from SRAM (boot RAM mode) and the boot from system memory (bootloader
mode) are no longer available.
• When booting from Flash, all operations are allowed on the Flash main memory. Read,
erase and program accesses to Flash memory and SRAMs from user code are
allowed.
• Option bytes cannot be programmed nor erased except the SWAP_BANK option bit.
Thus, the level 2 cannot be removed: it is an irreversible operation. When attempting to
modify the options bytes, the protection error flag OPTWERR is set in the
FLASH_NSSR register and an interrupt can be generated.
Note: The debug feature is also disabled under reset.
Table 42. Access status versus protection level and execution modes when TZEN=0
User execution (boot from
Debug/ bootloader(1)
Flash)
Area RDP level
Read Write Erase Read Write Erase
1. When the protection level 2 is active, the debug port and the bootloader mode are disabled.
2. The Flash main memory is erased when the RDP option byte regresses from level 1 to level 0.
3. The system memory is only read-accessible whatever the protection level (0, 1 or 2) and execution mode.
4. Option bytes are only accessible through the Flash registers interface and OPSTRT bit.
5. SWAP_BANK option, bit can be modified.
6. OTP can only be written once.
7. The backup registers are erased when RDP changes from level 1 to level 0.
8. All SRAMs are erased when RDP changes from level 1 to level 0.
9. The OTFDEC keys are erased when the RDP option byte changes from level 1 to level 0.
0xAA Level 0
0x55 Level 0.5
Any value except 0xAA or 0x55 or 0xCC Level 1
0xCC Level 2
Level 0: no protection
Read, program and erase operations into the Flash main memory area are possible. The
option bytes, the SRAMs and the backup registers are also accessible by all operations.
When booting from RSS, the debug access is disabled while executing RSS code.
Level 2: no debug
When the readout protection level 2 is set:
• The protection level 1 is guaranteed.
• All debug features are disabled.
• The boot from SRAM (boot RAM mode) and the boot from system memory (bootloader
mode) are no longer available.
• Boot from RSS is possible.
• When booting from Flash or RSS, all operations are allowed on the Flash main
memory. Read, erase and program accesses to Flash memory and SRAMs from user
code are allowed.
• Option bytes cannot be programmed nor erased except the SWAP_BANK option bit.
Thus, the level 2 cannot be removed: it is an irreversible operation. When attempting to
modify the options bytes, the protection error flag OPTWERR is set in the
FLASH_NSSR register and an interrupt can be generated.
Note: The debug feature is also disabled under reset.
Table 44. Access status versus protection level and execution modes when TZEN=1
User execution (boot from
Debug/ bootloader(1)
Flash)
Area RDP level
Read Write Erase Read Write Erase
(2)
0.5 Yes Yes Yes Yes Yes(2) Yes(2)
Flash main
1 Yes Yes Yes No No No(3)
memory
2 Yes Yes Yes NA NA NA
0.5 Yes No No Yes No No
System
1 Yes No No Yes No No
memory(4)
2 Yes Yes Yes NA NA NA
0.5 Yes Yes(3) Yes Yes Yes(3) Yes
Option
1 Yes Yes(3) Yes Yes Yes(3) Yes
bytes(5)
(6)
2 Yes No No NA NA NA
0.5 Yes Yes(7) NA Yes Yes(7) NA
OTP 1 Yes Yes(7) NA Yes Yes(7)
NA
(7)
2 Yes Yes NA NA NA NA
(2)
0.5 Yes Yes NA Yes Yes(2) NA(8)
Backup
1 Yes Yes NA No No NA(8)
registers
2 Yes Yes NA NA NA NA
(2)
0.5 Yes Yes NA Yes Yes(2) NA(9)
SRAM2 1 Yes Yes NA No No NA(9)
2 Yes Yes NA NA NA NA
Table 44. Access status versus protection level and execution modes when TZEN=1
User execution (boot from
Debug/ bootloader(1)
Flash)
Area RDP level
Read Write Erase Read Write Erase
Figure 16. RDP level transition scheme when TrustZone is disabled (TZEN=0l)
Write
RDP /= 0XAA and
RDP /= 0xCC
Write
RDP = 0xCC Level 1
Write
RDP ≠ 0xAA
RDP = 0xAA
RDP ≠ 0xCC
Mass erase
Level 2 Level 0
RDP = 0xCC RDP = 0xAA
Write
RDP = 0xCC Write
RDP = 0xAA
RDP increase + option bytes modification
RDP regression
RDP unchanged.
Figure 17. RDP level transition scheme when TrustZone is enabled (TZEN=1)
Write
Write RDP /= 0XAA, 0x55 And 0xCC
RDP = 0xCC Level 1
RDP ≠ 0xAA
RDP ≠ 0x55
RDP ≠ 0xCC Write
RDP = 0xAA
Mass erase
Level 0.5
RDP = 0x55
Level 2 Level 0
RDP = 0xCC RDP = 0xAA
Write Write
RDP = 0xCC RDP = 0xAA
RDP increase + option bytes modification.
RDP unchanged. Only SWAP_BANK option bit
can be modified.
RDP regression. Full mass erase (secure and non-secure).
RDP unchanged.
RDP regression. Partial mass erase (non-secure only)
Note: RDP regression can only be done by debug interface or by system bootloader MSv49344V1
Table 45. Flash access versus RDP level when TrustZone is active (TZEN=1)
RDP level-1
RDP level-0, RDP level-0.5, RDP level-1 no intrusion(1) or
with
RDP level-2
intrusion(2)
Table 46. Flash access versus RDP level when TrustZone is disabled (TZEN=0)
RDP level-1
Access
RDP level-0, RDP level-1 no intrusion(1) or RDP level-2 with
type
intrusion(2)
Fetch
OK
Read Bus error
Write
NO WRP: OK WI and
Erase WRP pages: WI and NSWRPERR flag set NSWRPERR
flag set
1. Level 1 no intrusion = when booting from user Flash and no debug access.
2. RDP Level 1 with intrusion = when booting from user Flash and no debug access.
Table 47. Flash mass erase versus RDP level when TrustZone is active (TZEN = 1)
RDP level-1
RDP level-0, RDP level-0.5, RDP level-1 no intrusion(1) or
with
RDP level-2
intrusion(2)
Access type
Secure Flash
Non-secure Mix non-secure Non-secure or
Flash HDP area (HDPxEN=1 and secure Flash secure Flash
Others(3)
and HDPx_ACCDIS = 1)
NO WRP: OK
Bank
WRP pages: WI,
Non- or
WI and WI, NSWRPERR flag set, Flash illegal access event NSWRPERR
secure mass
NSWRPERR flag set
erase
flag set
1. RDP Level 1 no intrusion = when booting from user Flash and no debug access.
2. RDP Level 1 with intrusion = when booting from user Flash and debug access is detected.
3. Others refers to other Flash secure configuration than the one described for HDP protections. Example: Flash secure,
HDP area enabled but HDPxACCDIS = 0.
Secure/ Privileged/
Fetch Bus error
non-secure unprivileged
Privileged OK
Secure(1)
Read/ Unprivileged RAZ/WI OK RAZ/WI OK
Write Privileged OK
Non- RAZ/WI and a Flash register
secure(2) Unprivileged RAZ/WI OK illegal access event(3)
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_P
LVEN Res. Res. Res. Res. Res. Res. Res. Res. Res. LATENCY[3:0]
_PD D
rw rw rw rw rw rw rw
--
Bit 13 RUN_PD: Flash power-down mode during Run or Low-power run mode
This bit is write-protected with FLASH_PDKEYR.
This bit determines whether the Flash memory is in power-down mode or Idle mode when
the device is in Run or Low-power run mode. The Flash memory can be put in power-down
mode only when the code is executed from RAM. The Flash must not be accessed when
RUN_PD is set.
0: Flash in Idle mode
1: Flash in Power-down mode
Caution: The Flash must not be put in power-down while a program or an erase operation is
on-going.
Bits 12:4 Reserved, must be kept at reset value.
Bits 3:0 LATENCY[3:0]: Latency
These bits represent the ratio of the SYSCLK (system clock) period to the Flash
access time.
0000: Zero wait state
0001: One wait state
0010: Two wait states
0011: Three wait states
0100: Four wait states
...1111: Fifteen wait states
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
NSKEYR[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
NSKEYR[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
SECKEYR[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
SECKEYR[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
LVEKEYR[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
LVEKEYR[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
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. NSBSY
r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
NSPR
OPTW NSPG NSSIZE NSPGA NSWR NSOPE
Res. Res. Res. Res. Res. Res. Res. OGER Res. NSEOP
ERR SERR RR ERR PERR RR
R
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
SECBS
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
Y
r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SECP SECP
SECSIZ SECPG SECW SECOP SECEO
Res. Res. Res. Res. Res. Res. Res. Res. GSER ROGE Res.
ERR AERR RPERR ERR P
R RR
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
NSLO OPTL OBL_LAU NSERRI NSEOP OPTST NSSTR
Res. Res. Res. Res. Res. Res. Res. Res. Res.
CK OCK NCH E IE RT T
rs rs rc_w1 rw rw rs rs
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
NSME NSMER
Res. Res. Res. NSBKER Res. NSPNB[6:0] NSPER NSPG
R2 1
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
SECL SECIN SECER SECEO SECST
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
OCK V RIE PIE RT
rs rs rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SECM SECBKE SECME SECPE
Res. Res. Res. Res. SECPNB[6:0] SECPG
ER2 R R1 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
SYSF_ BK_EC
ECCD ECCC ECCD2 ECCC2 Res. Res. Res. ECCIE Res. Res. Res. ADDR_ECC[18:16]
ECC C
rc_w1 rc_w1 rc_w1 rc_w1 rw rw rw r r r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
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
PA15_ nBOOT nSWB SRAM2 SRAM2 DB256 SWAP_ WWDG IWDG_ IWDG_ IWDG_
TZEN Res. Res. Res. DBANK
PUPEN 0 OOT0 _RST _PE K BANK _SW STDBY STOP SW
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
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
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
NSBOOTADD0[24:9]
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
NSBOOTADD0[8:0] Res. Res. Res. Res. Res. Res. Res.
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
NSBOOTADD1[24:9]
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
NSBOOTADD1[8:0] Res. Res. Res. Res. Res. Res. Res.
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
SECBOOTADD0[24:9]
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
BOOT_
SECBOOTADD0[8:0] Res. Res. Res. Res. Res. Res.
LOCK
w w w w w w w w w 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. SECWM1_PEND[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. SECWM1_PSTRT[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
HDP1E
Res. Res. Res. Res. Res. Res. Res. Res. HDP1_PEND[6:0]
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
Res. 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. WRP1A_PEND[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. WRP1A_PSTRT[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
Res. Res. Res. Res. Res. Res. Res. Res. Res. WRP1B_PEND[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. WRP1B_PSTRT[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
Res. Res. Res. Res. Res. Res. Res. Res. Res. SECWM2_PEND[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. SECWM2_PSTRT[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
HDP2E
Res. Res. Res. Res. Res. Res. Res. Res. HDP2_PEND[6:0]
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
Res. 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. WRP2A_PEND[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. WRP2A_PSTRT[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
Res. Res. Res. Res. Res. Res. Res. Res. Res. WRP2B_PEND[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. WRP2B_PSTRT[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
SECBB1[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
SECBB1[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
SECBB2[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
SECBB2[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
HDP2_ HDP1_
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. ACCDI ACCDI
S S
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. Res. Res. Res. Res. Res. Res. Res. PRIV
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
LVEN
LATENCY
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_ACR
0x00 [3:0]
Reset value 0 0 0 0 0 0 0
FLASH_PDKEYR PDKEYR[31:0]
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_NSKEYR NSKEYR[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_SECKEYR SECKEYR[31: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
FLASH_OPTKEYR OPTKEYR[31:0]
0x10
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_LVEKEYR LVEKEYR[31: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 0
NSPROGERR
NSWRPERR
NSPGSERR
NSPGAERR
OPTWERR
NSSIZERR
NSOPERR
NSEOP
NSBSY
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
FLASH_NSSR
0x20
Reset value 0 0 0 0 0 0 0 0 0
0x4C
0x2C
Offset
242/2194
DD1R
DD0R
ADD0R
FLASH_
FLASH_
Register
Reset value
Reset value
Reset value
Reset value
SECWM1R2
SECWM1R1
FLASH_OPTR
FLASH_ECCR
FLASH_NSCR
FLASH_SECSR
FLASH_SECCR
FLASH_WRP1AR
FLASH_NSBOOTA
FLASH_NSBOOTA
FLASH_SECBOOT
ST production value
ST production value
1
ST production value 1
ST production value 0
ST production value 0
ST production value 0
ST production value 0
0
1
Res. HDP1EN Res. TZEN ECCD SECLOCK NSLOCK Res. 31
0
0
0
0
1
Res. Res. Res. Res. ECCC Res. OPTLOCK Res. 30
0
0
0
0
Res. Res. Res. Res. ECCD2 SECINV Res. Res. 29
0
0
0
1
0
Res. Res. Res. PA15_PUPEN ECCC2 Res. Res. Res. 28
1
1
1
1
0
Res. Res. Res. nBOOT0 Res. Res. OBL_LAUNCH Res. 27
1
0
0
1
Embedded Flash memory (FLASH)
0
1
0
1
0
Res. Res. Res. SRAM2_RST Res. SECERRIE NSERRIE Res. 25
0
1
0
1
0
0
Res. Res. Res. SRAM2_PE ECCCIE SECEOPIE NSEOPIE Res. 24
0
1
0
Res. Res. Res. Res. Res. Res. Res. Res. 23
0
0
1
0
1
0
1
0
DBANK SYSF_ECC Res. Res. Res. 22
0
0
1
0
1
0
1
0
DB256K BK_ECC Res. Res. Res. 21
0
0
1
0
1
0
0
0
SWAP_BANK Res. Res. Res. 20
0
0
1
0
1
0
1
0
WWDG_SW Res. Res. Res. 19
0
0
1
0
0
0
1
0
IWDG_STDBY Res. Res. Res. 18
RM0438 Rev 7
0
0
1
0
0
0
1
0
0
HDP1_PEND[6:0]
IWDG_STOP Res. OPTSTRT Res. 17
WRP1A_PEND[6:0]
NSBOOTADD1[24:0]
NSBOOTADD0[24:0]
SECWM1_PEND[6:0]
SECBOOTADD0[24:0]
0
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
1
Res. Res. Res. nRST_SHDW 0 Res. Res. Res. 14
0
0
0
1
0
Res. Res. Res. nRST_STDBY Res. Res. Res. 13
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
ADDR_ECC[20:0]
0
0
0
1
0
0
1 1
0 0
0 0
1 1
0 0
0 0
1
0
0
WRP1A_PSTRT[6:0]
0
1 0
0 0
0 0
0 0
1 1
0 0
0 0
SECWM1_PSTRT[6:0]
RM0438
Table 51. 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
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
FLASH_WRP1BR WRP1B_PEND[6:0] WRP1B_PSTRT[6:0]
0x5C
ST production value 0 0 0 0 0 0 0 1 1 1 1 1 1 1
FLASH_ Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
SECWM2_PEND[6:0] SECWM2_PSTRT[6:0]
SECWM2R1
0x60
ST production value 1 1 1 1 1 1 1 0 0 0 0 0 0 0
HDP2EN
FLASH_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
HDP2_PEND[6:0]
SECWM2R2
0x64
ST production value 1 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.
FLASH_WRP2AR WRP2A_PEND[6:0] WRP2A_PSTRT[6:0]
0x68
ST production value 0 0 0 0 0 0 0 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.
FLASH_WRP2BR WRP2B_PEND[6:0] WRP2B_PSTRT[6:0]
0x6C
ST production value 0 0 0 0 0 0 0 1 1 1 1 1 1 1
0x80 + 4 FLASH_
SECBB1[y]
SECBB1Rx
*(x - 1),
(x=1..4) 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
0xA0 + 4 FLASH_
SECBB2[y]
SECBB2Rx
*(x - 1),
(x=1..4) 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
HDP2_ACCDIS
HDP1_ACCDIS
FLASH_
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.
SECHDPCR
0xC0
Reset value 0 0
FLASH_
PRIV
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.
0xC4 PRIVCFGR
Reset value 0
7.1 Introduction
The instruction cache (ICACHE) is introduced on C-AHB code bus of Cortex-M33 processor
to improve performance when fetching instruction and data from both internal and external
memories.
Some specific features like dual master port, hit-under-miss and critical-word-first refill
policy, allow close to zero wait states performance in most use cases.
Number of ways 2
Cache size 8 Kbytes
Cache line width 16 bytes
range granularity of memory regions to be remapped 2 Mbytes
Number of regions to remap 4
Data size of AHB fast master1 interface 32 bits
Data size of AHB slow master2 interface 32 bits
Configuration
AHB
slave port
Configuration interface
Region 0 cfg Region 2 cfg Hit monitor Control
Master1
port
Execution port interface
Main AHB
port Cache
C-AHB
FSM
AHB
Master2
port
pLRU-t REMAP
AHB
IT Icache
Cache Cache
TAG data
memories memories
ICACHE n ways n ways
MSv48191V2
way selection
pLRU-t (for replacement)
n ways n ways
T-bit l-bit
==
== Cache hit/miss, in Way(n-1)
Cache hit/miss, in Way0
MSv48192V2
All cache operations (such as read, refill, remapping, invalidation) remain the same in direct
mapped configuration; the only difference is the absence of a replacement algorithm in case
of line eviction (as explained in Section 7.4.8), since only one way (the unique one) is
possible for any data refill.
The remapping functionality is available also for non-cacheable traffic and when cache is
disabled.
Further details on address remapping are provided in Section 7.4.7.
An incoming memory request to ICACHE is defined as cacheable according to its AHB
transaction memory lookup attribute, as shown in Table 55. This AHB attribute depends on
the MPU programming for the addressed region.
1 Cacheable
0 Non cacheable
In case of non cacheable access, ICACHE is bypassed, meaning that the AHB transaction
is propagated unchanged to the master output port, except the transaction address which
may be modified due to the address remapping feature (see Section 7.4.7).
The bypass, and eventual remap logic, does not increase the latency of the access to the
targeted memory.
In case of cacheable access, the ICACHE behaves as explained in Section 7.4.8.
Cacheable memory regions are defined and programmed by the user in the memory
protection unit (MPU), that is responsible for the generation of the AHB attribute signals for
any transaction addressing a given region.
Table 56 summarizes product memories programmable configurations.
Each region x can be individually enabled with the REN bit in ICACHE_CRRx. Once
enabled, the remap operation occurs even if ICACHE is disabled or if the transaction is not
cacheable.
Remap regions can have different size: each region size can be programmed in the RSIZE
field of its ICACHE_CRRx register. The size of each region is a power of two multiple of
range granularity (2 Mbytes), with a minimum region size of 2 Mbytes and a maximum
region size of 128 Mbytes.
The address remapping mechanism is based on the matching of an incoming AHB address
(HADDR_in) with a given Code sub-region base address, and the modification of this
address into its (remapped) external physical address, as follows:
• HADDR_in belongs to region x if HADDR_in[31:RI] = 000:BASEADDR[28:RI], where:
– 000:BASEADDR is the code sub-region base address programmed in the
BASEADDR field of ICACHE_CRRx.
– RI defines the number of significant bits to consider. RI = log2(region size) with a
minimum value of 21 (for a 2-Mbyte region) and a maximum value of 27
(for a 128-Mbyte region)
• If region x is enabled, the master port output AHB address (HADDR_out) is then
composed by concatenating the two below parts:
– REMAPADDR[31:RI] field of ICACHE_CRRx as MSBs
– HADDR_in[RI-1:0] as LSBs.
The figure below describes the matching and the output address generation.
31 RI RI-1 0
HADDR_in
REMAPADDR[31:RI]
Address in region x
000:BASEADDR[28:RI] == 0 1
31 RI RI-1 0
HADDR_out HADDR_in[RI-1:0]
MSv48194V2
The table below summarizes all possible configurations of BASEADDR and REMAPADDR
sizes (number of significant MSBs) in ICACHE_CRRx, depending on RSIZE.
Table 57. ICACHE remap region size, base address and remap address
Region size (Mbytes) Base address size (MSBs) Remap address (MSBs)
2 8 11
4 7 10
8 6 9
16 5 8
32 4 7
Table 57. ICACHE remap region size, base address and remap address (continued)
Region size (Mbytes) Base address size (MSBs) Remap address (MSBs)
64 3 6
128 2 5
Once Boot is finished, ICACHE can be enabled (software setting the EN bit to 1 in
ICACHE_CR).
ICACHE also propagates all AHB bus errors (such as security issues, address decoding
issues) from master1 or master2 port back to the execution port.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
MISSMRST
MISSMEN
HITMRST
HITMEN
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
CACHEINV
WAYSEL
EN
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw w 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
BSYENDF
BUSYF
ERRF
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
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
BSYENDIE
ERRIE
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
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
CBSYENDF
CERRF
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
w w
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
HITMON[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
HITMON[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
MISSMON[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
HBURST
MSTSEL
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
REN Res. Res. Res. RSIZE[2:0] Res. BASEADDR[28:21]
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
MISSMRST
CACHEINV
MISSMEN
HITMRST
WAYSEL
HITMEN
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.
ICACHE_CR
EN
0x000
Reset value 0 0 0 0 1 0 0
BSYENDF
BUSYF
ERRF
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.
ICACHE_SR
0x004
Reset value 0 0 1
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
BSYENDIE
ERRIE
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.
ICACHE_IER
0x008
Reset value 0 0
CBSYENDF
CERRF
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.
ICACHE_FCR
0x00C
Reset value 0 0
ICACHE_
HITMON[31:0]
0x010 HMONR
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
ICACHE_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
MISSMON[15:0]
0x014 MMONR
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x018 to
Reserved Reserved
0x01C
RSIZE[2:0]
HBURST
MSTSEL
REN
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
ICACHE_CRR0 REMAPADDR[31:21] BASEADDR[28:21]
0x020
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
RSIZE[2:0]
HBURST
MSTSEL
REN
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
ICACHE_CRR1 REMAPADDR[31:21] BASEADDR[28:21]
0x024
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
RSIZE[2:0]
HBURST
MSTSEL
REN
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
ICACHE_CRR2 REMAPADDR[31:21] Res. BASEADDR[28:21]
0x028
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
RSIZE[2:0]
HBURST
MSTSEL
REN
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 1 0 0 0 0 0 0 0
When the VREF+ is double-bonded with VDDA in a package, the internal voltage
reference buffer is not available and must be kept disable (refer to related device
datasheet for packages pinout description).
VREF- must always be equal to VSSA.
In the STM32L552xx and STM32L562xx devices, the I/Os, the embedded LDO regulator
and the system analog peripherals (such as PLLs and reset block) are fed by VDD supply
source. The embedded linear voltage regulator is used to supply the internal digital power
VCORE. VCORE is the power supply for digital peripherals and memories.
VDDA domain
2 x A/D converters
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
VDD domain
VDDIO1 I/O ring
Reset block
Temp. sensor
VCORE domain
3 x PLL, HSI, MSI
VCORE domain
Standby circuitry Core
VSS (Wakeup logic,
IWDG) SRAM1
VDD SRAM2
VCORE (1)
MR Digital
peripherals
SPMS LPR
Flash memory
Backup domain
LSE crystal 32 K osc
VBAT
BKP registers
RCC BDCR register
RTC
unused block
MSv49301V2
In the STM32L552xxxP and STM32L562xxxP devices, the I/Os and system analog
peripherals (such as PLLs, and reset block) are fed by VDD supply source. The VCORE,
power supply for digital peripherals and memories is generated from external SMPS.
VDDA domain
2 x A/D converters
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
VDD domain
VDDIO1 I/O ring
Reset block
Temp. sensor
3 x PLL, HSI, MSI VCORE domain
Standby circuitry
VSS (Wakeup logic, Core
IWDG)
VDD SRAM1
VCORE SRAM2
MR
Digital
peripherals
SMPS LPR
Backup domain
LSE crystal 32 K osc
VBAT
BKP registers
RCC BDCR register
RTC
unused blocks
MSv49336V2
1. If the selected package has the external SMPS option but no external SMPS is used by the application (the
embedded LDO is used instead), the VDD12 pins are kept unconnected.
2. VDD12 is intended to be connected with external SMPS (switched-mode power supply) to generate the
VCORE logic supply in Run, Sleep and Stop 0 modes only.
In the STM32L552xxxQ and STM32L562xxxQ devices, the I/Os, the embedded SMPS step
down converter and the system analog peripherals (such as PLLs and reset block) are fed
by VDD supply source. The embedded linear main voltage regulator that provides the VCORE
supply for digital peripherals and memories is fed by the SMSP step down converter output.
VDDA domain
2 x A/D converters
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
VDD domain
VDDIO1 I/O ring
Reset block
Temp. sensor
3 x PLL, HSI, MSI
VCORE domain
VCORE domain
Standby circuitry Core
VSS (Wakeup logic,
IWDG) SRAM1
VDD SRAM2
VCORE
2 x V15SMPS MR Digital
VLXSMPS peripherals
VDDSMPS SMPS
(1)(2) LPR
VSSSMPS
Flash memory
Low voltage detector
Backup domain
LSE crystal 32 K osc
VBAT
BKP registers
RCC BDCR register
RTC
MSv49332V2
1. Refer to Figure 24 for SMPS step down converter power supply scheme.
2. During Low-power sleep, Low-power run, Stop 1, Stop 2, Standby and Shutdown modes, the SMPS step
down converter is switched to Open mode. In Low-power sleep, Low-power run, Stop 1, Stop 2 and
Standby with SRAM2 retention modes, the low-power regulator is used to provide the VCORE.
The SMPS is used in Run, Sleep and Stop 0 modes. It supplies the main regulator which provides the
VCORE.
Note: If the selected package has the SMPS step down converter option but the SMPS is not used
by the application (and the embedded LDO is used instead), it is recommended to set the
SMPS power supply pins as follows:
- VDDSMPS and VLXSMPS connected to VSS
- V15SMPSconnected to VDD.
After reset, the USB features supplied by VDDUSB are logically and electrically isolated and
therefore are not available. The isolation must be removed before using the USB peripheral,
by setting the USV bit in the PWR_CR2 register, once the VDDUSB supply is present.
The VDDUSB supply is monitored by the peripheral voltage monitoring (PVM1) and
compared with the internal reference voltage (VREFINT, around 1.2 V), refer to Section 8.3.3:
Peripheral voltage monitoring (PVM) for more details.
The following table summarizes the SMPS behavior depending on the main regulator
range, VDD and consumption.
HP mode
Automatic Bypass mode
Range 0 110 MHz 1.28 V Max current consumption = 120 mA
V15SMPS = VDD
V15SMPS = 1.6 V
HP mode
Automatic Bypass mode
Range 1 80 MHz 1.2 V Max current consumption = 80 mA
V15SMPS = VDD
V15SMPS = 1.5 V
Software Bypass LP mode or HP mode
Range 2 26 MHz 1.0 V mode(1) Max current consumption = 30 mA
V15SMPS = VDD V15SMPS = 1.3 V
1. There is no automatic SMPS bypass in Range 2. The user application should use PVD0 to monitor VDD supply and request
the SMPS Bypass mode.
0 0 1 High-power mode
0 1 0 Low-power mode
1 x x Bypass mode
VDD VDDSMPS
VLXSMPS SMPS
Step Down
Converter
V15SMPS
V15SMPS VCORE
Main
VSSSMPS VDD regulator
VSS
MSv49346V1
If the selected package is with the SMPS step down converter option but it is never used by
the application, it is recommended to set the SMPS power supply pins as follows:
• VDDSMPS and VLXSMPS connected to VSS
• V15SMPSconnected to VDD
Note: It is recommended to enable the SMPS bypass mode prior entering Stop modes in order to
reduce the wake up time.
Note: If the Bypass mode is requested, entering Stop 1 or Stop 2 or Low-power run or Low-power
sleep modes shall be delayed until the SMPS BYPASS ready flag SMPSBYPRDY is set.
Note: In Low-power run mode, the following bits shall not be modified (PWR_CR4: SMPSLPEN,
SMPSFSTEN, SMPSBYP).
VDD12 pins correspond to the internal VCORE powering the digital part of Core, RAMs,
FLASH and peripherals. This significantly improves the power consumption with a gain from
50% or more depending of the external SMPS performances.
The main benefit occurs in Run and Sleep modes whereas in Stop 0 mode, the gain is less
significant.
The figure below shows a schematic to understand how the internal regulator stops
supplying VCORE when an external voltage VDD12 is provided.
As VDD12 shares the same pin as output of the internal regulator, applying a slightly higher
voltage (typically +50 mV) on the VDD12 blocks, the PMOS and the regulator consumption
is negligible.
VDD
PMOS
Switch VCORE
VDD12
Vsmps
Voltage regulator
Ref
MSv44809V1
A switch, controlled by the chosen GPIO, is inserted between the external SMPS output and
VDD12.
There are two possible states:
• Connected: Switch is closed so external SMPS powers VDD12
• Disconnected: Switch is open and VDD12 is disconnected from external SMPS output
Proper software management through GPIOs to enable/disable external SMPS and to
connect/disconnect external SMPS through the switch, is required to conform with the rules
described below. See also Section 8.2.5: Dynamic voltage scaling management.
It is mandatory to respect the following rules to avoid any damage or instability on either
digital parts or internal regulators:
• In Run, Sleep and Stop 0 modes, VDD12 can be connected and should respect
– VDD12 < 1.32 V
– VDD12 ≥ VCORE + 50 mV giving for main regulator
Range 0, VCORE =1.28 V so VDD12 should be greater than 1.33 V, but this cannot
match previous rule VDD12 < 1.32 V, so it is not a functional use case with an
external SMPS.
Range 1, VCORE = 1.2 V so VDD12 should be greater than 1.25 V.
Range 2, VCORE = 1.0 V so VDD12 should be greater than 1.05 V
– VDD12 ≥ 1.08 V in Range 1 when 80 MHz ≥ SYSCLK frequency ≥ 26 MHz
– VDD12 ≥ 1.14 V in Range 0 when SYSCLK frequency > 80 MHz
• In all other modes, such as LPRun, LPSleep, Stop 1, Stop 2, Standby and Shutdown
modes, VDD12 must be disconnected from external SMPS output. This means that the
pin must be connected to a high impedance output:
– VDD12 connected to HiZ (voltage is provided by internal regulators)
• Transitions of VDD12 from connected to disconnected is only allowed when SYSCLK
frequency ≤ 26 MHz to avoid to big voltage drop on main regulator side.
Note: In case of asynchronous reset while having the VDD12 ≤ 1.25 V, VDD12 should switch to HiZ
in less than regulator switching time from Range 2 to Range 1 (~1 us).
Note: VDD12 Range 2 is extended down to 1.00 V for better efficiency, thus following formula
applies when bit EXTSMPSEN in the Power control register 4 (PWR_CR4) is set:
Range 2, VCORE = 0.95 V so VDD12 should be greater than 1.00 V
Note: For more details on VDD12 management, refer to AN4978 “Design recommendations for
STM32L4xxxx with external SMPS, for ultra-low-power applications with high performance”.
For Stop 2 mode, the BOR Ultra-low-power mode can be set if the BORH is set, otherwise
there is no power consumption optimization.
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)
The monitoring is enabled during the PWM high level and disabled during the PWM low
level.
Note: For threshold value, refer to the product datasheet.
Note: In case the VDD is below the functional range, a Brown-out reset is generated.
MS33361V2
LPMS=”011” +
Clear RRS bits +
Standby SLEEPDEEP bit + OFF OFF
WFI or Return
from ISR or WFE
LPMS=”1--” + WKUP pin edge,
SLEEPDEEP bit + RTC event, All clocks OFF except
Shutdown MSI 4 MHz OFF OFF
WFI or Return external reset in LSE
from ISR or WFE NRST pin
Wakeup capability
Wakeup capability
Wakeup capability
Wakeup capability
Low- Low-
Peripheral Run Sleep power power VBAT
run sleep - - - -
CPU Y - Y - - - - - - - - - -
Flash memory
O(2) O(2) O(2) O(2) - - - - - - - - -
(2 Mbytes)
SRAM1
Y Y(3) Y Y(3) Y - Y - - - - - -
(192 Kbytes)
SRAM2 (64 Kbytes) Y Y(3) Y Y(3) Y - Y - O(4) - - - -
FSMC O O O O - - - - - - - - -
OctoSPI O O O O - - - - - - - - -
OTFDEC O O O O - - - - - - - - -
Backup registers Y Y Y Y Y - Y - Y - Y - Y
Brownout reset
Y Y Y Y Y Y Y Y Y Y - - -
(BOR)
Programmable
voltage detector O O O O O O O O - - - - -
(PVD)
Peripheral voltage
monitor (PVMx; O O O O O O O O - - - - -
x=1,2,3,4)
DMA O O O O - - - - - - - - -
High speed internal (5) (5)
O O O O - - - - - - -
(HSI16)
-
Oscillator HSI48 O O - - - - - - - - - -
High speed external
O O O O - - - - - - - - -
(HSE)
Low speed internal
O O O O O - O - O - - - -
(LSI)
Low speed external
O O O O O - O - O - O - O
(LSE)
Multi speed internal
O O O O - - - - - - - - -
(MSI)
Clock security
O O O O - - - - - - - - -
system (CSS)
Clock security
O O O O O O O O O O - - -
system on LSE
Wakeup capability
Wakeup capability
Wakeup capability
Wakeup capability
Low- Low-
Peripheral Run Sleep power power VBAT
run sleep - - - -
VDD voltage
monitoring,
O O O O O O O O O O - - -
temperature
monitoring
RTC / TAMP O O O O O O O O O O O O O
Number of RTC
8 8 8 8 8 O 8 O 8 O 8 O 3
Tamper pins
USB, UCPD O(8) O(8) - - - O - - - - - - -
USARTx
O O O O O(6) O(6) - - - - - - -
(x=1,2,3,4,5)
Low-power UART
O O O O O(6) O(6) O(6) O(6) - - - - -
(LPUART)
I2Cx (x=1,2,4) O O O O O(7) O(7) - - - - - - -
(7)
I2C3 O O O O O O(7) O(7) O(7) - - - - -
SPIx (x=1,2,3) O O O O - - - - - - - - -
FDCAN1 O O O O - - - - - - - - -
SDMMC1 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 - - - - -
Temperature
O O O O - - - - - - - - -
sensor
Timers (TIMx) O O O O - - - - - - - - -
Low-power timer 1,
3 (LPTIM1 and O O O O O O O O - - - - -
LPTIM3)
Low-power timer 2
O O O O O O - - - - - - -
(LPTIM2)
Wakeup capability
Wakeup capability
Wakeup capability
Wakeup capability
Low- Low-
Peripheral Run Sleep power power VBAT
run sleep - - - -
Independent
O O O O O O O O O O - - -
watchdog (IWDG)
Window watchdog
O O O O - - - - - - - - -
(WWDG)
SysTick timer O O O O - - - - - - - - -
Touch sensing
O O O O - - - - - - - - -
controller (TSC)
Random number
O(8) O(8) - - - - - - - - - - -
generator (RNG)
AES hardware
O O O O - - - - - - - - -
accelerator
HASH hardware
O O O O - - - - - - - - -
accelerator
PKA O O O O - - - - - - - - -
CRC calculation
O O O O - - - - - - - - -
unit
5 5
(9) (11)
GPIOs O O O O O O O O pins pins -
(10) (10)
1. Legend: Y = yes (enable). O = optional (disable by default, can be enabled by software). - = not available.
Gray cells highlight the wakeup capability in each mode.
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. 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. UART and LPUART reception is functional in Stop mode, and generates a wakeup interrupt on Start, address match or
received frame event.
7. I2C address detection is functional in Stop mode, and generates a wakeup interrupt in case of address match.
8. Voltage scaling range 1 only.
9. I/Os can be configured with internal pull-up, pull-down or floating in Standby mode.
10. The I/Os with wakeup from standby/shutdown capability are: PA0, PC13, PE6, PA2, PC5.
11. I/Os can be configured with internal pull-up, pull-down or floating in Shutdown mode but the configuration is lost when
exiting the Shutdown mode.
Debug mode
By default, the debug connection is lost if the application puts the MCU in Stop 0, Stop 1,
Stop 2, Standby or Shutdown mode while the debug features are used. This is due to the
fact that the Cortex®-M33 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 52.2.5: Debug and low-power modes.
when enabled the NVIC peripheral IRQ channel pending bit (in the NVIC interrupt
clear pending register) have to be cleared.
All NVIC interrupts wakes up the MCU, even the disabled ones. Only enabled
NVIC interrupts with sufficient priority wake up 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 exits the 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 395: RTC block diagram).
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 69: 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 39.3: IWDG functional description.
• Real-time clock (RTC): this is configured by the RTCEN bit in the RCC Backup domain
control register (RCC_BDCR).
• Internal RC oscillator (LSI): LSI clock or LSI clock divided by 128, this is configured by
the LSION and LSIPRE bits in the RCC control/status register (RCC_CSR).
• External 32.768 kHz oscillator (LSE): this is configured by the LSEON bit in the RCC
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.
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 RCC 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 0, Range 1 or Range 2
depending on VOS bit in PWR_CR1).
SRAM1 and register contents are lost except for registers in the Backup domain and
Standby circuitry (see Figure 21). SRAM2 content can be can be partially or fully preserved
depending on RRS[1:0] bits configuration in PWR_CR3. 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.
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 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 are 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 11.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 is 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 are applied until the bit APC is cleared, releasing the
PWR_PUCRx or PWR_PDCRx programmed value.
configured in floating state or to their pull-up pull-down reset value (for some I/Os listed in
Section 11.3.1: General-purpose I/O (GPIO)).
The PWR TrustZone security allows to secure the following features through the security
configuration register PWR_SECCFGR:
• Low-power mode
• Wake-up (WKUP) pins
• Voltage detection and monitoring
• VBAT mode
Other PWR configuration bits are secure when:
• The system clock selection is secure in RCC, the voltage scaling (VOS) configuration is
secure
• A GPIO is configured as secure, its corresponding bit for Pull-up/Pull-down
configuration in Standby mode is secure
• The RTC is secure, the backup domain write protection DBP bit in PWR_CR1 register
is secure.
• The UCPD is secure, the UCPD_DBDIS and UCPD_STDBY bits are secure in the
PWR_CR3 register.
Table 74 gives a summary of the PWR secured bits following the security configuration bit in
the PWR_SECCFGR register. When one security configuration bit is set, some
configuration bits are secured. The PWR registers may contain secure and non-secure bits:
• Secured bits: read and write operations are only allowed by a secure access. Non-
secure read or write accesses are RAZ/WI. There is no illegal access event generated.
• Non-secure bits: no restriction. Read and write operations are allowed by both secure
and non-secure accesses.
A non-secure write access to PWR_SECCFGR register is WI and generates an illegal
access event. An illegal access interrupt is generated if the PWR illegal access interrupt is
enabled in the TZIC_IER2 register. There is no restriction for non-secure read access.
When the TrustZone security is disabled (TZEN = 0 in FLASH_OPTR register), all registers
are non-secure. The PWR_SECCFGR secure register and security status registers are
RAZ/WI.
.
Read is OK.
PWR_SECCFGR NA(1) - PWR_SECCFGR WI and illegal
access event
Read is OK.
PWR_SECCFGR At least one bit is set PRIV PWR_PRIVCFGR WI and illegal
access event(2)
LPMS[1:0],
PWR_CR1
LPR RAZ/WI
LPMSEC RRS[1:0] PWR_CR3
CSBF,
PWR_SCR WI
CWUFx
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. Res. Res. LPMS[2:0]
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
UCPD_ UCPD_ ULPM
Res. Res. APC RRS[1:0] Res. Res. Res. EWUP5 EWUP4 EWUP3 EWUP2 EWUP1
DBDIS STDBY EN
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
EXTS
SMPSL SMPS SMPS
MPSE Res. Res. VBRS VBE Res. Res. Res. WUPP5 WUPP4 WUPP3 WUPP2 WUPP1
PEN FSTEN BYP
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
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
SMPS EXTS SMPS
HPRD Res. MPSR BYPR Res. Res. Res. SBF Res. Res. Res. WUF5 WUF4 WUF3 WUF2 WUF1
Y DY DY
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
PVMO PVMO PVMO PVMO REGLP REGLP
PVDO VOSF Res. Res. Res. Res. Res. Res. Res. Res.
4 3 2 1 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
Res. Res. Res. Res. Res. Res. Res. CSBF Res. Res. Res. CWUF5 CWUF4 CWUF3 CWUF2 CWUF1
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 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
This register is not reset when exiting Standby modes and with PWRRST bit in the
RCC_APB1RSTR1 register.
Address offset: 0x24.
Reset value: 0x0000 0000
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
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
Access: Additional APB cycles are needed to access this register vs. a standard APB
access (3 for a write and 2 for a read).
This register is not reset when exiting Standby modes and with PWRRST bit in the
RCC_APB1RSTR1 register.
Address offset: 0x4C.
Reset value: 0x0000 0000
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
APCSE VDMSE LPMSE WUP5S WUP4S WUP3S WUP2S WUP1S
Res. Res. Res. Res. VBSEC Res. Res. Res.
C C C EC EC EC EC EC
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. Res. PRIV
rw
0x0C
Offset
8.6.26
324/2194
PWR_SR2
PWR_SR1
PWR_CR4
PWR_CR3
PWR_CR2
PWR_CR1
PWR_SCR
reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
PWR_PUCRB
PWR_PDCRA
PWR_PUCRA
Register name
Power control (PWR)
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 31
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 30
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 29
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 28
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 27
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 26
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 25
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 24
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 23
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 22
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 21
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 20
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 19
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 18
PWR register map and reset values
RM0438 Rev 7
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 17
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 16
0
PU15 PD15 PU15 Res. PVMO4 SMPSHPRDY SMPSLPEN Res. Res. Res. 15
0
PU14 PD14 PU14 Res. PVMO3 Res. SMPSFSTEN UCPD_DBDIS Res. LPR 14
0 0
PU13 PD13 PU13 Res. PVMO2 EXTSMPSRDY EXTSMPSEN UCPD_STDBY Res. Res. 13
0 0
0 0 0 0
PU12 PD12 PU12 Res. PVMO1 SMPSBYPRDY SMPSBYP Res Res. Res. 12
Table 75. PWR register map and reset values
PU11 PD11 PU11 Res. PVDO Res. Res. ULPMEN Res. Res. 11
PU10 PD10 PU10 Res. VOSF Res. Res. APC USV 10
VOS [1:0]
0 0
0
0 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 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0
0
RM0438
0x5C
0x4C
0x3C
0x2C
Offset
RM0438
GR
GR
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
Reset value
Reset value
PWR_SECCF
PWR_PDCRF
PWR_PUCRF
PWR_PDCRE
PWR_PUCRE
PWR_PDCRB
PWR_PDCRH
PWR_PUCRH
PWR_PDCRD
PWR_PUCRD
PWR_PDCRC
PWR_PUCRC
PWR_PDCRG
PWR_PUCRG
PWR_PRIVCF
Register name
Res. Res. 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. Res. Res. 30
Res. Res. 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. Res. Res. 28
Res. Res. 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. Res. Res. 26
Res. Res. 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. Res. Res. 24
Res. Res. 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. Res. Res. 22
Res. Res. 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. Res. Res. 20
Res. Res. 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. Res. Res. 18
RM0438 Rev 7
Res. Res. 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. Res. Res. 16
Res. Res. PD15 PU15 PD15 PU15 PD15 PU15 PD15 PU15 PD15 PU15 PD15 PU15 PD15 15
Res. Res. PD14 PU14 PD14 PU14 PD14 PU14 PD14 PU14 PD14 PU14 PD14 PU14 PD14 14
Res. Res. PD13 PU13 PD13 PU13 PD13 PU13 PD13 PU13 PD13 PU13 PD13 PU13 PD13 13
Res. Res. PD12 PU12 PD12 PU12 PD12 PU12 PD12 PU12 PD12 PU12 PD12 PU12 PD12 12
Res. APCSEC PD11 PU11 PD11 PU11 PD11 PU11 PD11 PU11 PD11 PU11 PD11 PU11 PD11 11
Res. VBSEC PD10 PU10 PD10 PU10 PD10 PU10 PD10 PU10 PD10 PU10 PD10 PU10 PD10 10
Res. VDMSEC PD9 PU9 PD9 PU9 PD9 PU9 PD9 PU9 PD9 PU9 PD9 PU9 PD9 9
Table 75. PWR register map and reset values (continued)
0 0 0 0
Res. LPMSEC PD8 PU8 PD8 PU8 PD8 PU8 PD8 PU8 PD8 PU8 PD8 PU8 PD8 8
Res. Res. PD7 PU7 PD7 PU7 PD7 PU7 PD7 PU7 PD7 PU7 PD7 PU7 PD7 7
Res. Res. PD6 PU6 PD6 PU6 PD6 PU6 PD6 PU6 PD6 PU6 PD6 PU6 PD6 6
Res. Res. PD5 PU5 PD5 PU5 PD5 PU5 PD5 PU5 PD5 PU5 PD5 PU5 PD5 5
Res. WUP5SEC PD4 PU4 PD4 PU4 PD4 PU4 PD4 PU4 PD4 PU4 PD4 PU4 PD4 4
Res. WUP4SEC PD3 PU3 PD3 PU3 PD3 PU3 PD3 PU3 PD3 PU3 PD3 PU3 PD3 3
Res. WUP3SEC PD2 PU2 PD2 PU2 PD2 PU2 PD2 PU2 PD2 PU2 PD2 PU2 PD2 2
Res. WUP2SEC PD1 PU1 PD1 PU1 PD1 PU1 PD1 PU1 PD1 PU1 PD1 PU1 PD1 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 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0
0
0
Power control (PWR)
325/2194
PRIV WUP1SEC PD0 PU0 PD0 PU0 PD0 PU0 PD0 PU0 PD0 PU0 PD0 PU0 PD0
326
Power control (PWR) RM0438
9.1 Reset
There are three types of reset:
• a system reset
• a power reset
• a Backup domain reset
In case on an internal reset, the internal pull-up RPU is deactivated in order to save the
power consumption through the pull-up resistor.
VDD
RPU
System reset
External
reset Filter
NRST WWDG reset
IWDG reset
Pulse Software reset
generator
(min 20 μs) Low-power manager reset
Option byte loader reset
POR
MSv40966V2
Software reset
The SYSRESETREQ bit in Cortex®-M33 application interrupt and reset control register
must be set to force a software reset on the device.
NRST I/O System reset, can be used to provide reset to external devices
OSC32_IN I 32 kHz oscillator input
OSC32_OUT O 32 kHz oscillator output
OSC_IN I System oscillator input
OSC_OUT O System oscillator output
MCO1 O Output clock 1 for external devices
SAI1_EXTCLK I External kernel clock input for SAI1 digital audio interface
SAI2_EXTCLK I External kernel clock input for SAI2 digital audio interface
9.3 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) that 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) that 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, APB1 and APB2 domains is 110 MHz.
All the peripheral clocks are derived from their bus clock (HCLK, PCLK1 or PCLK2) except
the following ones:
• The 48 MHz clock used for USB FS, SDMMC and RNG, is derived from one of the
following sources (selected by software):
– 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 FS
device.
When available, the HSI48 clock can be coupled to the clock recovery system (CRS)
allowing adequate clock connection for the USB FS (crystal less solution).
• The ADCs clock is derived from one of the following sources (selected by software):
– system clock (SYSCLK)
– PLLSAI1 VCO (PLLADC1CLK)
• The U(S)ARTs clocks are derived from one of the following sources (selected by
software):
– system clock (SYSCLK)
– HSI16 clock
– LSE clock
– APB1 or APB2 clock (PCLK1 or PCLK2, depending on which APB is mapped to
the U(S)ART)
The wakeup from Stop mode is supported only when the clock is HSI16 or LSE.
• The I2Cs clocks are derived from one of the following sources (selected by software):
– 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 are derived from one of the following sources (selected by
software):
– 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 from one of the following sources (selected
by software):
– SAI1 clock
– HSI clock
– MSI clock
• The OCTOSPI kernel clock is derived from one of the following sources (selected by
software):
– system clock
– PLL48M1CLK
– MSI clock
• The FDCAN kernel clock is derived from one of the following sources (selected by
software):
– PLL48M1CLK
– PLLSAI1CLK
– HSE clock
• The low-power timers (LPTIMx) clocks are derived from one of the following sources
(selected by software):
– 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 is derived from one of the following sources (selected by software):
– 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 32 kHz clock.
• The UCPD kernel clock is derived from HSI16 clock. The HSI16 RC oscillator must be
enabled prior enabling the UCPD.
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®-M33 free-running clock.
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
48 SDMMC clock
HSI16 MSI MHz
48 MHz clock to USB, RNG
SYSCLK
to ADC
FDCAN HSI16
To UCPD1
MSI HSE
HSI16 MSI
/M
PLLSAI2 HSE HSI16
/P PLLSAI2CLK DFSDM
audio clock
/Q
HSI16 to SAI1
/R
SAI1_EXTCLK
to SAI2
SAI2_EXTCLK
MSv49302V3
1. For full details about the internal and external clock source characteristics, refer to the Electrical characteristics section in
the 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’.
OSC_IN OSC_OUT
External clock
GPIO
External
source
OSC_IN OSC_OUT
Crystal/Ceramic
resonators
CL1 CL2
Load
capacitors
Calibration
The RC oscillator frequencies may 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 RCC internal
clock sources calibration register (RCC_ICSCR).
If the application is subject to voltage or temperature variations this may affect the RC
oscillator speed. The HSI16 frequency can be trimmed in the application using the
HSITRIM[6:0] in the RCC internal clock sources calibration register (RCC_ICSCR).
For more details on how to measure the HSI16 frequency variation, refer to Section 9.3.18:
Internal/external clock measurement with TIM15/TIM16/TIM17.
The HSIRDY flag in the RCC 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 RCC 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 9.3.11: Clock security system (CSS) on page 339.
Software calibration
The MSI RC oscillator frequency may 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 = 25 °C. After reset, the factory calibration value is loaded in the
MSICAL[7:0] bits in the RCC 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 9.3.18: Internal/external clock measurement with
TIM15/TIM16/TIM17.
9.3.5 PLL
The device embeds three PLLs: PLL, PLLSAI1 and 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 for each PLL is divided by a dedicated programmable factor PLLM,
PLLSAI1M, PLLSAI2M, from 1 to 8 to provide a clock frequency in the requested input
range. Refer to Figure 30: Clock tree, RCC PLL configuration register (RCC_PLLCFGR),
RCC PLLSAI1 configuration register (RCC_PLLSAI1CFGR) and RCC PLLSAI2
configuration register (RCC_PLLSAI2CFGR).
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 clearing PLLON to 0 in RCC clock control register (RCC_CR).
2. Wait until PLLRDY bit is cleared. The PLL is now fully stopped.
3. Change the desired parameter.
4. Enable the PLL again by setting PLLON bit to 1.
5. Enable the desired PLL outputs by configuring PLLPEN, PLLQEN, PLLREN bits in
RCC PLL configuration register (RCC_PLLCFGR).
An interrupt can be generated when the PLL is ready, if enabled in the RCC clock interrupt
enable register (RCC_CIER).
The same procedure is applied for changing the configuration of PLLSAI1 or PLLSAI2:
1. Disable the PLLSAI1/PLLSAI2 by clearing PLLSAI1ON/PLLSAI2ON to 0 in RCC clock
control register (RCC_CR).
2. Wait until PLLSAI1RDY/PLLSAI2RDY bit is cleared. The PLLSAI1/PLLSAI2 is now fully
stopped.
3. Change the desired parameter.
4. Enable the PLLSAI1/PLLSAI2 again by setting PLLSAI1ON/PLLSAI2ON bit to 1.
5. Enable the desired PLL outputs by configuring PLLSAI1PEN/PLLSAI2PEN,
PLLSAI1QEN, PLLSAI1REN bits in RCC PLLSAI1 configuration register
(RCC_PLLSAI1CFGR) or RCC PLLSAI2 configuration register (RCC_PLLSAI2CFGR).
The PLL output frequency must not exceed 110 MHz.
The enable bit of each PLL output clock (PLLPEN, PLLQEN, PLLREN, PLLSAI1PEN,
PLLSAI1QEN, PLLSAI1REN and PLLSAI2PEN) can be modified at any time without
stopping the corresponding PLL.
The PLLREN bit cannot be cleared if PLLCLK is used as system clock.
1. Wait the LSE clock is ready and set the LSEON and LSERDY bits in RCC Backup
domain control register (RCC_BDCR).
2. Set the LSESYSEN bit in RCC_BDCR.
3. Wait the LSESYS clock is ready and set the LSESYSRDY bit in RCC_BDCR.
In Standby mode a wakeup is generated. In other modes a TAMP interrupt can be sent to
wake up the software (see Table 310: TAMP interconnection and Section 42.5: TAMP
interrupts).
The software must then disable the LSECSSON bit, stop the defective 32 kHz oscillator
(disabling LSEON), and change the RTC clock source (no clock or LSI or HSE, with
RTCSEL), or take any required action to secure the application.
The frequency of LSE oscillator have to be higher than 30 kHz to avoid false positive CSS
detection.
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
TI1
LSI
LSE
RTC wakeup interrupt
MS33434V1
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.
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 RCC_CFGR register.
before entering Stop mode. The user trim of HSI16 is kept. If the MSI was in PLL-mode
before entering Stop mode, the PLL-mode stabilization time must be waited for after wakeup
even if the LSE was kept ON during the Stop mode.
When leaving the Standby and Shutdown modes, the system clock is MSI. The MSI
frequency at wakeup from Standby mode is configured with the MSISRANGE is the
RCC_CSR register, from 1 to 8 MHz. The MSI frequency at wakeup from Shutdown mode is
4 MHz. The user trim is lost.
If a Flash memory programming operation is on going, Stop, Standby and Shutdown modes
entry is delayed until the Flash memory interface access is finished. If an access to the APB
domain is ongoing, Stop, Standby and Shutdown modes entry is delayed until the APB
access is finished.
When the TrustZone security is disabled (TZEN = 0 in FLASH_OPTR register), all registers
are non-secure. The RCC_SECCFGR secure register and security status registers are
RAZ/WI.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PLLSAI2RDY
PLLSAI1RDY
PLLSAI2ON
PLLSAI1ON
HSERDY
HSEBYP
PLLRDY
CSSON
HSEON
PRIV Res. PLLON Res. Res. Res. Res.
rw 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
HSIKERON
MSIRGSEL
MSIPLLEN
HSIASFS
MSIRDY
HSIRDY
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
STOPWUCK
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
PLLQEN
PLLREN
PLLPEN
PLLPDIV[4:0] PLLR[1:0] Res. PLLQ[1:0] Res. Res. PLLP
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
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
PLLSAI1QEN
PLLSAI1REN
PLLSAI1PEN
PLLSAI1P
PLLSAI1PDIV[4:0] PLLSAI1R[1:0] Res. PLLSAI1Q[1:0] Res. Res.
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
PLLSAI1SRC[1:0]
Res. PLLSAI1N[6:0] PLLSAI1M[3:0] Res. 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
PLLSAI2PEN
PLLSAI2P
PLLSAI2PDIV[4:0] Res. 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
PLLSAI2SRC[1:0]
Res. PLLSAI2N[6:0] PLLSAI2M[3:0] Res. 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
PLLSAI2RDYIE
PLLSAI1RDYIE
HSI48RDYIE
HSERDYIE
LSERDYIE
PLLRDYIE
MSIRDYIE
HSIRDYIE
LSIRDYIE
Res. Res. Res. Res. Res. Res. Res.
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
PLLSAI2RDYF
PLLSAI1RDYF
HSI48RDYF
HSERDYF
LSERDYF
PLLRDYF
MSIRDYF
HSIRDYF
LSIRDYF
Res. Res. Res. Res. Res. Res. CSSF
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
PLLSAI2RDYC
PLLSAI1RDYC
HSI48RDYC
HSERDYC
LSERDYC
PLLRDYC
MSIRDYC
HSIRDYC
LSIRDYC
Res. Res. Res. Res. Res. Res. CSSC
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
TSCRST
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DMAMUX1RST
FLASHRST
DMA2RST
DMA1RST
CRCRST
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21
OTFDEC1RST 20 19 18 17 16
SDMMC1RST
HASHRST
RNGRST
PKARST
AESRST
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
GPIOGRST
GPIOHRST
GPIODRST
GPIOCRST
GPIOERST
GPIOBRST
GPIOARST
GPIOFRST
ADCRST
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
OSPI1RST
FMCRST
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
USART3RST
USART2RST
OPAMPRST
LPTIM1RST
UART5RST
UART4RST
DAC1RST
PWRRST
I2C3RST
I2C2RST
I2C1RST
CRSRST
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
TIM7RST
TIM6RST
TIM5RST
TIM4RST
TIM3RST
TIM2RST
SPI3RST
SPI2RST
rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
UCPD1RST
USBFSRST
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LPUART1RST
FDCAN1RST
LPTIM3RST
LPTIM2RST
I2C4RST
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DFSDM1RST
TIM17RST
TIM16RST
TIM15RST
SAI2RST
SAI1RST
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SYSCFGRST
USART1RST
TIM8RST
TIM1RST
SPI1RST
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
GTZCEN
TSCEN
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DMAMUX1EN
FLASHEN
DMA2EN
DMA1EN
Res. Res. Res. CRCEN Res. Res. Res. Res. Res. Res. Res. Res.
rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
OTFDEC1EN
SDMMC1EN
HASHEN
RNGEN
PKAEN
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. AESEN
rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
GPIOGEN
GPIOHEN
GPIODEN
GPIOCEN
GPIOEEN
GPIOBEN
GPIOAEN
GPIOFEN
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
OSPI1EN
FMCEN
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
USART3EN
USART2EN
OPAMPEN
LPTIM1EN
UART5EN
UART4EN
DAC1EN
PWREN
I2C3EN
I2C2EN
I2C1EN
Res. Res. Res. CRSEN 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
RTCAPBEN
WWDGEN
TIM7EN
TIM6EN
TIM5EN
TIM4EN
TIM3EN
TIM2EN
SPI3EN SPI2EN Res. Res. Res. Res. Res. Res.
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
UCPD1EN
USBFSEN
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LPUART1EN
FDCAN1EN
LPTIM3EN
LPTIM2EN
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. I2C4EN
rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DFSDM1EN
TIM17EN
TIM16EN
TIM15EN
SAI2EN
SAI1EN
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SYSCFGEN
USART1EN
TIM8EN
TIM1EN
SPI1EN
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw rw rw rw
9.8.22 RCC AHB1 peripheral clocks enable in Sleep and Stop modes register
(RCC_AHB1SMENR)
Address offset: 0x068
Reset value: 0x00C1 1307
Access: no wait state, word, half-word and byte access
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
ICACHESMEN
GTZCSMEN
TSCSMEN
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DMAMUX1SMEN
SRAM1SMEN
FLASHSMEN
DMA2SMEN
DMA1SMEN
Res. Res. Res. CRCSMEN Res. Res. Res. Res. Res. Res. Res.
rw rw rw rw rw rw
9.8.23 RCC AHB2 peripheral clocks enable in Sleep and Stop modes register
(RCC_AHB2SMENR)
Address offset: 0x06C
Reset value: 0x006F 22FF
Access: no wait state, word, half-word and byte access
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
OTFDEC1SMEN
SDMMC1SMEN
HASHSMEN
RNGSMEN
PKASMEN
AESSMEN
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SRAM2SMEN
GPIOGSMEN
GPIOHSMEN
GPIODSMEN
GPIOCSMEN
GPIOESMEN
GPIOBSMEN
GPIOASMEN
GPIOFSMEN
ADCSMEN
rw rw rw rw rw rw rw rw rw rw
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 during Sleep and Stop modes
1: AES clocks enabled by the clock gating during Sleep and Stop modes
Bits 15:14 Reserved, must be kept at reset value.
Bit 13 ADCSMEN: ADC clocks enable during Sleep and Stop modes
Set and cleared by software.
0: ADC clocks disabled by the clock gating during Sleep and Stop modes
1: ADC clocks enabled by the clock gating during Sleep and Stop modes
Bits 12:10 Reserved, must be kept at reset value.
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 during Sleep and Stop modes
1: SRAM2 interface clocks enabled by the clock gating during Sleep and Stop modes
Bit 8 Reserved, must be kept at reset value.
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 during Sleep and Stop modes
1: IO port H clocks enabled by the clock gating 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 during Sleep and Stop modes
1: IO port G clocks enabled by the clock gating 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 during Sleep and Stop modes
1: IO port F clocks enabled by the clock gating 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 during Sleep and Stop modes
1: IO port E clocks enabled by the clock gating 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 during Sleep and Stop modes
1: IO port D clocks enabled by the clock gating 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 during Sleep and Stop modes
1: IO port C clocks enabled by the clock gating 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 during Sleep and Stop modes
1: IO port B clocks enabled by the clock gating 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 during Sleep and Stop modes
1: IO port A clocks enabled by the clock gating during Sleep and Stop modes
9.8.24 RCC AHB3 peripheral clocks enable in Sleep and Stop modes register
(RCC_AHB3SMENR)
Address offset: 0x070
Reset value: 0x0000 0101
Access: no wait state, word, half-word and byte access
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. 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
OSPI1SMEN
FMCSMEN
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw
9.8.25 RCC APB1 peripheral clocks enable in Sleep and Stop modes
register 1 (RCC_APB1SMENR1)
Address: 0x078
Reset value: 0xF1FE CC3F
Access: no wait state, word, half-word and byte access
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
USART3SMEN
USART2SMEN
OPAMPSMEN
LPTIM1SMEN
UART5SMEN
UART4SMEN
DAC1SMEN
PWRSMEN
CRSSMEN
I2C3SMEN
I2C2SMEN
I2C1SMEN
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
RTCAPBSMEN
WWDGSMEN
TIM7SMEN
TIM6SMEN
TIM5SMEN
TIM4SMEN
TIM3SMEN
TIM2SMEN
SPI3SMEN
SPI2SMEN
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 during Sleep and Stop modes
1: LPTIM1 clocks enabled by the clock gating 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 during Sleep and Stop modes
1: OPAMP interface clocks enabled by the clock gating 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 during Sleep and Stop modes
1: DAC1 interface clocks enabled by the clock gating 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 during Sleep and Stop modes
1: Power interface clocks enabled by the clock gating during Sleep and Stop modes
Bits 27:25 Reserved, must be kept at reset value.
Bit 24 CRSSMEN: CRS clock enable during Sleep and Stop modes
Set and cleared by software.
0: CRS clocks disabled by the clock gating during Sleep and Stop modes
1: CRS clocks enabled by the clock gating 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 during Sleep and Stop modes
1: I2C3 clocks enabled by the clock gating 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 during Sleep and Stop modes
1: I2C2 clocks enabled by the clock gating 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 during Sleep and Stop modes
1: I2C1 clocks enabled by the clock gating 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 during Sleep and Stop modes
1: UART5 clocks enabled by the clock gating 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 during Sleep and Stop modes
1: UART4 clocks enabled by the clock gating 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 during Sleep and Stop modes
1: USART3 clocks enabled by the clock gating 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 during Sleep and Stop modes
1: USART2 clocks enabled by the clock gating 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 during Sleep and Stop modes
1: SPI3 clocks enabled by the clock gating 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 during Sleep and Stop modes
1: SPI2 clocks enabled by the clock gating 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 during Sleep and Stop modes
1: Window watchdog clocks enabled by the clock gating 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 during Sleep and Stop modes
1: RTC APB clock enabled by the clock gating during Sleep and Stop modes
Bits 9: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 during Sleep and Stop modes
1: TIM7 clocks enabled by the clock gating 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 during Sleep and Stop modes
1: TIM6 clocks enabled by the clock gating 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 during Sleep and Stop modes
1: TIM5 clocks enabled by the clock gating 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 during Sleep and Stop modes
1: TIM4 clocks enabled by the clock gating 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 during Sleep and Stop modes
1: TIM3 clocks enabled by the clock gating 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 during Sleep and Stop modes
1: TIM2 clocks enabled by the clock gating during Sleep and Stop modes
9.8.26 RCC APB1 peripheral clocks enable in Sleep and Stop modes
register 2 (RCC_APB1SMENR2)
Address offset: 0x07C
Reset value: 0x00A0 0223
Access: no wait state, word, half-word and byte access
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
UCPD1SMEN
USBFSSMEN
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LPUART1SMEN
FDCAN1SMEN
LPTIM3SMEN
LPTIM2SMEN
I2C4SMEN
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw rw rw rw
Bit 5 LPTIM2SMEN: Low-power timer 2 clocks enable during Sleep and Stop modes
Set and cleared by software.
0: LPTIM2 clocks disabled by the clock gating during Sleep and Stop modes
1: LPTIM2 clocks enabled by the clock gating during Sleep and Stop modes
Bits 4:2 Reserved, must be kept at reset value.
Bit 1 I2C4SMEN: I2C4 clocks enable during Sleep and Stop modes
Set and cleared by software
0: I2C4 clocks disabled by the clock gating during Sleep and Stop modes
1: I2C4 clocks enabled by the clock gating during Sleep and Stop modes
Bit 0 LPUART1SMEN: Low-power UART 1 clocks enable during Sleep and Stop modes
Set and cleared by software.
0: LPUART1 clocks disabled by the clock gating during Sleep and Stop modes
1: LPUART1 clocks enabled by the clock gating during Sleep and Stop modes
9.8.27 RCC APB2 peripheral clocks enable in Sleep and Stop modes register
(RCC_APB2SMENR)
Address: 0x080
Reset value: 0x0167 7801
Access: word, half-word and byte access
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
DFSDM1SMEN
TIM17SMEN
TIM16SMEN
TIM15SMEN
SAI2SMEN
SAI1SMEN
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SYSCFGSMEN
USART1SMEN
TIM8SMEN
TIM1SMEN
SPI1SMEN
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
rw rw rw rw rw
Bit 22 SAI2SMEN: SAI2 clocks enable during Sleep and Stop modes
Set and cleared by software.
0: SAI2 clocks disabled by the clock gating during Sleep and Stop modes
1: SAI2 clocks enabled by the clock gating during Sleep and Stop modes
Bit 21 SAI1SMEN: SAI1 clocks enable during Sleep and Stop modes
Set and cleared by software.
0: SAI1 clocks disabled by the clock gating during Sleep and Stop modes
1: SAI1 clocks enabled by the clock gating during Sleep and Stop modes
Bits 20:19 Reserved, must be kept at reset value.
Bit 18 TIM17SMEN: TIM17 timer clocks enable during Sleep and Stop modes
Set and cleared by software.
0: TIM17 clocks disabled by the clock gating during Sleep and Stop modes
1: TIM17 clocks enabled by the clock gating during Sleep and Stop modes
Bit 17 TIM16SMEN: TIM16 timer clocks enable during Sleep and Stop modes
Set and cleared by software.
0: TIM16 clocks disabled by the clock gating during Sleep and Stop modes
1: TIM16 clocks enabled by the clock gating during Sleep and Stop modes
Bit 16 TIM15SMEN: TIM15 timer clocks enable during Sleep and Stop modes
Set and cleared by software.
0: TIM15 clocks disabled by the clock gating during Sleep and Stop modes
1: TIM15 clocks enabled by the clock gating 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 during Sleep and Stop modes
1: USART1clocks enabled by the clock gating during Sleep and Stop modes
Bit 13 TIM8SMEN: TIM8 timer clocks enable during Sleep and Stop modes
Set and cleared by software.
0: TIM8 clocks disabled by the clock gating during Sleep and Stop modes
1: TIM8 clocks enabled by the clock gating 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 Sleep and Stop modes
1: SPI1 clocks enabled by the clock gating during Sleep and Stop modes
Bit 11 TIM1SMEN: TIM1 timer clocks enable during Sleep and Stop modes
Set and cleared by software.
0: TIM1 clocks disabled by the clock gating during Sleep and Stop modes
1: TIM1 clocks enabled by the clock gating 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 during Sleep and Stop
modes
1: SYSCFG + COMP + VREFBUF clocks enabled by the clock gating during Sleep and Stop
modes
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
CLK48MSEL[1:0]
LPTIM3SEL[1:0]
LPTIM2SEL[1:0]
LPTIM1SEL[1:0]
FDCANSEL[1:0]
ADCSEL[1:0]
I2C3SEL[1:0]
Res. Res.
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
LPUART1SEL[1:0]
USART3SEL[1:0]
USART2SEL[1:0]
USART1SEL[1:0]
UART5SEL[1:0]
UART4SEL[1:0]
I2C2SEL[1:0]
I2C1SEL[1:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
LSCOEN and BDRST) are only reset after a Backup domain reset (see Section 9.1.3:
Backup domain reset). Any internal or external reset does not have any effect on these bits.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
LSCOEN
LSCOSE
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. BDRST
L
rw rw rw
15 14 13 12 11
LSESYSRDY 10 9 8 7 6 5 4 3 2 1 0
LSECSSON
LSESYSEN
LSECSSD
LSERDY
LSEBYP
RTCEN
rw r 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
IWWDGRSTF
WWDGRSTF
LPWRRSTF
BORRSTF
OBLRSTF
SFTRSTF
PINRSTF
r r r r r r r rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LSIPRE
Res. Res. Res. Res. MSISRANGE[3:0] Res. Res. Res. Res. Res. LSIRDY LSION
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
HSI48RDY
HSI48ON
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
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. OSPISEL[1:0] Res. Res. Res. Res.
rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ADFSDMSEL[1:0]
SDMMCSEL
DFSDMSEL
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. OCTOSPI1_DLY
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
PLLSAI2SEC
PLLSAI1SEC
SYSCLKSEC
CLK48MSEC
PRESCSEC
RMVFSEC
HSI48SEC
HSESEC
LSESEC
PLLSEC
MSISEC
HSISEC
LSISEC
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
PLLSAI2SECF
PLLSAI1SECF
SYSCLKSECF
CLK48MSECF
PRESCSECF
RMVFSECF
HSI48SECF
HSESECF
LSESECF
PLLSECF
MSISECF
HSISECF
LSISECF
rw rw rw rw rw rw rw rw rw rw rw rw rw
Bit 9 PLLSAI2SECF: PLLSAI2 clock configuration and status bits security flag
Set and reset by software.
0: non secure
1: secure
Bit 8 PLLSAI1SECF: PLLSAI1 clock configuration and status bits security flag
Set and reset by software.
0: non secure
1: secure
Bit 7 PLLSECF: main PLL clock configuration and status bits security flag
Set and reset by software.
0: non secure
1: secure
Bit 6 PRESCSECF: AHBx/APBx prescaler configuration bits security flag
Set and reset by software.
0: non secure
1: secure
Bit 5 SYSCLKSECF: SYSCLK clock selection, STOPWUCK bit, clock output on MCO configuration
security flag
Set and reset by software.
0: non secure
1: secure
Bit 4 LSESECF: LSE clock configuration and status bits security flag
Set and reset by software.
0: non secure
1: secure
Bit 3 LSISECF: LSI clock configuration and status bits security flag
Set and reset by software.
0: non secure
1: secure
Bit 2 MSISECF: MSI clock configuration and status bits security flag
Set and reset by software.
0: non secure
1: secure
Bit 1 HSESECF: HSE clock configuration bits, status bits and HSE_CSS security flag
Set and reset by software.
0: non secure
1: secure
Bit 0 HSISECF: HSE clock configuration and status bits security flag
Set and reset by software.
0: non secure
1: secure
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
ICACHESECF
GTZCSECF
TSCSECF
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
r r r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DMAMUX1SECF
SRAM1SECF
FLASHSECF
DMA2SECF
DMA1SECF
CRCSECF
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
r r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
OTFDEC1SECF
SDMMC1SECF
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
r r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SRAM2SECF
GPIOGSECF
GPIOHSECF
GPIODSECF
GPIOCSECF
GPIOESECF
GPIOBSECF
GPIOASECF
GPIOFSECF
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
OSPI1SECF
FMCSECF
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
OPAMPSECF
LPTIM1SECF
UART5SECF
UART4SECF
UART3SECF
UART2SECF
DAC1SECF
PWRSECF
I2C3SECF
I2C2SECF
I2C1SECF
CRSSECF
Res. Res. Res. Res.
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
RTCAPBSECF
WWDGSECF
TIM7SECF
TIM6SECF
TIM5SECF
TIM4SECF
TIM3SECF
TIM2SECF
SPI3SECF
SPI2SECF
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
UCPD1SECF
USBFSSECF
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
r r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LPUART1SECF
FDCAN1SECF
LPTIM3SECF
LPTIM2SECF
I2C4SECF
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
r r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DFSDM1SECF
TIM17SECF
TIM16SECF
TIM15SECF
SAI2SECF
SAI1SECF
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
r r r r r r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SYSCFGSECF
USART1SECF
TIM8SECF
TIM1SECF
SPI1SECF
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
r r r r r
0x00C
Offset
9.8.42
RM0438
RCC_
RCC_
RCC_
Name
CFGR
CFGR
PLLSAI2
PLLSAI1
Register
RCC_CR
PLLCFGR
RCC_CIER
Reset value
Reset value
Reset value
RCC_CFGR
RCC_ICSCR
Reset value 0
Res. Res. Res. PRIV 31
Res. Res. 30
Res. PLLSAI2PDIV[4:0] PLLSAI1PDIV[4:0] MCOPRE[2:0] PLLSAI2RDY 29
Res. PLLSAI2ON 28
Reset value 0 0 0 0 0
PLLPDIV[4:0]
Res. PLLSAI1RDY 27
Res. Res. PLLSAI1ON 26
RCC register map
HSITRIM[6:0]
Res. Res. PLLRDY 25
Reset value 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
Res. Res. PLLSAI1REN PLLREN PLLON 24
Res. Res. Res. Res. Res. Res. 23
Res. Res. Res. Res. 22
PLLSAI1Q[1:0] PLLQ[1:0]
Res. Res. Res. Res. 21
0 0 0
0 0 0
Res. Res. PLLSAI1QEN PLLQEN Res. Res. 20
Res. Res. Res. Res. Res. CSSON 19
Res. Res. Res. Res. Res. HSEBYP 18
HSICAL[7:0]
RM0438 Rev 7
Res. PLLSAI2P PLLSAI1P PLLP Res. HSERDY 17
0 0
0 0
0 0
0 0 0 0
0
Res. Res. Res. Res. STOPWUCK Res. 15
Res. Res. Res. 14
Res. Res. 13
Res. PPRE2[2:0] Res. 12
Res. HSIASFS 11
Table 80. RCC register map and reset values
0
HSI48RDYIE HSIRDY 10
PLLN[6:0]
MSITRIM[7:0]
PLLSAI2N[6:0]
PLLSAI1N[6:0]
The following table gives the RCC register map and the reset values.
Res. HSION 8
PLLSAI2RDYIE 7
PLLSAI1RDYIE PLLSAI2M[3:0] PLLSAI1M[3:0] HPRE[3:0] MSIRANGE[3:0] 6
PLLRDYIE 5
0 0 1 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0 0
PLLM[3:0]
HSERDYIE 4
HSIRDYIE Res. Res. Res. SWS[1:0] MSIRGSEL 3
MSIRDYIE Res. Res. Res. MSIPLLEN 2
MSICAL[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 1 1 0 0 0 1 1
0 0 0 0 0 0 0 0
LSIRDYIE MSION 0
Reset and clock control (RCC)
421/2194
427
0x034
0x030
0x028
0x020
0x02C
0x01C
Offset
422/2194
RCC_
RCC_
RCC_
RCC_
RCC_
Name
Register
Reserved
RCC_CIFR
RCC_CICR
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
AHB3RSTR
AHB2RSTR
AHB1RSTR
0x03C APB1RSTR2
0x038 APB1RSTR1
Res. LPTIM1RST Res. Res. Res. Res. Res. 31
Res. OPAMPRST Res. Res. Res. Res. Res. 30
Res. DAC1RST Res. Res. Res. Res. Res. 29
Reset value 0 0 0 0
Res. PWRRST Res. Res. Res. Res. Res. 28
Reset and clock control (RCC)
0
UCPD1RST I2C3RST Res. Res. Res. Res. Res. 23
Res. I2C2RST Res. SDMMC1RST Res. Res. Res. 22
0
0 0
USBFSRST I2C1RST Res. OTDFDEC1RST Res. Res. Res. 21
Res. UART5RST Res. Res. Res. Res. Res. 20
Res. UART4RST Res. PKARST Res. Res. Res. 19
Res. USART3RST Res. RNGRST Res. Res. Res. 18
RM0438 Rev 7
0 0 0 0 0 0 0 0
Res. USART2RST Res. HASHRST Res. Res. Res. 17
0 0 0 0
0
Res. Res. Res. AESRST TSCRST Res. Res. 16
Res. SPI3RST Res. Res. Res. Res. Res. 15
Reserved
0 0
Res. SPI2RST Res. Res. Res. Res. Res. 14
0
Res. Res. Res. ADCRST Res. Res. Res. 13
0
0
FDCAN1RST Res. Res. Res. Res. Res. Res. 9
Table 80. RCC register map and reset values (continued)
0
0
0 0
LPTIM2RST TIM7RST Res. GPIOFRST Res. PLLRDYC PLLRDYF 5
Res. TIM6RST Res. GPIOERST Res. HSERDYC HSERDYF 4
Res. TIM5RST Res. GPIODRST Res. HSIRDYC HSIRDYF 3
Res. TIM4RST Res. GPIOCRST DMAMUX1RST MSIRDYC MSIRDYF 2
I2C4RST TIM3RST Res. GPIOBRST DMA2RST LSERDYC LSERDYF 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 0
0x05C
0x04C
Offset
RM0438
RCC_
RCC_
RCC_
RCC_
RCC_
RCC_
RCC_
Name
Register
Reserved
Reserved
APB2ENR
AHB3ENR
AHB2ENR
AHB1ENR
APB1ENR2
APB1ENR1
APB2RSTR
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Res. Res. LPTIM1EN Res. Res. Res. Res. 31
Res. Res. OPAMPEN Res. Res. Res. Res. 30
Res. Res. DAC1EN Res. Res. Res. Res. 29
Reset value 0 0 0 0
Res. Res. PWREN Res. Res. Res. Res. 28
Res. Res. Res. Res. Res. Res. Res. 27
Res. Res. Res. Res. Res. Res. Res. 26
Res. Res. Res. Res. Res. Res. Res. 25
0
0
0
Res. UCPD1EN I2C3EN Res. Res. Res. Res. 23
0
SAI2EN Res. I2C2EN Res. SDMMC1EN GTZCEN SAI2RST 22
0 0
0
0 0
0 0
RM0438 Rev 7
0 0 0 0 0 0 0 0
TIM16EN Res. USART2EN Res. HASHEN Res. TIM16RST 17
0 0 0
0 0 0 0
0
0 0 0
Reserved
Reserved
0 0
USART1EN Res. SPI2EN Res. Res. Res. USART1RST 14
0
0 0 0 0
0 0 0 0
0 0
Res. Res. RTCAPBEN Res. Res. Res. Res. 10
0
Res. FDCAN1EN Res. Res. Res. Res. Res. 9
Table 80. RCC register map and reset values (continued)
0
1
0 0
Res. LPTIM2EN TIM7EN Res. GPIOFEN Res. Res. 5
Res. Res. TIM6EN Res. GPIOEEN Res. Res. 4
Res. Res. TIM5EN Res. GPIODEN Res. Res. 3
Res. Res. TIM4EN Res. GPIOCEN DMAMUX1EN Res. 2
Res. I2C4EN TIM3EN Res. GPIOBEN DMA2EN Res. 1
0 0 0 0 0 0
0
0 0 0 0 0 0 0 0
0 0
0
0
0 0 0
423/2194
427
0x084
0x080
0x078
0x074
0x070
0x068
0x07C
0x06C
Offset
424/2194
Name
SMENR
SMENR
SMENR
SMENR
Register
SMENR2
SMENR1
Reserved
Reserved
Reset value
RCC_APB2
Reset value
RCC_APB1
RCC_APB1
Reset value
Reset value
Reset value
RCC_AHB3
RCC_AHB2
Res. Res. LPTIM1SMEN Res. Res. RCC_AHB1
Res. 31
Res. Res. OPAMPSMEN Res. Res. Res. 30
Res. Res. DAC1SMEN Res. Res. Res. 29
Reset value 1 1 1 1
Res. Res. PWRSMEN Res. Res. Res. 28
Reset and clock control (RCC)
1
DFSDM1SMEN Res. CRSSMEN Res. Res. Res. 24
1
Res. UCPD1SMEN I2C3SMEN Res. Res. ICACHESMEN 23
1 1
1 1
1
1 1
SAI1SMEN USBSFSSMEN I2C1SMEN Res. OTFDEC1SMEN Res. 21
Res. Res. UART5SMEN Res. Res. Res. 20
Res. Res. UART4SMEN Res. PKASMEN Res. 19
TIM17SMEN Res. USART3SMEN Res. RNGSMEN Res. 18
RM0438 Rev 7
1 1 1 1 1 1 1 1
TIM16SMEN Res. USART2SMEN Res. HASHSMEN Res. 17
1 1 1
1 1 1 1
1
Reserved
Reserved
1 1
USART1SMEN Res. SPI2SMEN Res. Res. Res. 14
1
1 1 1 1
TIM1SMEN Res. WWDGSMEN Res. Res. Res. 11
1 1
Res. Res. RTCAPBSMEN Res. Res. Res. 10
1
1
1
1 1
1 1
Res. LPTIM2SMEN TIM7SMEN Res. GPIOFSMEN Res. 5
Res. Res. TIM6SMEN Res. GPIOESMEN Res. 4
Res. Res. TIM5SMEN Res. GPIODSMEN Res. 3
Res. Res. TIM4SMEN Res. GPIOCSMEN DMAMUX1SMEN 2
Res. I2C4SMEN TIM3SMEN Res. GPIOBSMEN DMA2SMEN 1
1 1 1 1 1 1
1
1 1 1 1 1 1 1 1
1 1
1 1 1
0x0A8
0x0B8
0x0B4
0x0A0
Offset
0x09C
RM0438
RCC_
RCC_
RCC_
RCC_
Name
CFGR
CRRCR
CCIPR2
CCIPR1
Register
Reserved
Reserved
RCC_DLY
RCC_CSR
SECCFGR
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
RCC_BDCR
Res. Res. Res. Res. LPWRRSTF Res. Res. 31
Res. Res. Res. Res. WWDGRSTF Res. Res. 30
Res. Res. Res. Res. IWWDGRSTF Res. ADCSEL[1:0] 29
Res. Res. Res. Res. SFTRSTF Res. 28
Res. Res. Res. Res. BORRSTF Res. CLK48MSEL[1:0] 27
Res. Res. Res. Res. PINRSTF Res. 26
Reset value 0 0 0 0 1 0 1
Res. Res. Res. Res. OBLRSTF LSCOSEL FDCANSEL[1:0] 25
0 0
Res. Res. Res. Res. Res. LSCOEN 24
0
Res. Res. Res. Res. RMVF Res. LPTIM3SEL[1:0] 23
Res. Res. Res. Res. Res. Res. 22
Res. Res. Res. Res. Res. 21
OSPISEL[1:0] LPTIM2SEL[1:0]
0 0
Res. Res. Res. Res. Res. 20
Res. Res. Res. Res. Res. Res. LPTIM1SEL[1:0] 19
Res. Res. Res. Res. Res. Res. 18
RM0438 Rev 7
Res. Res. Res. Res. Res. Res. I2C3SEL[1:0] 17
Res. Res. Res. Res. Res. BDRST 16
0 0
Reserved
Reserved
0
Res. Res. SDMMCSEL Res. Res. 14
Res. Res. Res. Res. Res. 13
I2C1SEL[1:0]
RMVFSEC Res. Res. Res. Res. 12
0
0 1 1 0
PLLSAI1SEC Res. 8
PLLSEC Res. x x x x x x x x x Res. LSESYSEN UART4SEL[1:0] 7
PRESCSEC Res. SAI1SEL[2:0] Res. Res. LSECSSD 6
SYSCLKSEC Res. Res. Res. LSECSSON USART3SEL[1:0] 5
0
1_DLY
I2C4SEL[1:0] USART1SEL[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 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0
0 0
OCTOSPI
HSISEC HSI48ON LSION LSEON 0
Reset and clock control (RCC)
425/2194
427
to
0x0F0
0x0F4
0x0E8
0x0E4
Offset
0x0C0
0x0FC
0x0BC
426/2194
RCC_
RCC_
RCC_
RCC_
Name
SECSR
Register
SECSR2
0x0F8 SECSR1
Reserved
Reserved
Reset value
RCC_APB1
RCC_APB1
Reset value
Reset value
Reset value
Reset value
AHB3SECSR
0x0EC AHB2SECSR
AHB1SECSR
Res. LPTIM1SECF Res. Res. Res. Res. 31
Res. OPAMPSECF Res. Res. Res. Res. 30
Res. DAC1SECF Res. Res. Res. Res. 29
Reset value 0 0 0 0
Res. PWRSECF Res. Res. Res. Res. 28
Reset and clock control (RCC)
0
UCPD1SECF I2C3SECF Res. Res. ICACHESECF Res. 23
0 1
Res. I2C2SECF Res. SDMMC1SECF GTZCSECF Res. 22
0
0 1
USBFSSECF I2C1SECF Res. OTFDEC1SECF Res. Res. 21
Res. UART5SECF Res. Res. Res. Res. 20
Res. UART4SECF Res. Res. Res. Res. 19
Res. UART3SECF Res. Res. Res. Res. 18
RM0438 Rev 7
0 0 0 0 0 0 0 0
Res. UART2SECF Res. Res. 0 Res. Res. 17
Res. Res. Res. Res. TSCSECF Res. 16
Res. SPI3SECF Res. Res. Res. Res. 15
Reserved
Reserved
0 0
Res. SPI2SECF Res. Res. Res. Res. 14
Res. Res. Res. Res. Res. Res. 13
0
0 1
Res. RTCAPBSECF Res. Res. Res. CLK48MSECF 10
0
1
FDCAN1SECF Res. Res. SRAM2SECF SRAM1SECF PLLSAI2SECF 9
Table 80. RCC register map and reset values (continued)
0
1 1
0 0
LPTIM2SECF TIM7SECF Res. GPIOFSECF Res. SYSCLKSECF 5
Res. TIM6SECF Res. GPIOESECF Res. LSESECF 4
Res. TIM5SECF Res. GPIODSECF Res. LSISECF 3
Res. TIM4SECF Res. GPIOCSECF DMAMUX1SECF MSISECF 2
I2C4SECF TIM3SECF Res. GPIOBSECF DMA2SECF HSESECF 1
0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0
1 1 1 1 1 1 1 1
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
Name
SYSCFGSECF
DFSDM1SECF
USART1SECF
TIM17SECF
TIM16SECF
TIM15SECF
TIM8SECF
TIM1SECF
SAI2SECF
SAI1SECF
SPI1SECF
RCC_ Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
0x100 APB2SECSR
Reset value 0 0 0 0 0 0 0 0 0 0 0
10.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
USB_DP
FELIM
USB
USB_DM
RELOAD
HSI48 To USB
To RNG
MSv34708V1
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: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
ESYNCIE
SWSYNC
TRIM[6]
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
11.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) and a secure configuration register
(GPIOx_SECCFGR).
to allow atomic read/modify accesses to any of the GPIOx_ODR registers. In this way, there
is no risk of an IRQ occurring between the read and the modify access.
Figure 37 and Figure 38 show the basic structures of a standard and a 5-Volt tolerant I/O
port bit, respectively. Table 85 gives the possible port bit configurations.
Analog
To on-chip
peripheral Alternate function input
on/off
Input data register
Read
VDDIOxVDDIOx
Bit set/reset registers
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
MODEy[1:0] GPIOx_MODER
OTy GPIOx_OTYPER
OSPEEDy[1:0] GPIOx_OSPEEDR
PUPDy[1:0] GPIOx_PUPDR
IDy GPIOx_IDR
SECy = 1 in GPIOx_SECCFGR ODy GPIOx_ODR RAZ/WI
BSy GPIOx_BSRR
LCKy GPIOx_LCKR
AFSELy[3:0] GPIOx_AFRL
GPIOx_AFRH
BRy
GPIOx_BRR
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
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
SEC15 SEC14 SEC13 SEC12 SEC11 SEC10 SEC9 SEC8 SEC7 SEC6 SEC5 SEC4 SEC3 SEC2 SEC1 SEC0
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
0x1C
458/2194
11.6.13
H))
for H
for A...G
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
GPIOx_IDR
GPIOx_BRR
GPIOx_ODR
GPIOx_AFRL
GPIOx_AFRH
GPIOx_LCKR
GPIOx_BSRR
(where x = A..H)
(where x = A...H)
GPIOx_OTYPER
(where x = A to H)
(where x = A to H)
(where x = A to H)
(where x = A to H)
(where x = A to H)
(where x = A to H)
(where x = A to H)
GPIOx_SECCFGR
GPIOx_OSPEEDR
(where x = A..HA to
Offset Register name
0
0
0
0
Res. Res. Res. BR15 Res. Res. Res. 31
OSPEED15[1:0]
0
0
0
0
Res. Res. Res. BR14 Res. Res. Res. 30
0
0
0
0
Res. Res. Res. BR13 Res. Res. Res.
7[3:0]
15[3:0]
29
General-purpose I/Os (GPIO)
OSPEED14[1:0]
0
0
0
0
Res. Res. Res. BR12 Res. Res. Res. 28
0
0
0
0
Res. Res. Res. BR11 Res. Res. Res. 27
OSPEED13[1:0]
GPIO register map
0
0
0
0
Res. Res. Res. BR10 Res. Res. Res. 26
0
0
0
0
Res. Res. Res. BR9 Res. Res. Res.
6[3:0]
14[3:0]
OSPEED12[1:0] 25
0
0
0
0
Res. Res. Res. BR8 Res. Res. Res. 24
0
0
0
0
Res. Res. Res. BR7 Res. Res. Res. 23
OSPEED11[1:0]
0
0
0
Res. Res. Res. BR6 Res. Res. 0 Res. 22
0
0
0
0
Res. Res. Res. BR5 Res. Res. Res.
5[3:0]
13[3:0]
OSPEED10[1:0] 21
0
0
0
0
0
0
0
0
0
0
0
0
RM0438 Rev 7
0
0
0
0
4[3:0]
12[3:0]
OSPEED8[1:0] 17
0
0
0
0
0
Res. Res. LCKK BR0 Res. Res. Res. 16
x
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
3[3:0]
11[3:0]
OSPEED6[1:0] 13
x
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
OSPEED5[1:0]
11
x
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
10[3:0]
9
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
OSPEED2[1:0] 5
x
0
1
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
OSPEED0[1:0] 1
x
1
1
0
0
0
0
0
0
0
0
Privileged/unprivileged mode
The SYSCFG registers can be read and written by privileged and unprivileged accesses
except the SYSCFG registers for CPU configuration: SYSCFG_CSLCKR,
SYSCFG_FPUIMR and SYSCFG_CNSLCKR registers.
An unprivileged access to a privileged register is RAZ/WI.
Table 88 shows the register security overview.
TrustZone
TZEN=1 TZEN=0 NA
configuration(1)
Read: no restriction
Write: secure access only
SYSCFG_SECCFGR RAZ/WI No restriction
Write non-secure: is WI and
generates an illegal access event
Read/Write: secure access only
Read/Write non-secure: is RAZ/WI Privileged only
SYSCFG_CSLCKR RAZ/WI
and generates and an illegal access Unprivileged: RAZ/WI
event
TrustZone
TZEN=1 TZEN=0 NA
configuration(1)
No Privileged only
SYSCFG_CNSLCKR Read/write: no restriction
restriction Unprivileged: RAZ/WI
Read/Write: secure access only for
secure bits depending on peripheral
security bits in GTZSC_SECFGR
register No
SYSCFG_CFGR1 No restriction
restriction
Read/Write non-secure: only for
non-secure bits, otherwise is
RAZ/WI
– If SRAM2SEC bit is set:
Read/Write: secure access only
SYSCFG_SWPR,
Read/Write Non-secure: is RAZ/WI
SYSCFG_SWPR2, No
and generates an illegal access No restriction
SYSCFG_SKR, restriction
event
SYSCFG_SCSR
– If SRAM2SEC bit is reset:
Read/Write: no restriction
– If CLASSBSEC bit is set:
Read/Write: secure access only
Read/Write Non-secure: is RAZ/WI
No
SYSCFG_CFGR2 and generates an illegal access No restriction
restriction
event
– If CLASSBSEC bit is reset:
Read/Write: no restriction
RAZ/WI if register access is not
SYSCFG_RSSCMDR RAZ/WI No restriction
allowed(2)
1. TrustZone security is activated by the TZEN option bit in the FLASH_OPTR register.
2. Refer to register description for register 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
FPUSE SRAM2 CLASS SYSCF
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
C SEC BSEC GSEC
rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
I2C_ I2C_ I2C_ I2C_
I2C4_ I2C3_ I2C2 I2C1
Res. Res. Res. Res. Res. Res. Res. Res. PB9_ PB8_ PB7_ PB6_
FMP FMP _FMP _FMP
FMP FMP FMP FMP
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. Res.
WVDD EN
rw rw
Table describes when the bit 8 (BOOSTEN) and the bit 9 (ANASWVDD) should be set or
reset depending on the voltage settings.
- > 2.4 V 0
0
> 2.4 V 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
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. FPU_IE[5: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
LOCKN LOCKN
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
SMPU SVTOR
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
LOCKS
LOCKS LOCKS
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. VTAIR
AU MPU
CR
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. 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
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. Res. KEY[7:0]
w
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
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
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
RSSCMD
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
0x1C
0x0C
Offset
470/2194
12.3.12
R
R
R2
R1
MR
CFGR
SYSCFG
SYSCFG_
CNSLCKR
reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
_CSLOCKR
Register name
SYSCFG_SKR
SYSCFG_SEC
SYSCFG_SCS
SYSCFG_CFG
SYSCFG_CFG
SYSCFG_SWP
SYSCFG_FPUI
P31WP Res. Res. Res. Res. Res. Res. Res. Res. 31
P30WP Res. Res. Res. Res. Res. Res. Res. Res. 30
P29WP Res. Res. Res. Res. Res. Res. Res. Res. 29
P28WP Res. Res. Res. Res. Res. Res. Res. Res. 28
P27WP Res. Res. Res. Res. Res. Res. Res. Res. 27
P26WP Res. Res. Res. Res. Res. Res. Res. Res. 26
P25WP Res. Res. Res. Res. Res. Res. Res. Res. 25
SYSCFG register map
RM0438 Rev 7
P17WP Res. Res. Res. Res. Res. Res. I2C_PB7_FMP Res. 17
0 0 0 0 0 0 0 0
0
P8WP Res. Res. SSPF Res. Res. Res. BOOSTEN Res. 8
The following table gives the SYSCFG register map and the reset values.
KEY [7:0]
P2WP Res. PVDL LOCKSAU Res. Res. SRAM2SEC 2
P1WP SRAM2BSY SPL LOCKSMPU LOCKNSMPU Res. CLASSBSEC 1
FPU_IE[5:0]
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 1 1 1 1 1
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
reset value
P63WP
P62WP
P61WP
P60WP
P59WP
P58WP
P57WP
P56WP
P55WP
P54WP
P53WP
P52WP
P51WP
P50WP
P49WP
P48WP
P47WP
P46WP
P45WP
P44WP
P43WP
P42WP
P41WP
P40WP
P39WP
P38WP
P37WP
P36WP
P35WP
P34WP
P33WP
P32WP
SYSCFG_SWP
0x24 R2
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
SYSCFG_RSS
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
RSSCMD[15:0]
CMDR
Power-on reset
0x2C 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
value
System reset
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
value
13.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
COMP1
COMP2
LPTIM1
LPTIM2
LPTIM3
TIM15
TIM16
TIM17
ADC1
ADC2
DAC1
DAC2
IRTIM
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 - - - - - - - - - - - - - - - - - - - - - - - -
LPTIM3 - - - - - - - - - - - - - - - - - - - - - - - -
ADC1 3 - - - - - - - - - - - - - - - 16 - - - - - - -
ADC2 3 - - - - - - - - - - - - - - - 16 - - - - - - -
DFSDM1 6 6 - - - - - - 6 6 6 - - - - - - - - - - - - -
T. Sensor - - - - - - - - - - - - - - 12 12 - - - - - - - -
VBAT - - - - - - - - - - - - - - 12 12 - - - - - - - -
VREFINT - - - - - - - - - - - - - - 12 12 - - - - - - - -
Table 91. STM32L552xx and STM32L562xx peripherals interconnect matrix(1) (2) (continued)
Destination
OPAMP1
OPAMP2
DFSDM1
Source
COMP1
COMP2
LPTIM1
LPTIM2
LPTIM3
TIM15
TIM16
TIM17
IRTIM
ADC1
ADC2
DAC1
DAC2
TIM1
TIM8
TIM2
TIM3
TIM4
TIM5
TIM6
TIM7
OPAMP1 - - - - - - - - - - - - - - 12 12 - - - - - - - -
OPAMP2 - - - - - - - - - - - - - - 12 12 - - - - - - - -
DAC1 - - - - - - - - - - - - - - - - - 12 12 - - - - -
DAC2 - - - - - - - - - - - - - - - - - - - - - - - -
HSE - - - - - - - - - - 7 - - - - - - - - - - - - -
LSE - - 7 - - - - - 7 7 - - - - - - - - - - - - - -
MSI - - - - - - - - - - 7 - - - - - - - - - - - - -
LSI - - - - - - - - - 7 - - - - - - - - - - - - - -
MCO - - - - - - - - - - 7 - - - - - - - - - - - - -
EXTI - - - - - - - - - - - - - - 2 2 5 - - 4 4 - - -
RTC - - - - - - - - - 7 - 8 8 8 - - - - - - - - - -
COMP1 13 13 13 13 - - - - 13 13 13 8 8 8 - - - - - - - - - -
COMP2 13 13 13 13 - - - - 13 13 13 8 8 8 - - - - - - - - - -
SYST ERR 14 14 - - - - - - 14 14 14 - - - - - - - - - - - - -
USB - - 11 - - - - - - - - - - - - - - - - - - - - -
1. Numbers in table are links to corresponding detailed sub-section in Section 13.3: Interconnection details.
2. The “-” symbol in grayed cells means no interconnect.
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 228: Advanced-control
timer block diagram.
The possible master/slave connections are given in:
• Table 270: TIMx internal trigger connection
• Table 275: TIMx internal trigger connection
• Table 279: 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:
Triggering signals
The output (from ADC) is on signals ADCn_AWDx_OUT n = 1 (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 200: 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.
Triggering signals
This trigger feature is described in Section 37.4.7: Trigger multiplexer (and following
sections).
The input selection is described in Table 288: LPTIM1 external trigger connection.
Triggering signals
Timer output signal TIMx_Ocx are the inputs to blanking source of COMP1/COMP2.
Triggering signals
Internal to the ADCs.
Triggering signals
Internal signal generated by USB FS Start Of Frame.
Comparators (COMP1/COMP2) output values can also generate break input signals for
timers (TIM1/TIM8) on input pins TIMx_BKIN or TIMx_BKIN2 through GPIO alternate
function selection using open drain connection of IO, see Section 33.3.17: Bidirectional
break inputs.
The possible connections are given in:
• Section 33.4.23: TIM1 option register 1 (TIM1_OR1)
• Section 33.4.24: TIM8 option register 1 (TIM8_OR1)
• Section 34.4.22: TIM2 option register 1 (TIM2_OR1)
• Section 34.4.23: TIM3 option register 1 (TIM3_OR1)
• Section 34.4.24: TIM2 option register 2 (TIM2_OR2)
• Section 34.4.25: TIM3 option register 2 (TIM3_OR2)
• Section 35.3: TIM16/TIM17 main features
14.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.
DMA1
Ch 1
Ch 8
dma1_it[1..8] dma1_sec_ilac
DMA2
DMAMUX
Ch 1
32-bit AHB bus
Ch 2
AHB master interface
...
Ch 8
dma2_secm [1..8]
dma2_priv[1..8]
Interrupt AHB slave interface
interface
dma2_it[1..8] dma2_sec_ilac
MSv46688V1
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 a secure bus and a privileged bus, to keep the DMAMUX
peripheral informed of the secure or non-secure state, and the privileged or unprivileged
state of each channel x.
The DMA controller generates an interrupt per channel to the interrupt controller.
The DMA controller also generates an illegal access event, as a pulse, to the TrustZone
interrupt controller, when a non-secure software attempts to access a secure DMA register
or register field.
The request/acknowledge protocol is used when a peripheral is either the source or the
destination of the transfer. For example, in case of memory-to-peripheral transfer, the
peripheral initiates the transfer by driving its single request signal to the DMA controller. The
DMA controller reads then a single data in the memory and writes this data to the peripheral.
For a given channel x, a DMA block transfer consists of a repeated sequence of:
• a single DMA transfer, encapsulating two AHB transfers of a single data, over the DMA
AHB bus master:
– a single data read (byte, half-word or word) from the peripheral data register or a
location in the memory, addressed through an internal current peripheral/memory
address register.
The start address used for the first single transfer is the base address of the
peripheral or memory, and is programmed in the DMA_CPARx or
DMA_CM0/1ARx register.
– a single data write (byte, half-word or word) to the peripheral data register or a
location in the memory, addressed through an internal current peripheral/memory
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_CM0/1ARx 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_CM0/1ARx 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_CM0ARx) 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_CM0/1ARx
registers.
Security
The DMA controller is compliant with the TrustZone-M hardware architecture, partitioning all
its resources so that they exist in one of the two worlds: the secure world and the non-
secure world, at any given time.
A secure software is able to access any resource/register, whatever secure or non-secure.
A non-secure software is restricted to access any non-secure resource/register.
Any channel is in a secure or non-secure state, as securely configured by the
DMA_CCRx.SECM secure register bit.
When a channel x is configured in secure mode, the following access controls rules are
applied:
• A non-secure read access to a register field of this channel is forced to return 0, except
for both the secure state and the privileged state of this channel x (SECM and PRIV
bits of the DMA_CCRx register) which are readable by a non-secure software.
• A non-secure write access to a register field of this channel has no impact.
When a channel is configured in secure mode, a secure software can separately configure
as secure or non-secure the AHB DMA master transfer from the source (by the
DMA_CCRx.SSEC register bit), and as secure or non-secure the AHB DMA master transfer
to the destination (by the DMA_CCRx.DSEC register bit).
The DMA controller generates a secure bus, dma_secm[7:0], reflecting the
DMA_CCRx.SECM register, in order to keep the other hardware peripherals like the
DMAMUX, informed of the secure/non-secure state of each DMA channel x.
The DMA controller also generates a security illegal access pulse event, dma_sec_ilac, on
an illegal non-secure software access to a secure DMA register or register field. This event
is routed to the TrustZone interrupt controller.
The dma_sec_ilac event is generated in the configurations described below:
• If the channel x is in secure state (SECM bit of the DMA_CCRx register set), the
dma_sec_ilac is generated on one of the following accesses:
– a non-secure write access to a dedicated register of this channel x (DMA_CCRx,
DMA_CNDTRx, DMA_CPARx, DMA_CM0ARx and DMA_CM1ARx)
– a non-secure read access to a dedicated register of this channel x, except the
DMA_CxCR register (DMA_CNDTRx, DMA_CPARx, DMA_CM0ARx, and
DMA_CM1ARx).
• If the channel x is in non-secure state (SECM bit of the DMA_CCRx register cleared),
the dma_sec_ilac is generated on a non-secure write access to the DMA_CCRx
register which attempts to write 1 into any of the secure configuration bits SECM,
DSEC, SSEC.
When the software is switching from a secure state to a non-secure state (after the secure
transfer is completed), the secure software must disable the channel by a 32-bit write at the
DMA_CCRx address before switching. This operation is needed for the two below reasons:
• a non-secure software cannot do so
• the EN bit of the DMA_CCRx register must be cleared before the (non-secure)
software can reprogram the DMA_CCRx for a next transfer.
Note: A trusted application may require that the secure software does not only disable the
channel, but also reset the full DMA_CCRx word register to its reset value, as well as reset
any other DMA register corresponding to this channel x.
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.
Table 94. 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_CM0/1ARx 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_CM0/1ARx)
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
Table 94. Programmable data width and endian behavior (when PINC = MINC = 1) (continued)
Source Destinat
port ion port Destination
Number Source content:
width width content:
of data address / data
(MSIZE (PSIZE address / data
items to (DMA_CM0/1ARx 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_CM0/1ARx)
PSIZE) MSIZE)
@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
The TEIFx bit of the DMA_ISR register is set. An interrupt is then generated if the TEIE bit of
the DMA_CCRx register is set.
The EN bit of the DMA_CCRx register can not be set again by software (channel x re-
activated) until the TEIFx bit of the DMA_ISR register is cleared (by setting the CTEIFx bit of
the DMA_IFCR register).
When the software is notified with a transfer error over a channel which involves a
peripheral, the software has first to stop this peripheral in DMA mode, in order to disable any
pending or future DMA request. Then software may normally reconfigure both DMA and the
peripheral in DMA mode for a new transfer.
Additionally, a security illegal access pulse signal is generated on an illegal non-secure
software access to a secure DMA register. This signal is routed to the TrustZone interrupt
controller.
the full interrupt status. An unprivileged software is restricted to read the status of
unprivileged channel(s), other privileged bit fields returning zero.
Every status / flag bit is set by hardware, independently of the privileged and the secure
mode of the channel.
Every status bit is cleared by hardware when the software sets the corresponding clear bit
or the corresponding global clear bit CGIFx, in the DMA_IFCR register, provided that, if the
channel x is in privileged mode and/or in secure mode, then the software access to
DMA_IFCR is also privileged and/or secure.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
TEIF8 HTIF8 TCIF8 GIF8 TEIF7 HTIF7 TCIF7 GIF7 TEIF6 HTIF6 TCIF6 GIF6 TEIF5 HTIF5 TCIF5 GIF5
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
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
CHTIF8
CTCIF8
CHTIF7
CTCIF7
CHTIF6
CTCIF6
CHTIF5
CTCIF5
CTEIF8
CTEIF7
CTEIF6
CTEIF5
CGIF8
CGIF7
CGIF6
CGIF5
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
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
Setting any of the DSEC or SSEC bits must be performed by a secure write access to this
register.
Except SECM and PRIV control bits, any other register field is non-readable by a
non-secure software if the SECM bit is set, and non-readable by an unprivileged software if
the PRIV bit is set.
The register fields/bits PRIV, DSEC, SSEC, SECM, CT, DBM, MEM2MEM, PL[1:0],
MSIZE[1:0], PSIZE[1:0], MINC, PINC, and DIR are read-only when EN = 1.
The states of MEM2MEM and CIRC bits must not be both high at the same time.
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. PRIV DSEC SSEC SECM CT
rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
MEM2
DBM 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 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. NDT[17:16]
rw rw
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
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
HTIF8
TCIF8
HTIF7
TCIF7
HTIF6
TCIF6
HTIF5
TCIF5
HTIF4
TCIF4
HTIF3
TCIF3
HTIF2
TCIF2
HTIF1
TCIF1
TEIF8
TEIF7
TEIF6
TEIF5
TEIF4
TEIF3
TEIF2
TEIF1
GIF8
GIF7
GIF6
GIF5
GIF4
GIF3
GIF2
GIF1
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 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
CTCIF8
CTCIF7
CTCIF6
CTCIF5
CTCIF4
CTCIF3
CTCIF2
CTCIF1
CHTIF8
CHTIF7
CHTIF6
CHTIF5
CHTIF4
CHTIF3
CHTIF2
CHTIF1
CTEIF8
CTEIF7
CTEIF6
CTEIF5
CTEIF4
CTEIF3
CTEIF2
CTEIF1
CGIF8
CGIF7
CGIF6
CGIF5
CGIF4
CGIF3
CGIF2
CGIF1
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 0 0 0 0
MEM2MEM
MSIZE[1:0]
PSIZE[1:0]
PL[1:0]
SECM
DSEC
SSEC
MINC
CIRC
PINC
PRIV
HTIE
TCIE
DBM
TEIE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DIR
EN
CT
DMA_CCR1
0x008
Reset value 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.
DMA_CNDTR1 NDT[17:0]
0x00C
Reset value 0 0 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_CM0AR1 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
DMA_CM1AR1 MA[31: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 0 0 0 0 0 0 0 0 0 0
MEM2MEM
MSIZE[1:0]
PSIZE[1:0]
PL[1:0]
SECM
DSEC
SSEC
MINC
CIRC
PINC
PRIV
HTIE
TCIE
TEIE
DBM
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DIR
EN
CT
DMA_CCR2
0x01C
Reset value 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.
DMA_CNDTR2 NDT[17:0]
0x020
Reset value 0 0 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_CM0AR2 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
DMA_CM1AR2 MA[31:0]
0x02C
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
MEM2MEM
MSIZE[1:0]
PSIZE[1:0]
PL[1:0]
SECM
DSEC
SSEC
MINC
CIRC
PINC
PRIV
HTIE
TCIE
TEIE
DBM
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DIR
EN
CT
DMA_CCR3
0x030
Reset value 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.
DMA_CNDTR3 NDTR[17:0]
0x034
Reset value 0 0 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_CM0AR3 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
DMA_CM1AR3 MA[31:0]
0x040
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
MEM2MEM
MSIZE[1:0]
PSIZE[1:0]
PL[1:0]
SECM
DSEC
SSEC
MINC
CIRC
PINC
PRIV
HTIE
TCIE
TEIE
DBM
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DIR
EN
CT
DMA_CCR4
0x044
Reset value 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.
DMA_CNDTR4 NDT[17:0]
0x048
Reset value 0 0 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
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
DMA_CM0AR4 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
DMA_CM1AR4 MA[31:0]
0x054
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
MEM2MEM
MSIZE[1:0]
PSIZE[1:0]
PL[1:0]
SECM
DSEC
SSEC
MINC
CIRC
PINC
PRIV
HTIE
TCIE
DBM
TEIE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DIR
EN
CT
DMA_CCR5
0x058
Reset value 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.
DMA_CNDTR5 NDT[17:0]
0x05C
Reset value 0 0 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_CM0AR5 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
DMA_CM1AR5 MA[31:0]
0x068
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
MEM2MEM
MSIZE[1:0]
PSIZE[1:0]
PL[1:0]
SECM
DSEC
SSEC
MINC
CIRC
PINC
PRIV
HTIE
TCIE
TEIE
DBM
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DIR
EN
0x06C
DMA_CCR6 CT
Reset value 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.
DMA_CNDTR6 NDT[17:0]
0x070
Reset value 0 0 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_CM0AR6 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
DMA_CM1AR6 MA[31:0]
0x07C
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
MEM2MEM
MSIZE[1:0]
PSIZE[1:0]
PL[1:0]
SECM
DSEC
SSEC
MINC
CIRC
PINC
PRIV
HTIE
TCIE
TEIE
DBM
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DIR
EN
CT
DMA_CCR7
0x080
Reset value 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.
DMA_CNDTR7 NDT[17:0]
0x084
Reset value 0 0 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_CM0AR7 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
DMA_CM1AR7 MA[31:0]
0x090
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
MEM2MEM
MSIZE[1:0]
PSIZE[1:0]
PL[1:0]
SECM
DSEC
SSEC
MINC
CIRC
PINC
PRIV
HTIE
TCIE
TEIE
DBM
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DIR
EN
CT
DMA_CCR8
0x094
Reset value 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.
DMA_CNDTR8 NDT[17:0]
0x098
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DMA_CPAR8 PA[31:0]
0x09C
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
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
DMA_CM0AR8 MA[31:0]
0x0A0
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_CM1AR8 MA[31:0]
0x0A4
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
15.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 15.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 15.3.2.
x
eq
_r Channel 0 m privileged state of
DMA requests the DMA channels:
ux
1
from peripherals: DMAMUX_C0CR
am
1 0 dma_secmx
dmamux_req_inx
dm
0
generator dmamux_req_outx
n n+3
Channel n
DMAMUX_RGCnCR n+2 Sync m
1 DMA channels 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)
A DMA request is sourced either from the peripherals or from the DMAMUX request
generator.
The DMAMUX request line multiplexer channel x selects the DMA request line number as
configured by the DMAREQ_ID field in the DMAMUX_CxCR register.
Note: The null value in the field DMAREQ_ID corresponds to no DMA request line selected.
Caution: A same non-null DMAREQ_ID can be assigned to two different channels only if the
application ensures that these channels are not requested to be served at the same time. In
other words, if two different channels receive a same asserted hardware request at the
same time, an unpredictable DMA hardware behavior occurs.
On top of the DMA request selection, the synchronization mode and/or the event generation
may be configured and enabled, if required.
Figure 45. 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 46. 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 45 and Figure 46.
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
SOF15 SOF14 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 r r
15.6.3 DMAMUX request line multiplexer interrupt channel clear flag register
(DMAMUX_CCFR)
Address offset: 0x084
Reset value: 0x0000 0000
This register must be written at bit level by a non-secure or secure write, according to the
secure mode of the considered DMAMUX request line multiplexer channel x, depending on
the secure control bit of the connected DMA controller channel y, and considering that the
DMAMUX x channel output is connected to the y channel of the DMA (refer to the
DMAMXUX mapping implementation section).
This register must be written at bit level by an unprivileged or privileged write, according to
the privileged mode of the considered DMAMUX request line multiplexer channel x,
depending on the privileged control bit of the connected DMA controller channel y, and
considering that the DMAMUX x channel output is connected to the y channel of the DMA
(refer to the DMAMXUX mapping implementation section).
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
CSOF CSOF CSOF CSOF CSOF CSOF CSOF CSOF CSOF CSOF CSOF CSOF CSOF CSOF CSOF CSOF
15 14 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 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]
SE
DMAMUX_C4CR SYNC_ID[4:0] NBREQ[4:0] DMAREQ_ID[6: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
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
0x13C
0x10C
0x3FC
0x0FC
0x110 -
Offset
0x148 -
0x088 -
528/2194
Reserved
Reserved
Reserved
Register
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
DMAMUX_CSR
DMAMUX_CCFR
DMAMUX_RGSR
DMAMUX_RG3CR
DMAMUX_RG2CR
DMAMUX_RG1CR
DMAMUX_RG0CR
DMAMUX_RGCFR
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 31
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 30
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 29
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 28
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 27
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 26
DMA request multiplexer (DMAMUX)
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 25
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 24
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
GNBREQ[4:0]
GNBREQ[4:0]
GNBREQ[4:0]
GNBREQ[4:0]
0
0
0
0
0
0
0
0
Res. Res. Res. Res. GPOL GPOL GPOL GPOL Res. Res. Res. 18
RM0438 Rev 7
[1:0] [1:0] [1:0]
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. CSOF15 SOF15 15
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. CSOF14 SOF14 14
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. CSOF13 SOF13 13
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. CSOF12 SOF12 12
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. CSOF11 SOF11 11
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. CSOF10 SOF10 10
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. CSOF9 SOF9 9
Res. Res. Res. Res. OIE OIE OIE OIE Res. CSOF8 SOF8 8
Table 103. DMAMUX register map and reset values (continued)
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. CSOF7 SOF7 7
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. CSOF6 SOF6 6
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. CSOF5 SOF5 5
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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
The extended interrupts and event controller (EXTI) manages the individual CPU and
system wakeup through configurable and direct event inputs. It provides wakeup requests to
the power control, and generates an interrupt request to the CPU NVIC and events to the
CPU event input. For the CPU an additional event generation block (EVG) is needed to
generate the CPU event signal.
The EXTI wakeup requests allow the system to be woken up from Stop modes.
The interrupt request and event request generation can be used also in Run modes.
The EXTI also includes the EXTI mux IOport selection.
IOPort sys_wakeup
c_wakeup PWR
Configurable event(15:0)
it_exti_per(y)*
Direct event(x)
orconfigurable event(y)
Event
Peripherals
Wakeup
c_evt_exti c_event
Trigger events Masking Pulse rxev
c_evt_rst
c_fclk nvic(x) CPU
Interrupt Direct event(x) EVG nvic(y)
EXTI
* it_exti_per(y) are only available for configurable events (y)
MSv49347V1
EXTI_SWIER
EXTI_EMR(1)
EXTI_R/FPR
EXTI_RTSR
EXTI_FTSR
EXTI_IMR
Event input
Logic implementation
type
Delay
Configurable Asynchronous Edge Rising Edge
detect Pulse ck_fclk_c
Event input(y) detection circuit hclk
generator
rst (1) c_evt_rst
CPU Event(y) Rising CPU
Rising Edge
c_event
Other CPU Events(x,y) Edge c_evt_exti
detect rst detect Pulse
generator
hclk
Synch
Other CPU Wakeups c_wakeup
CPU Wakeup(y)
1. Only for the input events that support CPU rxev generation c_event.
The software interrupt event register allows to trigger configurable events by software,
writing the corresponding register bit, irrespective of the edge selection setting.
The rising edge and falling edge selection registers allow the enabling and selection of the
configurable event active trigger edge or both edges.
The CPU has its dedicated wakeup (interrupt) mask register and a dedicated event mask
registers. The enabled event make it possible to generate an event on the CPU. All events
for a CPU are ordered together into a single CPU event signal. The event pending registers
(EXTI_RPR and EXTI_FPR) is not set for an unmasked CPU event.
The configurable events have unique interrupt pending request registers, shared by the
CPU. The pending register is only set for an unmasked interrupt. Each configurable event
provides a common interrupt to the CPU. The configurable event interrupts need to be
acknowledged by software in the EXTI_RPR and/or EXTI_FPR registers.
When a CPU wakeup (interrupt) or CPU event is enabled the asynchronous edge detection
circuit is reset by the clocked delay and rising edge detect pulse generator. This guarantees
that the EXTI hclk clock is woken up before the asynchronous edge detection circuit is reset.
Note: A detected configurable event interrupt pending request, may be cleared by any CPU with
the correct access permission. The system is not able to enter into low-power modes as
long as an interrupt pending request is active.
EXTI hclk
MS46536V1
1. Only for the input events that support CPU rxev generation c_event.
MS44726V1
The EXTIs mux outputs are available as output signals from the EXTI to trigger other IPs.
The EXTI mux outputs are available independent from any masking in EXTI_IMRx and
EXTI_EMRx.
For configurable event inputs, when the enabled edge(s) occur on the event input, an event
request is generated. When the associated CPU interrupt is unmasked the corresponding
pending bit EXTI_RPR.RPIFn and/or EXTI_FPR.FPIFn is/are set and the CPU sub-system
is woken up and CPU interrupt signal is activated. The EXTI_RPR.RPIFn and/or
EXTI_FPR.FPIFn pending bit shall be cleared by software writing it to ‘1’. This action clears
the CPU interrupt.
For direct event inputs, when enabled in the associated peripheral, an event request is
generated on the rising edge only. There is no corresponding CPU pending bit in the EXTI.
When the associated CPU interrupt is unmasked, the corresponding CPU sub-system is
woken up. The CPU is woken up (interrupted) by the peripheral synchronous interrupt.
The CPU event has to be unmasked to generate an event. When the enabled edge(s) occur
on the event input a CPU event pulse is generated. There is no event pending bit.
For the configurable event inputs an event request can be generated by software when
writing a ‘1’ in the software interrupt/event register EXTI_SWIER, allowing the generation of
a rising edge on the event. The rising edge event pending bit is set in EXTI_RPR,
irrespective of the setting in EXTI_RTSR.
EXTI_RTSR RW
EXTI_FTSR RW
Security and privilege can be bit wise enabled in
EXTI_SWIER RW
EXTI_SECCFGR and EXTI_PRIVCFGR
EXTI_RPR RW
EXTI_FPR RW
When input events are non-secure, the security is disabled. The associated input event
configuration and control bits can be modified and read by a secure access and non-secure
access.
The security configuration in registers EXTI_SECCFGR can be globally locked after reset
by EXTI_LOCKR.LOCK.
All the registers can be accessed with word (32-bit), half-word (16-bit) and byte (8-bit)
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. RT22 RT21 Res. Res. Res. Res. RT16
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
Bits 22:21 RT[22:21]: Rising trigger event configuration bit of configurable event input x(1) (where x = 18
to 22)
When SECx is disabled, RTx can be accessed with non-secure and secure access.
When SECx is enabled, RTx can only be accessed with secure access. Non-secure write to
this bit x is discarded, non-secure read returns 0.
When EXTI_PRIVCFGRn.PRIVx is disabled, RTx can be accessed with unprivileged and
privilege access.
When EXTI_PRIVCFGRn.PRIVx is enabled, RTx can only be accessed with privilege access.
Unprivileged write to this bit x is discarded, unprivileged read returns 0.
0: Rising trigger disabled (for event and Interrupt) for input line
1: Rising trigger enabled (for event and Interrupt) for input line
Bits 20:17 Reserved, must be kept at reset value.
Bits 16:0 RT[16:0]: Rising trigger event configuration bit of configurable event input x(1) (where x = 0 to
16)
When EXTI_SECCFGR SECx is disabled, RTx can be accessed with non-secure and secure
access.
When EXTI_SECCFGR SECx is enabled, RTx can only be accessed with secure access. Non-
secure write to this bit x is discarded, non-secure read returns 0.
When EXTI_PRIVCFGR PRIVx is disabled, RTx can be accessed with unprivileged and
privilege access.
When EXTI_PRIVCFGR PRIVx is enabled, RTx can only be accessed with privilege access.
Unprivileged write to this bit x is discarded, unprivileged read returns 0.
0: Rising trigger disabled (for event and Interrupt) for input line
1: Rising trigger enabled (for event and Interrupt) for input line
1. The configurable event inputs are edge triggered, no glitch must be generated on these inputs.
If a rising edge on the configurable event input occurs during writing of the register, the associated pending bit is not set.
Rising and falling edge triggers can be set for the same configurable event input. In this case, both edges generate a
trigger.
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 Res. Res. Res. Res. FT16
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
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. SWI22 SWI21 Res. Res. Res. Res. SWI16
rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SWI15 SWI14 SWI13 SWI12 SWI11 SWI10 SWI9 SWI8 SWI7 SWI6 SWI5 SWI4 SWI3 SWI2 SWI1 SWI0
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. RPIF22 RPIF21 Res. Res. Res. Res. RPIF16
rc_w1 rc_w1 rc_w1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RPIF15 RPIF14 RPIF13 RPIF12 RPIF11 RPIF10 RPIF9 RPIF8 RPIF7 RPIF6 RPIF5 RPIF4 RPIF3 RPIF2 RPIF1 RPIF0
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. FPIF22 FPIF21 Res. Res. Res. Res. FPIF16
rc_w1 rc_w1 rc_w1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
FPIF15 FPIF14 FPIF13 FPIF12 FPIF11 FPIF10 FPIF9 FPIF8 FPIF7 FPIF6 FPIF5 FPIF4 FPIF3 FPIF2 FPIF1 FPIF0
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
SEC31 SEC30 SEC29 SEC28 SEC27 SEC26 SEC25 SEC24 SEC23 SEC22 SEC21 SEC20 SEC19 SEC18 SEC17 SEC16
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
SEC15 SEC14 SEC13 SEC12 SEC11 SEC10 SEC9 SEC8 SEC7 SEC6 SEC5 SEC4 SEC3 SEC2 SEC1 SEC0
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
PRIV31 PRIV30 PRIV29 PRIV28 PRIV27 PRIV26 PRIV25 PRIV24 PRIV23 PRIV22 PRIV21 PRIV20 PRIV19 PRIV18 PRIV17 PRIV16
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
PRIV15 PRIV14 PRIV13 PRIV12 PRIV11 PRIV10 PRIV9 PRIV8 PRIV7 PRIV6 PRIV5 PRIV4 PRIV3 PRIV2 PRIV1 PRIV0
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. RT38 RT37 RT36 RT35 Res. Res. Res.
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. FT38 FT37 FT36 FT35 Res. Res. Res.
rw rw rw rw
1. The configurable event inputs are edge triggered, no glitch must be generated on these inputs.
If a falling edge on the configurable event input occurs during writing of the register, the associated pending bit is not set.
Rising and falling edge triggers can be set for the same configurable event input. In this case, both edges generate a
trigger.
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. SWI38 SWI37 SWI36 SWI35 Res. Res. Res.
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. RPIF38 RPIF37 RPIF36 RPIF35 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
Res. Res. Res. Res. Res. Res. Res. Res. Res. FPIF38 FPIF37 FPIF36 FPIF35 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
Res. Res. Res. Res. Res. SEC42 SEC41 SEC40 SEC39 SEC38 SEC37 SEC36 SEC35 SEC34 SEC33 SEC32
rw rw rw rw rw rw rw rw rw rw rw
This register provides privileged write access protection, an unprivileged write access is
discarded and causes the generation of an illegal access event. An unprivileged read
returns the register data.
Contains only register bits for security capable Input events.
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. PRIV42 PRIV41 PRIV40 PRIV39 PRIV38 PRIV37 PRIV36 PRIV35 PRIV34 PRIV33 PRIV32
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
EXTIm+3[7:0] EXTIm+2[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
EXTIm+1[7:0] EXTIm[7:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
Bits 31:24 EXTIm+3[7:0]: EXTIm+3 GPIO port selection (where m = 0, 4, 8, or 12 for respectively
EXTI_EXTICR[1:4]).
These bits are written by software to select the source input for EXTIm+3 external interrupt.
When EXTI_SECCFGR.SEC(m+3) is disabled, EXTI(m+3) can be accessed with non-secure
and secure access.
When EXTI_SECCFGR.SEC(m+3) is enabled, EXTI(m+3) can only be accessed with secure
access. Non-secure write is discarded, non-secure read returns 0.
When EXTI_PRIVCFGR.PRIV(m+3) is disabled, EXTI(m+3) can be accessed with privilege
and unprivileged access.
When EXTI_PRIVCFGR.PRIV(m+3) is enabled, EXTI(m+3) can only be accessed with
privilege access. Unprivileged write to this bit is discarded.
0x00: PA[m+3] pin
0x01: PB[m+3] pin
0x02: PC[m+3] pin
0x03: PD[m+3] pin
0x04: PE[m+3] pin
0x05: PF[m+3] pin
0x06: PG[m+3] pin
0x07: PH[m+3] pin
Others reserved
Bits 23:1 EXTIm+2[7:0]: EXTIm+2 GPIO port selection (where m = 0, 4, 8, or 12 for respectively
EXTI_EXTICR[1:4])(where m = 0, 4, 8, or 12 for respectively EXTI_EXTICR[1:4]).
These bits are written by software to select the source input for EXTIm+2 external interrupt.
When EXTI_SECCFGR.SEC(m+2) is disabled, EXTI(m+2) can be accessed with non-secure
and secure access.
When EXTI_SECCFGR.SEC(m+2) is enabled, EXTI(m+2) can only be accessed with secure
access. Non-secure write is discarded, non-secure read returns 0.
When EXTI_PRIVCFGR.PRIV(m+2) is disabled, EXTI(m+2) can be accessed with privilege
and unprivileged access.
When EXTI_PRIVCFGR.PRIV(m+2) is enabled, EXTI(m+2) can only be accessed with
privilege access. Unprivileged write to this bit is discarded.
0x00: PA[m+2] pin
0x01: PB[m+2] pin
0x02: PC[m+2] pin
0x03: PD[m+2] pin
0x04: PE[m+2] pin
0x05: PF[m+2] pin
0x06: PG[m+2] pin
0x07: PH[m+2] pin
Others reserved
Bits 15:8 EXTIm+1[7:0]: EXTIm+1 GPIO port selection (where m = 0, 4, 8, or 12 for respectively
EXTI_EXTICR[1:4]).
These bits are written by software to select the source input for EXTIm+1 external interrupt.
When EXTI_SECCFGR.SEC(m+1) is disabled, EXTI(m+1) can be accessed with non-secure
and secure access.
When EXTI_SECCFGR.SEC(m+1) is enabled, EXTI(m+1) can only be accessed with secure
access. Non-secure write is discarded, non-secure read returns 0.
When EXTI_PRIVCFGR.PRIVm+1 is disabled, EXTI(m+1) can be accessed with privilege and
unprivileged access.
When EXTI_PRIVCFGR.PRIVm+1 is enabled, EXTI(m+1) can only be accessed with privilege
access. Unprivileged write to this bit is discarded.
0x00: PA[m+1] pin
0x01: PB[m+1] pin
0x02: PC[m+1] pin
0x03: PD[m+1] pin
0x04: PE[m+1] pin
0x05: PF[m+1] pin
0x06: PG[m+1] pin
0x07: PH[m+1] pin
Others reserved
Bits 7:0 EXTIm[7:0]: EXTIm GPIO port selection (where m = 0, 4, 8, or 12 for respectively
EXTI_EXTICR[1:4]).
These bits are written by software to select the source input for EXTIm external interrupt.
When EXTI_SECCFGR.SEC(m) is disabled, EXTI(m) can be accessed with non-secure and
secure access.
When EXTI_SECCFGR.SEC(m) is enabled, EXTI(m) can only be accessed with secure
access. Non-secure write is discarded, non-secure read returns 0.
When EXTI_PRIVCFGR.PRIV(m) is disabled, EXTI(m) can be accessed with privilege and
unprivileged access.
When EXTI_PRIVCFGR.PRIV(m) is enabled, EXTI(m) can only be accessed with privilege
access. Unprivileged write to this bit is discarded
0x00: PA[m] pin
0x01: PB[m] pin
0x02: PC[m] pin
0x03: PD[m] pin
0x04: PE[m] pin
0x05: PF[m] pin
0x06: PG[m] pin
0x07: PH[m] pin
Others 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. Res. Res. Res. Res. Res. Res. Res. LOCK
rs
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
Bits 31:0 IM[31:0]: CPU wakeup with interrupt mask on event input x (1) (where x = 0 to 31).
When EXTI_SECCFGR.SECx is disabled, IMx can be accessed with non-secure and secure
access.
When EXTI_SECCFGR.SECx is enabled, IMx can only be accessed with secure access. Non-
secure write to this bit is discarded, non-secure read returns 0.
When EXTI_PRIVCFGR.PRIVx is disabled, IMx can be accessed with privilege and
unprivileged access.
When EXTI_PRIVCFGR.PRIVx is enabled, IMx can only be accessed with privilege access.
Unprivileged write to this bit is discarded.
0: Wakeup with interrupt request from input event x is masked
1: Wakeup with interrupt request from input event x is unmasked
1. The reset value for configurable event inputs is set to ‘0’ in order to disable 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
Bits 31:0 EM[31:0]: CPU wakeup with event generation mask on event input x (where x = 0 to 31).
When EXTI_SECCFGR.SECENx is disabled, EMx can be accessed with non-secure and
secure access.
When EXTI_SECCFGR.SECENx is enabled, EMx can only be accessed with secure access.
Non-secure write to this bit x is discarded, non-secure read returns 0.
When EXTI_PRIVCFGR.PRIVx is disabled, EMx can be accessed with privilege and
unprivileged access.
When EXTI_PRIVCFGR.PRIVx is enabled, EMx can only be accessed with privilege access.
Unprivileged write to this bit is discarded.
0: Wakeup with event generation from Line x is masked
1: Wakeup with event generation from Line x is unmasked
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. IM42 IM41 IM40 Res. IM38 IM37 IM36 IM35 IM34 IM33 IM32
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. EM42 EM41 EM40 Res. EM38 EM37 EM36 EM35 EM34 EM33 EM32
rw rw rw rw rw rw rw rw rw rw
Table 112. Extended interrupt/event controller register map and reset values
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
RT[22:21]
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
EXTI_RTSR1 RT[16:0]
0x000
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x038
0x030
0x028
0x024
0x020
0x018
0x010
0x008
0x004
0x02C
0x00C
Offset
562/2194
1
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
EXTI_FPR2
EXTI_FPR1
EXTI_RPR2
EXTI_RPR1
EXTI_FTSR2
EXTI_FTSR1
EXTI_RTSR2
EXTI_SWIER2
EXTI_SWIER1
EXTI_SECCFG2
EXTI_SECCFGR
EXTI_PRIVCFG2
EXTI_PRIVCFG1
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 31
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 30
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 29
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 28
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 27
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 26
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 25
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 24
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 23
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.
Extended interrupts and event controller (EXTI)
20
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 19
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 18
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
RM0438 Rev 7
17
0
0
0
0
0
0
0
0
0
0
0
0
SEC[31:0]
PRIV[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
0
0
0
0
0
Res. Res. Res. Res. Res. 10
0
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. 9
0
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. 8
FT[16:0]
0
0
0
0
0
0
0
0
Res. Res. Res. Res. Res.
SWi[16:0]
FPIF[16:0]
7
RPIF[16:0]
0
0
0
0
0
0
0
0
0
0
0
0
0
6
0
0
0
0
0
0
0
0
0
0
0
0
0 5
FT
RT
SWI
FPIF
0
0
0
0
0
0
0
0
0
0
0
0
0
RPIF
[38:35]
[38:35]
[38:35]
[38:35]
[38:35]
SEC[42:32]
PRIV[42:32]
0
0
0
0
0
0
0
0
0
0
0
0
0
3
0
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. 2
Table 112. Extended interrupt/event controller register map and reset values (continued)
0
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. 1
0
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. 0
RM0438
RM0438 Extended interrupts and event controller (EXTI)
Table 112. Extended interrupt/event controller 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
EXTI_EXTICR1 EXTI3[7:0] EXTI2[7:0] EXTI1[7:0] EXTI0[7: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
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
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
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
LOCK
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.
EXTI_LOCKR
0x070
Reset value 0
EXTI_IMR1 IM[31:0]
0x080
Reset value 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
EXTI_EMR1 EM[31:0]
0x084
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
0x088-
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
0x08C
EXTI_IMR2 IM[42:32]
0x090
Reset value 1 1 1 1 0 0 0 0 1 1 1
EXTI_EMR2 EM[42:32]
0x094
Reset value 0 0 0 0 0 0 0 0 0 0 0
18.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
IDR[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
IDR[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
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
CRC_IDR IDR[31:0]
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
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
19.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).
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
FMC_NL (or NADV)
signals
FMC_CLK
From clock NOR/PSRAM
controller NOR / PSRAM / SRAM
memory FMC_NBL[1:0]
HCLK shared signals
controller
FMC_A[25:0]
Shared signals
FMC_D[15:0]
FMC_NE[4:1]
Configuration
FMC_NOE NOR / PSRAM / SRAM
registers
NAND FMC_NWE shared signals
memory FMC_NWAIT
controller
FMC_NCE
NAND signals
FMC_INT
MS34473V3
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 19.6.6, for a
detailed description of the NOR Flash/PSRAM controller registers. Refer to Section 19.7.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.
For NAND Flash memory, the common and attribute memory spaces are subdivided into
three sections (see in Table 118 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.
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.
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
register. The FMC does not include the clock cycle when NADV is low in the data latency
count.
Caution: Some NOR Flash memories include the NADV Low cycle in the data latency count, so that
the exact relation between the NOR Flash latency and the FMC DATLAT parameter can be
either:
• NOR Flash latency = (DATLAT + 2) CLK clock cycles
• or NOR Flash latency = (DATLAT + 3) CLK clock cycles
Some recent memories assert NWAIT during the latency phase. In such cases DATLAT can
be set to its minimum value. As a result, the FMC samples the data and waits long enough
to evaluate if the data are valid. Thus the FMC detects when the memory exits latency and
real data are processed.
Other memories do not assert NWAIT during latency. In this case the latency must be set
correctly for both the FMC and the memory, otherwise invalid data are mistaken for good
data, or valid data are lost in the initial phase of the memory access.
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 70. 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.
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.
12 WREN 0x1
11 WAITCFG 0x0
10 Reserved 0x0
9 WAITPOL to be set according to memory
8 BURSTEN no effect on synchronous write
7 Reserved 0x1
6 FACCEN Set according to memory support
5-4 MWID As needed
3-2 MTYP 0x1
1 MUXEN As needed
0 MBKEN 0x1
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 72. 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 19.7.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
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
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_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.
Res.
FMC_BWTR3 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.
FMC_BWTR4 DATAST[7:0] ADDHLD[3:0] ADDSET[3:0]
0x11C [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
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
20.1 Introduction
The OCTOSPI supports most external serial memories such as serial PSRAMs, serial
NAND and serial NOR Flash memories, HyperRAM™ and HyperFlash™ memories, with
the following functional modes:
• Indirect mode: all the operations are performed using the OCTOSPI registers to preset
commands, addresses, data and transfer parameters.
• Automatic 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 the following protocols with associated frame formats:
• the Regular-command frame format with the command, address, alternate byte,
dummy cycles and data phase
• the HyperBus™ frame format
STM32 Octo-SPI
Registers/ Clock
memory
AHB control management
OCTOSPI_NCLK NCLK
OCTOSPI_CLK CLK
OCTOSPI_IO0 IO0
Data
OCTOSPI_IO1 IO1
octospi_ FIFO
OCTOSPI_IO2 IO2
ker_ck OCTOSPI_IO3 IO3
Shift OCTOSPI_IO4 IO4
register OCTOSPI_IO5 IO5
DMA signals OCTOSPI_IO6 IO6
5 OCTOSPI_IO7 IO7
Interrupts OCTOSPI_NCS NCS
OCTOSPI OCTOSPI_DQS DQS
MSv65072V2
STM32
Registers/ Clock
Quad-SPI
control management
memory 1
OCTOSPI_CLK CLK
AHB OCTOSPI_IO0 Q0/SI
Data FIFO OCTOSPI_IO1 Q1/SO
octospi_ OCTOSPI_IO2 Q2/WP
ker_ck OCTOSPI_IO3 Q3/HOLD
OCTOSPI_NCS NCS
Shift
DMA signals Quad-SPI
register
5 memory 2
Interrupts
CLK
6
OCTOSPI_IO4 Q0/SI
OCTOSPI_IO5 Q1/SO
OCTOSPI_IO6 Q2/WP
OCTOSPI_IO7 Q3/HOLD
OCTOSPI
NCS
MSv43487V3
The NCS falls before the start of each command and rises again after each command
finishes.
In Memory-mapped mode, both read and write operations are supported: as a
consequence, some of the configuration registers are duplicated to specify write operations
(read operations are configured using regular registers).
NCS
≈ ≈
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 protocol 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
ISIZE[1:0] of OCTOSPI_CCR and the instruction is programmed in INSTRUCTION[31:0] of
OCTOSPI_IR.
The instruction phase can optionally send:
• 1 bit at a time from the IO0/SO signal (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)
• 8 bits at a time (over IO0 to IO7 in Octal-SPI mode).
This can be configured using IMODE[2:0] of OCTOSPI_CCR.
The instruction can be sent in DTR (double-transfer rate) mode on each rising and falling
edge of the clock, by setting IDTR 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.
In Memory-mapped mode, the instruction used for the write operation is specified in
OCTOSPI_WIR and the instruction format is specified in OCTOSPI_WCCR. The instruction
used for the read operation and the instruction format are specified in 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 ADSIZE[1:0] of
OCTOSPI_CCR.
In Indirect and Automatic status-polling modes, the address bytes to be sent are specified in
ADDRESS[31:0] of OCTOSPI_AR. In Memory-mapped mode, the address is given directly
via the AHB (from any master in the system).
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
ABSIZE[1:0] of OCTOSPI_CCR. The bytes to be sent are specified in OCTOSPI_ABR.
The alternate-byte phase can send:
• 1 bit at a time (over SOI 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)
• 8 bits at a time (over IO0 to IO7 in Octal-SPI mode)
This can be configured using ABMODE[2:0] of OCTOSPI_CCR.
The alternate bytes can be sent in DTR mode (on each rising and falling edge of the clock)
setting ABDTR 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 OCTOSPI_IR.
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: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
OCTOSPI_WABR and the alternate byte format is specified in OCTOSPI_WCCR. The
alternate bytes used for read operation and the alternate byte format are specified in
OCTOSPI_ABR and OCTOSPI_CCR.
Dummy-cycle phase
In the dummy-cycle 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
DCYC[4:0] of OCTOSPI_TCR. In both SDR and DTR modes, the duration is specified as a
number of full CLK cycles.
When DCYC[4:0] = 00000, the dummy-cycle 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.
In Memory-mapped mode, the dummy cycles for the write operations are specified in
OCTOSPI_WTCR. The dummy cycles for the read operation are specified in
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 OCTOSPI_DLR. In
this mode, the data to be sent to the external device must be written to OCTOSPI_DR, while
in Indirect-read mode the data received from the external device is obtained by reading
OCTOSPI_DR.
In Automatic status-polling mode, the number of bytes to be received is specified in
OCTOSPI_DLR and the data received from the external device can be obtained by reading
OCTOSPI_DR.
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)
• 8 bits at a time (over IO0 to IO7 in Octal-SPI mode)
This can be configured using DMODE[2:0] of OCTOSPI_CCR.
The data can be sent or received in DTR mode (on each rising and falling edge of the clock)
setting DDTR 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
OCTOSPI_WCCR. The data format for the read operation is specified in 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.
Figure 78. DTR read in Octal-SPI mode with DQS (Macronix mode) example
NCS
≈
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, and 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 to 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, and DMODE fields in OCTOSPI_CCR and
OCTOSPI_WCCR.
In each phase configured in Quad-SPI mode:
• IO0 to IO3 are all at high-impedance (inputs) during the data phase for the read
operations, and outputs in all other cases.
• IO4 to IO7 are in output mode and forced to 0.
In the dummy phase when DMODE[2:0] = 011, IO0 to 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.
Octal-SPI mode
In regular Octal-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 Octal-SPI mode by
setting to 100 the IMODE,ADMODE, ABMODE, and DMODE fields in OCTOSPI_CCR and
OCTOSPI_WCCR.
In each phase that is configured in Octal-SPI 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 Octal-SPI mode. If none of the phases are configured to use
Octal-SPI mode, then the pins corresponding to IO[4:7] can be used for other functions even
while the OCTOSPI is active.
≈
CLK
≈
≈≈
IO[7:0] 02h FDh A[31:24] A[23:16] A[15:8] A[7:0] D0 D1 D254 D255
MSv43490V1
NCS
≈
CLK
≈ ≈ ≈
MSv43491V1
Dual-quad configuration
When DMM = 1 in OCTOSPI_CR, the OCTOSPI is in dual-memory configuration: if
DMODE = 100,two external Quad-SPI devices (device A and device B) are used in order to
send/receive eight bits (or 16 bits in DTR mode) every cycle, effectively doubling the
throughput.
Each device (A or B) uses the same CLK and NCS signals, but each has separate IO0 to
IO3 signals.
The dual-quad configuration can be used in conjunction with the Single-SPI, Dual-SPI, and
Quad-SPI modes, as well as with either the SDR or 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 configuration, twice as many
bytes must be read compared to the same read in Regular-command protocol: 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 configuration. 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 configuration. For this
reason, bit 0 of DL[31:0] in OCTOSPI_DLR is stuck at 1 when DMM = 1.
In dual-quad configuration, 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-cycle 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.
NCS
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] of OCTOSPI_DCR1.
The total size of the device is configured in DEVSIZE[4:0] of OCTOSPI_DCR1. In case of
multi-chip product (MCP), the device size is the sum of all the sizes of all the MCP dies.
During the read operation, the RWDS is used by the device, in two ways (see Figure 81):
• during the command/address phase, to request an additional latency
• during the data phase, for data strobing
During the write operation the RWDS is used:
• by the device, during the command/address phase, to request an additional latency.
• by the OCTOSPI, during the data phase, for write data masking.
NCS
CK
CK and data
Latency count are center aligned
Dn Dn Dn+1 Dn+1
DQ[7:0] 47:40 39:32 31:24 23:16 15:8 7:0 A B A B
CK
Latency count 1 Latency count 2
NCS
Additional latency
tRWR= Read write recovery
t ACC = Initial access
CK
Fixed-latency mode
Some devices or some applications may not want to operate with a variable latency time as
described above.
The latency can be forced to 2 x tACC by setting LM of OCTOSPI_HLCR.
In this OCTOSPI latency mode, the state of the RWDS signal is not taken into account by
the OCTOSPI and an additional latency is always added, leading to a fixed 2 x tACC latency
time.
NCS
CK
Command-Address Data
MSv43497V1
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
MSv43498V2
Wrap support
The OCTOSPI supports an hybrid wrap as defined by the HyperBus protocol. An hybrid
wrap is also supported in the Regular-command protocol.
In hybrid wrap, the transaction can continue after the initial wrap with an incremental
access.
The wrap size supported by the target memory is configured by WRAPSIZE in
OCTOSPI_DCR2.
Wrap is supported only in memory-read direction and only for data size = 4 bytes. Wrapped
reads are supported for both HyperBus and Regular-command protocols. To enable
wrapped-read accesses, the dedicated registers OCTOSPI_WPxxx must be programmed
according to the wrapped-read access characteristics. The dedicated OCTOSPI_WPxxx
registers apply for both HyperBus and Regular-command protocols.
If the target memory is not supporting the hybrid wrap, WRAPSIZE must be set to 0.
If APMS 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).
OCTOSPI_DR contains the latest received status bytes (FIFO deactivated). The content of
this register is not affected by the masking used in the matching logic. FTF 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 status-polling mode, variable latency is not supported. As a consequence, the
memory must be configured in fixed latency.
CKMODE indicates the level that the CLK takes between commands (when NCS = 1).
In HyperBus protocol, the device timing (tACC and tRWR) and the Latency mode must be
configured in OCTOSPI_HLCR.
In case of a match, SMF is set and an interrupt is generated if enabled; The OCTOSPI can
be automatically stopped if AMPS is set. In any case, the latest retrieved value is available
in OCTOSPI_DR.
When the OCTOSPI is used in Automatic status-polling mode, the frames are constructed in
the following way:
1. Specify the input mask in OCTOSPI_PSMKR.
2. Specify the comparison value in OCTOSPI_PSMAR.
3. Specify the read period in OCTOSPI_PIR.
4. Specify a number of data bytes to read in OCTOSPI_DLR.
5. Specify the frame timing in OCTOSPI_TCR.
6. Specify the frame format in OCTOSPI_CCR.
7. Specify the instruction in OCTOSPI_IR.
8. Specify the optional alternate byte to be sent right after the address phase in
OCTOSPI_ABR.
9. Specify the optional targeted address in OCTOSPI_AR.
If the address register (OCTOSPI_AR) does not need to be updated for a particular
command, then the command sequence starts as soon as OCTOSPI_CCR is written. This
is the case when ADMODE[2:0] = 000.
When an address is required (ADMODE[2:0] ≠ 000), the command sequence starts as soon
as the address is updated with a write to OCTOSPI_AR.
In Automatic status-polling mode, BUSY goes low only after the last periodic access is
complete, due to a match when APMS = 1 or due to an abort.
After the first access in Memory-mapped mode, BUSY goes low only on an abort.
Any operation can be aborted by setting ABORT in OCTOSPI_CR. Once the abort is
completed, BUSY and ABORT are automatically reset, and the FIFO is flushed.
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 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), NCS falls one CLK
cycle before an operation first rising CLK edge, and NCS rises one CLK cycle after the
operation final active rising CLK edge (see the figure below). Because the DTR operations
must finish with a falling edge, CLK is low when NCS rises, and 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 CLK stays low until the software services the FIFO. If an
abort occurs when an operation is stalled, NCS rises just after the abort is requested and
then CLK rises one half of a CLK cycle later (see the figure below).
NCS
SCLK
Abort
MSv44103V1
When not in dual-quad configuration (DMM = 0), only device A is accessed and thus the
BNCS stays high. In dual-quad configuration, 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
configuration, then the device B may use the ANCS and the pin outputting BNCS can be
used for other functions.
IND(2) read
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] MSEL DMM Res. Res. TCEN DMAEN ABORT EN
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. 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
DLY CKMO
Res. Res. Res. Res. Res. CSHT[2:0] Res. Res. Res. Res. Res. FRCK
BYP DE
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. WRAPSIZE[2:0]
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. 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
Res. 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
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
AD
Res. Res. ADSIZE[1:0] ADMODE[2:0] Res. Res. ISIZE[1:0] IDTR IMODE[2:0]
DTR
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
S
Res. Res. DHQC Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
SHIFT
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
AD
Res. Res. ADSIZE[1:0] ADMODE[2:0] Res. Res. ISIZE[1:0] IDTR IMODE[2:0]
DTR
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
S
Res. Res. DHQC Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res.
SHIFT
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. 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
MSEL
SMIE
DMM
PMM
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
CKMODE
DLYBYP
FRCK
MTYP CSHT
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
OCTOSPI_DCR1 DEVSIZE[4:0]
0x0008 [2:0] [2:0]
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0
WRAPSIZE
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[2:0]
OCTOSPI_DCR2 PRESCALER[7:0]
0x000C
Reset value 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.
OCTOSPI_DCR3 CSBOUND[4:0]
0x0010
Reset value 0 0 0 0 0
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-
Reserved Reserved
0x001C
BUSY
SMF
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
CSMF
CTOF
CTCF
CTEF
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.
OCTOSPI_FCR
0x0024
Reset value 0 0 0 0
0x0028-
Reserved Reserved
0x003C
OCTOSPI_DLR DL[31:0]
0x0040
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
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
0x0044 Reserved Reserved
OCTOSPI_AR ADDRESS[31:0]
0x0048
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
OCTOSPI_DR DATA[31:0]
0x0050
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
0x0054-
Reserved Reserved
0x007C
OCTOSPI_
MASK[31:0]
PSMKR
0x0080
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
OCTOSPI_
MATCH[31:0]
PSMAR
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 0 0 0 0 0 0 0 0
OCTOSPI_PIR INTERVAL[15:0]
0x0090
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x0094-
Reserved Reserved
0x00FC
ISIZE[1:0]
ADMODE
ABMODE
ADSIZE
ABSIZE
ADDTR
ABDTR
IMODE
DQSE
DDTR
SIOO
DMODE
IDTR
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[1:0]
[2:0]
[1:0]
[2:0]
[2:0]
OCTOSPI_CCR
[2:0]
0x0100
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
DHQC
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.
OCTOSPI_TCR DCYC[4:0]
0x0108
Reset value 0 0 0 0 0 0 0
OCTOSPI_IR INSTRUCTION[31:0]
0x0110
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
0x0114-
Reserved Reserved
0x011C
OCTOSPI_ABR ALTERNATE[31:0]
0x0120
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
0x0124-
Reserved Reserved
0x012C
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
OCTOSPI_LPTR TIMEOUT[15:0]
0x0130
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0x0134-
Reserved Reserved
0x013C
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
ADMODE
ABMODE
ADSIZE
ABSIZE
ADDTR
ABDTR
IMODE
DQSE
DDTR
ISIZE
OCTOSPI_ DMODE
IDTR
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[1:0]
[2:0]
[1:0]
[2:0]
[1:0]
[2:0]
WPCCR [2:0]
0x0140
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
OCTOSPI_ DHQC
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.
DCYC[4:0]
WPTCR
0x0148
Reset value 0 0 0 0 0 0 0
OCTOSPI_WPIR INSTRUCTION[31:0]
0x0150
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
0x0154-
Reserved Reserved
0x015C
OCTOSPI_
ALTERNATE[31:0]
WPABR
0x0160
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
0x0164-
Reserved Reserved
0x017C
ADMODE
ABMODE
ADSIZE
ABSIZE
ADDTR
ABDTR
IMODE
DQSE
DDTR
ISIZE
DMODE
IDTR
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
[1:0]
[2:0]
[1:0]
[2:0]
[1:0]
[2:0]
OCTOSPI_WCCR
[2:0]
0x0180
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
OCTOSPI_WIR INSTRUCTION[31:0]
0x0190
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
0x0194-
Reserved Reserved
0x019C
OCTOSPI_WABR ALTERNATE[31:0]
0x01A0
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
0x01A4-
Reserved Reserved
0x01FC
WZL
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
LM
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 20 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 performance 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 91 shows the block diagram of one ADC.
Dual mode X X
DFSDM interface X X
SMPPLUS control - -
Cortex
AREADY
M4 with
EOSMP
ADC Interrupt FPU
EOC
EOS IRQ
OVR
RDATA[11:0] JEOS master
AHB
JQOVF slave
AWDx
ADEN/ADDIS
JDATA1[11:0] master
JAUTO Analog Supply (VDDA)
1.62V to 3.6 V JDATA2[11:0]
JDATA3[11:0] DMA
ADC_JSQRx
JDATA4[11:0] AHB
ADC_SQRx
interface DMA request
CONT
single/cont
DFSDM
VTS Bias & Ref 16
VREFINT ADCAL
self calibration Oversampler DMACFG
VBAT/3 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] TROVS
DATA
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 at AWD2 AWD2_OUT ETR
EXTSEL[3:0] AWD3 AWD3_OUT
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 at AWDCH3[18:0]
product level HT2[7:0]
JEXTSEL[3:0]
trigger selection HT3[7:0]
LT3[7:0]
MSv43755V5
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.
Connected either to ADCx_INPi external channels or
Positive analog input
VINPi to internal channels. This input is converted in single-
channels for each ADC
ended mode
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−
MSv50651V1
ADC2
Channel selection
VINP[0]
Reserved
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−
VINP[17]
dac_out1
VINN[17] Slow channel
VREF−
VINP[18]
dac_out2
VINN[18] Slow channel
VREF−
MSv50650V1
negative input differential voltage (VREF-) corresponds to 0x000 ADC output. When VINP[i]
equals VREF+, VINN[i] equals VREF- and the maximum positive input differential voltage
(VREF+) corresponds to 0xFFF ADC output. When VINP[i] and VINN[i] are connected together,
the zero input differential voltage corresponds to 0x800 ADC output.
The ADC sensitivity in differential mode is twice smaller than in single-ended mode.
When ADC is configured as differential mode, both inputs should be biased at (VREF+) / 2
voltage. Refer to the device datasheet for the allowed common mode input voltage VCMIN.
The input signals are supposed to be differential (common mode voltage should be fixed).
Internal channels (such as VTS and VREFINT) are used in single-ended mode only.
For a complete description of how the input channels are connected for each ADC, refer to
Section 21.4.4: ADC1/2 connectivity.
Caution: When configuring the channel “i” in differential input mode, its negative input voltage VINN[i]
is connected to another channel. As a consequence, this channel is no longer usable in
single-ended mode or in differential mode and must never be configured to be converted.
Some channels are shared between ADC1/ADC2: this can make the channel on the other
ADC unusable. Only exception is interleaved mode for ADC master and the slave.
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)
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 by Cleared
JADSTART SW INJECTED CONVERSIONS ongoing by HW
(software is not allowed to configure injected conversions selection and triggers)
Set by Cleared
JADSTP SW by HW
Set by Cleared
ADSTART SW REGULAR CONVERSIONS ongoing by HW
(software is not allowed to configure regular conversions selection and triggers)
Set by Cleared
ADSTP SW by HW
MS30534V1
Table 159. Configuring the trigger polarity for regular external triggers
EXTEN[1:0] Source
Table 160. 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 102. 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 161 to Table 162 give all the possible external triggers of the three ADCs for regular
and injected conversions.
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 103 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 30 ADC clock
cycles (that is two conversions with a sampling time of 2.5 clock periods), the minimum
interval between triggers must be 31 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 106. 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 107. 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 108. 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 109. 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
by SW by HW Indicative timings
MS30549V1
1. EXTEN[1:0]=00, CONT=0
2. Channels selected = 1,9, 10, 17; AUTDLY=0.
ADCSTART(1)
EOC
EOS
ADSTP
ADC state(2) READY CH1 CH9 CH10 CH17 CH1 CH9 CH10 STP READY CH1 CH9
by SW by HW Indicative timings
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
MS31013V2
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
MS31014V2
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 166 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 120, Figure 121, Figure 122 and Figure 123 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
by SW by HW
Indicative timings
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
Injected Ignored
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
by SW by HW Indicative timings
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
RDY CH1 DLY CH2 DLY CH5 CH6 DLY CH3 DLY CH1
state
regular regular injected injected regular
DLY (CH1) DLY (CH2) regular
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 read access
ADC_DR D1 D2 D3
JEOS
ADC_JDR1 D5
ADC_JDR2 D6
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
MS45396V1
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 166 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 132. 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 136 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 168 gives the data format for the various N and M combinations, for a raw conversion
data equal to 0xFFF.
Table 168. 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 follows:
• 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 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.
Figure 137 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 141 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
Sampling End of injected sequence on
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.
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 145. Interleaved mode on 1 channel in continuous conversion mode: dual ADC
mode
SLAVE ADC
CH1 CH1
Trigger
Conversion
MSv31030V3
Figure 146. 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
4th trigger
JEOC on JEOC on JEOC, JEOS
Sampling slave ADC slave ADC on slave ADC
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 149. Alternate trigger: 4 injected channels (each ADC) in discontinuous mode
MASTER ADC
SLAVE ADC
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.
1st trigger
ADC MASTER reg CH1 CH2 CH3 CH3 CH4 CH4 CH5
ADC MASTER inj CH1
ADC SLAVE reg CH4 CH6 CH7 CH7 CH8 CH8 CH9
ADC SLAVE inj CH1
synchronization not lost
2nd trigger
ai16062V2-m
If a trigger occurs during an injected conversion that has interrupted a regular conversion,
the alternate trigger is served. Figure 151 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
Figure 152. Interleaved single channel CH0 with injected sequence CH11, CH12
Legend:
Injected trigger Resume
(always restart with the master)
Sampling Conversion
MS34461V1
Figure 153. 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 154. 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 158 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 VREF+ 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 VREF+ voltage supplying the device:
Where:
• VREF+_Charac is the value of VREF+ voltage characterized at VREFINT during the
manufacturing process. It is specified in the device datasheet.
• VREFINT_CAL is the VREFINT calibration value
• VREFINT_DATA is the actual VREFINT output value converted by ADC
V REF+
V CHANNELx = ------------------------------------- × ADC_DATA
FULL_SCALE
By replacing VREF+ by the formula provided above, the absolute voltage value is given by
the following formula
V REF+_Charac × VREFINT_CAL × ADC_DATA
V CHANNELx = -----------------------------------------------------------------------------------------------------------------------
VREFINT_DATA × FULL_SCALE
For applications where VREF+ is known and ADC converted values are right-aligned, the
absolute voltage value can be obtained by using the following formula:
V REF+
V CHANNELx = ------------------------------------- × ADC_DATA
FULL_SCALE
Where:
– VREF+_Charac is the value of VREF+ 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
Res. Res. SMP9[2:0] SMP8[2:0] SMP7[2:0] SMP6[2:0] SMP5[2:1]
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
Bits 7:6 JEXTEN[1:0]: External Trigger Enable and Polarity Selection for injected channels
These bits are set and cleared by software to select the external trigger polarity and enable
the trigger of an injected group.
00: If JQDIS=0 (queue enabled), Hardware and software trigger detection disabled
00: If JQDIS=1 (queue disabled), Hardware trigger detection disabled (conversions can be
launched by software)
01: Hardware trigger detection on the rising edge
10: Hardware trigger detection on the falling edge
11: Hardware trigger detection on both the rising and falling edges
Note: The software is allowed to write these bits only when JADSTART=0 (which ensures
that no injected conversion is ongoing).
If JQM=1 and if the Queue of Context becomes empty, the software and hardware
triggers of the injected sequence are both internally disabled (refer to Section 21.4.21:
Queue of context for injected conversions)
Bits 5:2 JEXTSEL[3:0]: External Trigger Selection for injected group
These bits select the external event used to trigger the start of conversion of an injected
group:
0000: Event 0
0001: Event 1
0010: Event 2
0011: Event 3
0100: Event 4
0101: Event 5
0110: Event 6
0111: Event 7
...
1111: Event 15
Note: The software is allowed to write these bits only when JADSTART=0 (which ensures
that no injected conversion is ongoing).
Bits 1:0 JL[1:0]: Injected channel sequence length
These bits are written by software to define the total number of conversions in the injected
channel conversion sequence.
00: 1 conversion
01: 2 conversions
10: 3 conversions
11: 4 conversions
Note: The software is allowed to write these bits only when JADSTART=0 (which ensures
that no injected conversion is ongoing).
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 173. 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
SMP9 SMP8 SMP7 SMP6 SMP5 SMP4 SMP3 SMP2 SMP1 SMP0
Res.
Res.
ADC_SMPR1
0x14 [2:0] [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 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 173. 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
JEXTEN[1:0]
Res. JEXTSEL
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.
Res.
ADC_OFR3 OFFSET3[11:0]
0x68 CH[4:0]
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
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
Table 173. 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.
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 174. 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
CKMODE[1:0]
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 DACx_OUTy 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
DACx_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
DACx_OUT2
TRIG
DAC
DAC_DOR2 Buffer 2
converter 2
12-bit
1
MODE2 bits
dac_out2
DAC channel 2
VSSA
MSv40461V4
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
DACx_OUTy Analog output signal DACx channely 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 164. 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 166. 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 168. 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 DACx_OUTy 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
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
RM0438
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 182 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
RM0438 Rev 7
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 182. 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
833/2194
Digital-to-analog converter (DAC)
834
0x48
0x44
0x40
0x38
0x4C
0x3C
Offset
834/2194
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]
RM0438 Rev 7
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
RM0438
RM0438 Voltage reference buffer (VREFBUF)
23.1 Introduction
The 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.
setting, the software must take care of copying the calibration data from the read-only
system memory area (Flash memory) to the TRIM register.
Optionally user can trim the output voltage by changing the TRIM register bits.
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
VRS
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.
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 Comparator (COMP)
24.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 00
PB2 01
PA2 10
¼ 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
insure that the comparator programming cannot be altered in case of spurious register
access or program counter corruption.
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
24.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
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. 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
25.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 176. 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 177. 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
25.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 194: 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.
Refer to Section 2.3.2: Memory map and register boundary addresses for the register
boundary addresses.
26.1 Introduction
Digital filter for sigma delta modulators (DFSDM) is a high-performance module dedicated
to interface external Σ∆ modulators. It is featuring up to 4 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 4 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 4 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 4
Number of filters 4
Input from internal ADC X
Supported trigger sources 32(1)
Pulses skipper X
ID registers support -
1. Refer to Table 200: DFSDM triggers connection for available trigger sources.
ADC 3
Sample 1 Sample 0 16
Parallel input data
register 0
Sample 1 Sample 0
16
Parallel input data
register 3
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 3
4 watchdog filters
4 watchdog comparators Right bit-shift
count
Config
Status
APB bus
dfsdm_jtrg0 TIM1_TRGO
dfsdm_jtrg1 TIM1_TRGO2
dfsdm_jtrg2 TIM8_TRGO
dfsdm_jtrg3 TIM8_TRGO2
dfsdm_jtrg[23:9] Reserved
dfsdm_jtrg24 EXTI11
dfsdm_jtrg25 EXTI15
dfsdm_jtrg26 LPTIMER1
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 9.8.32: RCC peripherals independent clock configuration register 2
(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 ).
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
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 183 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[3: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.
to empty data register after it has been filled by CPU/DMA. This mode is used together
with 16-bit CPU/DMA access to DFSDM_CHyDATINR register to load one sample per
write operation.
2. Interleaved mode (DATPACK[1:0]=1):
DFSDM_CHyDATINR register is used as a two sample buffer. The first sample is
stored in INDAT0[15:0] and the second sample is stored in INDAT1[15:0]. The digital
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). If odd channel (y = 1, 3) 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 184 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
MSv40123V1
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[3: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[3: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 4 channels. RCH[1: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 202. 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 203. 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[3: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[3: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[3:0], AWLTF[3: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[3:0] = 0x0F). 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[3: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[3:0] and AWLTF[3: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[3:0], status clearing bits CLRSCDF[3: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[3:0])
– indicated in AWDF bit in DFSDM_FLTxISR register
– separate indication of high or low analog watchdog threshold error by AWHTF[3:0]
and AWLTF[3:0] fields in DFSDM_FLTxAWSR register
– cleared by writing ‘1’ into corresponding CLRAWHTF[3:0] or CLRAWLTF[3: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[3: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[3: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 26.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. Res. RCH[1:0] Res. Res. Res. RSYNC Res.
SEL EN T START
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 200: 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
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. AWDCH[3:0]
rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CKAB ROVR JOVR REOC JEOC
Res. Res. Res. Res. EXCH[3:0] Res. SCDIE AWDIE
IE IE 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
Res. Res. Res. Res. SCDF[3:0] Res. Res. Res. Res. CKABF[3:0]
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
Res. Res. Res. Res. CLRSCDF[3:0] Res. Res. Res. Res. CLRCKABF[3: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
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. JCHG[3:0]
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
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
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
Res. Res. Res. Res. AWHTF[3:0] Res. Res. Res. Res. AWLTF[3:0]
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
Res. Res. Res. Res. CLRAWHTF[3:0] Res. Res. Res. Res. CLRAWLTF[3:0]
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
914/2194
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
RM0438 Rev 7
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
0x6C
0xFC
0x114
0x110
0x108
0x104
0x100
0x78 -
0x10C
Offset
RM0438
name
FLT0ISR
FLT0ICR
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
Reserved
FLT0CR2
FLT0CR1
FLT0FCR
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
CH3CFGR2
CH3CFGR1
CH3WDATR
CH3DATINR
FLT0JCHGR
CH3AWSCDR
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 31
0
0
0
0
FORD[2:0] Res. Res. Res. Res. AWFSEL Res. Res. Res. Res. Res. 30
0
0
0
0
Res. Res. Res. Res. FAST Res. Res. Res. Res. Res. 29
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 28
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. 27
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. 26
[3:0]
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. 25
RCH[1:0]
SCDF[3:0]
CLRSCDF
0
0
0
0
0
0
0
0
0
0
0
0
0
0
INDAT1[15:0]
22
0
0
0
0
Res. Res. Res. Res. RDMAEN Res. Res. Res. Res. Res. 21
0
0
0
0
FOSR[9:0]
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
18
[3:0]
0
0
1
0
0
0
0
0
RM0438 Rev 7
17
AWFOSR[4:0]
CKABF[3:0]
CLRCKABF
0
0
1
0
0
0
0
AWDCH[3:0]
Res. Res. Res. Res. Res. Res. 16
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
JEXTSEL[4:0]
EXCH[3: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
CLR ROVRF ROVRF ROVRIE JSYNC Res. 3
SPICKSEL[1:0]
IOSR[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]
JCHG[3:0]
0
0
0
0
0
0
0
0
1
0
915/2194
920
Digital filter for sigma delta modulators (DFSDM) RM0438
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 [1:0]
DFSDM_
Res.
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
RDATACH[1:0]
RPEND
DFSDM_
Res.
Res.
Res.
Res.
Res.
RDATA[23: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
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.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
AWHTF[3:0] AWLTF[3:0]
0x128 FLT0AWSR
reset value 0 0 0 0 0 0 0 0
DFSDM_ CLRAWHTF CLRAWLTF
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
0x12C FLT0AWCFR [3:0] [3:0]
reset value 0 0 0 0 0 0 0 0
EXMAXCH[1:0]
DFSDM_
Res.
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
EXMINCH[1:0]
DFSDM_
Res.
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
DFSDM_
Res.
Res.
Res.
Res.
CNVCNT[27:0]
0x138 FLT0CNVTIMR
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
RCH[1:0]
JDMAEN
AWFSEL
RCONT
RSYNC
JSCAN
JSYNC
DFEN
DFSDM_
FAST
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
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
REOCIE
ROVRIE
JOVRIE
JEOCIE
AWDIE
DFSDM_
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
AWDCH[3:0] EXCH[3:0]
0x184 FLT1CR2
reset value 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
name
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
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.
Res.
Res.
Res.
Res.
JCHG[3:0]
0x190 FLT1JCHGR
reset value 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[1:0]
DFSDM_
Res.
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
RDATACH[1:0]
RPEND
DFSDM_
Res.
Res.
Res.
Res.
Res.
RDATA[23: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
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.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
AWHTF[3:0] AWLTF[3:0]
0x1A8 FLT1AWSR
reset value 0 0 0 0 0 0 0 0
DFSDM_ CLRAWHTF CLRAWLTF
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
DFSDM_
Res.
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
EXMINCH[1:0]
DFSDM_
Res.
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
0x21C
0x20C
0x1FC
0x1BC -
Offset
918/2194
name
DFDM_
FLT2ISR
FLT2ICR
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
DFSDM_
Reserved
FLT2CR2
FLT2CR1
FLT2FCR
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
FLT2AWSR
FLT2AWLTR
FLT2JCHGR
FLT2AWHTR
FLT2JDATAR
FLT2RDATAR
FLT1CNVTIMR
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. 0 31
0
0
0
0
0
0
0
Res. FORD[2:0] Res. Res. Res. Res. AWFSEL Res. 30
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
FOSR[9:0]
0
0
0
0
0
0
0
0
AWLT[23:0]
AWHT[23:0]
JDATA[23:0]
0
0
0
0
0
0
0
0
RDATA[23:0]
Res. Res. Res. Res. RCONT Res. 18
0
0
0
0
0
0
0
0
RM0438 Rev 7
17
0
0
0
0
0
0
0
AWDCH[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
EXCH[3:0]
AWHTF[3:0]
0
0
0
0
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 7
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 6
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. JDMAEN Res. 5
0
0
0
0
0
Res. Res. Res. RPEND Res. Res. Res. AWDF AWDIE JSCAN Res. 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
AWLTF[3:0]
BKAWL[3:0]
0
0
0
0
0
0
0
0
0
BKAWH[3:0]
Res. JEOCF JEOCIE DFEN Res. Res. 0
RM0438
0x298
0x294
0x290
0x288
0x284
0x280
0x238
0x234
0x230
0x28C
0x27C
0x22C
0x23C -
Offset
RM0438
name
FLT3ISR
FLT3ICR
DFSDM_
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
reset value
Register
FLT2EXMIN
FLT3JCHGR
FLT2EXMAX
FLT2AWCFR
FLT3JDATAR
FLT2CNVTIMR
0
0
0
0
1
Res. Res. Res. Res. Res. Res. Res. 31
0
0
0
0
1
0
FORD[2:0] Res. Res. Res. Res. AWFSEL Res. Res. 30
0
0
0
0
1
0
Res. Res. Res. Res. FAST Res. Res. 29
0
0
1
0
Res. Res. Res. Res. Res. Res. Res. Res. 28
0
0
1
0
Res. Res. Res. Res. Res. Res. Res. Res. 27
0
0
1
0
Res. Res. Res. Res. Res. Res. Res. Res. 26
0
0
0
0
1
0
Res. Res. Res. Res. Res. Res. 25
RCH[1:0]
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
1
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]
18
0
0
0
0
0
1
0
RM0438 Rev 7
17
0
0
0
0
1
0
AWDCH[3:0]
Res. Res. Res. Res. Res. Res. 16
CNVCNT[27:0]
0
0
1
0
0
0
1
0
0
0
Res. Res. Res. RCIP Res. Res. Res. 14
JEXTEN[1:0]
0
0
1
0
0
0
Res. Res. Res. JCIP Res. Res. Res. 13
0
0
0
1
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
EXCH[3:0]
CLRAWHTF
0
0
1
0
0
0
0
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 7
0
0
Res. Res. Res. Res. Res. Res. Res. Res. Res. Res. 6
0
0
0
Res. Res. Res. Res. Res. JDMAEN Res. Res. Res. Res. 5
0
0
0
0
0
Res. Res. Res. AWDF AWDIE JSCAN Res. Res. Res. Res. 4
0
0
0
0
0
0
0
Res. CLR ROVRF ROVRF ROVRIE JSYNC Res. Res. Res. Res. 3
IOSR[7:0]
0
0
0
0
0
0
Res. CLR JOVRF JOVRF JOVRIE Res. Res. Res. Res. Res. 2
[3:0]
0
0
0
0
0
0
0
0
0
JCHG[3:0]
CLRAWLTF
0
0
0
0
0
0
0
1
0
919/2194
920
Digital filter for sigma delta modulators (DFSDM) RM0438
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
RDATACH[1:0]
RPEND
DFSDM_
Res.
Res.
Res.
Res.
Res.
RDATA[23: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
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.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
AWHTF[3:0] AWLTF[3:0]
0x2A8 FLT3AWSR
reset value 0 0 0 0 0 0 0 0
DFSDM_ CLRAWHTF CLRAWLTF
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
0x2AC FLT3AWCFR [3:0] [3:0]
reset value 0 0 0 0 0 0 0 0
EXMAXCH[1:0]
DFSDM_
Res.
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
EXMINCH[1:0]
DFSDM_
Res.
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
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
27.1 Introduction
The touch sensing controller provides a simple solution for adding capacitive sensing
functionality to any application. Capacitive sensing technology is able to detect finger
presence near an electrode that is protected from direct touch by a dielectric (for example
glass, plastic). The capacitive variation introduced by the finger (or any conductive object) is
measured using a proven implementation based on a surface charge transfer acquisition
principle.
The touch sensing controller is fully supported by the STMTouch touch sensing firmware
library, which is free to use and allows touch sensing functionality to be implemented reliably
in the end application.
SYNC
TSC_IOG1CR
TSC_IOG2CR
Gx_IO1
Gx_IO2
Gx_IO3
TSC_IOGxCR
Gx_IO4
MS30929V1
Electrode 1 Analog
RS1 I/O group
G1_IO1
CX1
G1_IO2
CS
Electrode 2
RS2
G1_IO3
CX2
Electrode 3 RS3
G1_IO4
CX3
MS30930V1
Note: Gx_IOy where x is the analog I/O group number and y the GPIO number within the selected
group.
The surface charge transfer acquisition principle consists of charging an electrode
capacitance (CX) and transferring a part of the accumulated charge into a sampling
capacitor (CS). This sequence is repeated until the voltage across CS reaches a given
threshold (VIH in our case). The number of charge transfers required to reach the threshold
is a direct representation of the size of the electrode capacitance.
Table 206 details the charge transfer acquisition sequence of the capacitive sensing
channel 1. States 3 to 7 are repeated until the voltage across CS reaches the given
threshold. The same sequence applies to the acquisition of the other channels. The
electrode serial resistor RS improves the ESD immunity of the solution.
Output open-
Input floating
drain low with Input floating with analog switch Discharge all CX and
#1 with analog
analog switch closed CS
switch closed
closed
#2 Input floating Dead time
Output push-
#3 Input floating Charge CX1
pull high
#4 Input floating Dead time
Input floating with analog switch Charge transfer from
#5 Input floating
closed CX1 to CS
#6 Input floating Dead time
#7 Input floating Measure CS voltage
The voltage variation over the time on the sampling capacitor CS is detailed below:
VDD
Threshold =VIH
t
Burst duration
MS30931V1
CLK_AHB
CX HiZ
CS HiZ
CS reading
Pulse low
Pulse high
Discharge state (charge Pulse high Pulse low
State CX and CS
state
transfer from state state
(charge of CX)
CX to CS)
t
MSv30932V3
For higher flexibility, the charge transfer frequency is fully configurable. Both the pulse high
state (charge of CX) and the pulse low state (transfer of charge from CX to CS) duration can
be defined using the CTPH[3:0] and CTPL[3:0] bits in the TSC_CR register. The standard
range for the pulse high and low states duration is 500 ns to 2 µs. To ensure a correct
measurement of the electrode capacitance, the pulse high state duration must be set to
ensure that CX is always fully charged.
A dead time where both the sampling capacitor I/O and the channel I/O are in input floating
state is inserted between the pulse high and low states to ensure an optimum charge
transfer acquisition sequence. This state duration is 1 periods of HCLK.
At the end of the pulse high state and if the spread spectrum feature is enabled, a variable
number of periods of the SSCLK clock are added.
The reading of the sampling capacitor I/O, to determine if the voltage across CS has
reached the given threshold, is performed at the end of the pulse low state.
Note: The following TSC control register configurations are forbidden:
• bits PGPSC are set to ‘000’ and bits CTPL are set to ‘0000’
• bits PGPSC are set to ‘000’ and bits CTPL are set to ‘0001’
• bits PGPSC are set to ‘001’ and bits CTPL are set to ‘0000’
Deviation value
(SSD +1)
1
0 n-1 n n+1
Number of pulses
MS30933V1
The table below details the maximum frequency deviation with different HCLK settings:
The spread spectrum feature can be disabled/enabled using the SSE bit in the TSC_CR
register. The frequency deviation is also configurable to accommodate the device HCLK
clock frequency and the selected charge transfer frequency through the SSPSC and
SSD[6:0] bits in the TSC_CR register.
Table 208. I/O state depending on its mode and IODEF bit value
Sampling
Acquisition Unused I/O Channel I/O
IODEF bit capacitor I/O
status mode mode
mode
Sleep No effect. Peripheral interrupts cause the device to exit Sleep mode.
Low power run No effect.
Low power sleep No effect. Peripheral interrupts cause the device to exit Low-power sleep mode.
Stop 0 / Stop 1
Peripheral registers content is kept.
Stop 2
Standby Powered-down. The peripheral must be reinitialized after exiting Standby or
Shutdown Shutdown mode.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
CTPH[3:0] CTPL[3:0] SSD[6:0] SSE
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
SYNC
SSPSC PGPSC[2:0] Res. Res. Res. Res. MCV[2:0] IODEF AM START TSCE
POL
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. MCEIE EOAIE
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. MCEIC EOAIC
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. MCEF EOAF
r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
G8_IO4 G8_IO3 G8_IO2 G8_IO1 G7_IO4 G7_IO3 G7_IO2 G7_IO1 G6_IO4 G6_IO3 G6_IO2 G6_IO1 G5_IO4 G5_IO3 G5_IO2 G5_IO1
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
G4_IO4 G4_IO3 G4_IO2 G4_IO1 G3_IO4 G3_IO3 G3_IO2 G3_IO1 G2_IO4 G2_IO3 G2_IO2 G2_IO1 G1_IO4 G1_IO3 G1_IO2 G1_IO1
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
G8_IO4 G8_IO3 G8_IO2 G8_IO1 G7_IO4 G7_IO3 G7_IO2 G7_IO1 G6_IO4 G6_IO3 G6_IO2 G6_IO1 G5_IO4 G5_IO3 G5_IO2 G5_IO1
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
G4_IO4 G4_IO3 G4_IO2 G4_IO1 G3_IO4 G3_IO3 G3_IO2 G3_IO1 G2_IO4 G2_IO3 G2_IO2 G2_IO1 G1_IO4 G1_IO3 G1_IO2 G1_IO1
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
G8_IO4 G8_IO3 G8_IO2 G8_IO1 G7_IO4 G7_IO3 G7_IO2 G7_IO1 G6_IO4 G6_IO3 G6_IO2 G6_IO1 G5_IO4 G5_IO3 G5_IO2 G5_IO1
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
G4_IO4 G4_IO3 G4_IO2 G4_IO1 G3_IO4 G3_IO3 G3_IO2 G3_IO1 G2_IO4 G2_IO3 G2_IO2 G2_IO1 G1_IO4 G1_IO3 G1_IO2 G1_IO1
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
G8_IO4 G8_IO3 G8_IO2 G8_IO1 G7_IO4 G7_IO3 G7_IO2 G7_IO1 G6_IO4 G6_IO3 G6_IO2 G6_IO1 G5_IO4 G5_IO3 G5_IO2 G5_IO1
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
G4_IO4 G4_IO3 G4_IO2 G4_IO1 G3_IO4 G3_IO3 G3_IO2 G3_IO1 G2_IO4 G2_IO3 G2_IO2 G2_IO1 G1_IO4 G1_IO3 G1_IO2 G1_IO1
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. G8S G7S G6S G5S G4S G3S G2S G1S
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. Res. Res. Res. Res. Res. Res. Res. G8E G7E G6E G5E G4E G3E G2E G1E
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
r r r r r r r r r r r r r r
0x0024
0x0014
0x002C
0x001C
0x000C
Offset
938/2194
27.6.11
TSC_CR
TSC_ISR
TSC_IER
TSC_ICR
Register
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
Reset value
TSC_IOSCR
TSC_IOCCR
TSC_IOHCR
TSC_IOG2CR
TSC_IOG1CR
TSC_IOASCR
TSC_IOGCSR
0
0
0
1
0
Res. Res. Res. G8_IO4 G8_IO4 G8_IO4 G8_IO4 Res. Res. Res. 31
0
0
0
1
0
Res. Res. Res. G8_IO3 G8_IO3 G8_IO3 G8_IO3 Res. Res. Res. 30
0
0
0
1
0
Res. Res. Res. G8_IO2 G8_IO2 G8_IO2 G8_IO2 Res. Res. Res. 29
CTPH[3:0]
0
0
0
1
0
Res. Res. Res. G8_IO1 G8_IO1 G8_IO1 G8_IO1 Res. Res. Res. 28
0
0
0
1
Res. Res. Res. G7_IO4 G7_IO4 G7_IO4 G7_IO4 Res. Res. Res. 0
Touch sensing controller (TSC)
27
TSC register map
0
0
0
1
0
Res. Res. Res. G7_IO3 G7_IO3 G7_IO3 G7_IO3 Res. Res. Res. 26
0
0
0
1
0
Res. Res. Res. G7_IO2 G7_IO2 G7_IO2 G7_IO2 Res. Res. Res. 25
CTPL[3:0]
0
0
0
1
0
Res. Res. Res. G7_IO1 G7_IO1 G7_IO1 G7_IO1 Res. Res. Res. 24
0
0
0
0
1
0
Res. Res. G8S G6_IO4 G6_IO4 G6_IO4 G6_IO4 Res. Res. Res. 23
0
0
0
0
1
0
Res. Res. G7S G6_IO3 G6_IO3 G6_IO3 G6_IO3 Res. Res. Res. 22
0
0
0
0
1
0
Res. Res. G6S G6_IO2 G6_IO2 G6_IO2 G6_IO2 Res. Res. Res. 21
0
0
0
0
1
0
Res. Res. G5S G6_IO1 G6_IO1 G6_IO1 G6_IO1 Res. Res. Res. 20
0
0
0
0
1
0
SSD[6:0]
Res. Res. G4S G5_IO4 G5_IO4 G5_IO4 G5_IO4 Res. Res. Res. 19
0
0
0
0
1
0
Res. Res. G3S G5_IO3 G5_IO3 G5_IO3 G5_IO3 Res. Res. Res. 18
RM0438 Rev 7
0
0
0
0
1
0
Reserved
Reserved
Reserved
Reserved
Res. Res. G2S G5_IO2 G5_IO2 G5_IO2 G5_IO2 Res. Res. Res. 17
0
0
0
0
1
0
Res. Res. G1S G5_IO1 G5_IO1 G5_IO1 G5_IO1 Res. Res. Res. SSE 16
0
0
0
1
0
Res. Res. Res. G4_IO4 G4_IO4 G4_IO4 G4_IO4 Res. Res. Res. SSPSC 15
0
0
0
1
0
Res. Res. Res. G4_IO3 G4_IO3 G4_IO3 G4_IO3 Res. Res. Res. 14
0
0
0
1
0
0
0
Res. G4_IO2 G4_IO2 G4_IO2 G4_IO2 Res. Res. Res. PGPSC[2:0] 13
0
0
0
1
0
0
0
Res. G4_IO1 G4_IO1 G4_IO1 G4_IO1 Res. Res. Res. 12
0
0
0
1
0
0
Res. G3_IO4 G3_IO4 G3_IO4 G3_IO4 Res. Res. Res. Res. 11
Table 211. TSC register map and reset values
0
0
0
1
0
0
Res. G3_IO3 G3_IO3 G3_IO3 G3_IO3 Res. Res. Res. Res. 10
0
0
0
1
0
0
Res. G3_IO2 G3_IO2 G3_IO2 G3_IO2 Res. Res. Res. Res. 9
0
0
0
1
0
0
Res. G3_IO1 G3_IO1 G3_IO1 G3_IO1 Res. Res. Res. Res. 8
0
0
0
1
0
0
0
0
G8E G2_IO4 G2_IO4 G2_IO4 G2_IO4 Res. Res. Res. 7
0
0
0
1
0
0
0
0
G7E G2_IO3 G2_IO3 G2_IO3 G2_IO3 Res. Res. Res. 6
[2:0]
MCV
CNT[13:0]
CNT[13:0]
0
0
0
1
0
0
0
0
G6E G2_IO2 G2_IO2 G2_IO2 G2_IO2 Res. Res. Res. 5
0
0
0
1
0
0
0
0
G5E G2_IO1 G2_IO1 G2_IO1 G2_IO1 Res. Res. Res. IODEF 4
0
0
0
1
0
0
0
0
G4E G1_IO4 G1_IO4 G1_IO4 G1_IO4 Res. Res. Res. SYNCPOL 3
0
0
0
1
0
0
0
0
G3E G1_IO3 G1_IO3 G1_IO3 G1_IO3 Res. Res. Res. AM 2
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
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.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
TSC_IOG3CR CNT[13:0]
0x003C
Reset value Res. 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.
TSC_IOG4CR CNT[13:0]
0x0040
Reset value 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.
TSC_IOG5CR CNT[13:0]
0x0044
Reset value 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.
TSC_IOG6CR CNT[13:0]
0x0048
Reset value 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.
TSC_IOG7CR CNT[13:0]
0x004C
Reset value 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.
TSC_IOG8CR CNT[13:0]
0x0050
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0
28.1 Introduction
The RNG is a true random number generator that provides full entropy outputs to the
application as 32-bit samples. It is composed of a live entropy source (analog) and an
internal conditioning component.
The RNG is a NIST SP 800-90B compliant entropy source that can be used to construct a
non-deterministic random bit generator (NDRBG).
The RNG true random number generator has been pre-certified NIST SP800-90B. It has
also been tested using German BSI statistical tests of AIS-31 (T0 to T8).
True RNG
rng_it Conditioning logic
Banked Registers CONDRST
4x32-bit
FIFO
data RNG_DR
AHB
status RNG_SR
interface
Alarms
Fault detection
Clock checker
rng_hclk AHB clock domain
Health tests
1-bit
MSv42098V2
Conditioning
Heath (optional)
tests
Raw data
Post-processing
(optional)
Digitization
Noise Source
Entropy source
MSv44200V2
Noise source
The noise source is the component that contains the non-deterministic, entropy-providing
activity that is ultimately responsible for the uncertainty associated with the bitstring output
by the entropy source. This noise source provides 1-bit samples. It is composed of:
• Multiple analog noise sources (x6), each based on three XORed free-running ring
oscillator outputs. It is possible to disable those analog oscillators to save power, as
described in Section 28.3.8: RNG low-power usage.
• The XORing of the 6 noise sources into a single analog output.
• A sampling stage of this output clocked by a dedicated clock input (rng_clk with
integrated divider), delivering a 1-bit raw data output.
This noise source sampling is independent to the AHB interface clock frequency (rng_hclk),
with a possibility for the software to decrease the sampling frequency by using the
integrated divider.
Note: In Section 28.6: RNG entropy source validation recommended RNG clock frequencies and
associated divider value are given.
Post processing
In NIST configuration no post-processing is applied to sampled noise source. In non-NIST
configuration B (as defined in Section 28.6.2) a normalization debiasing is applied, i.e. half
of the bits are taken from the sampled noise source, half of the bits are taken from inverted
sampled noise source.
Conditioning
The conditioning component in the RNG is a deterministic function that increases the
entropy rate of the resulting fixed-length bitstrings output (128-bit). The NIST SP800-90B
target is full entropy on the output (i.e. 128-bit).
The times required between two random number generations, and between the RNG
initialization and availability of first sample are described in Section 28.5: RNG processing
time.
Output buffer
A data output buffer can store up to four 32-bit words that have been output from the
conditioning component. When four words have been read from the output FIFO through
the RNG_DR register, the content of the 128-bit conditioning output register is pushed into
the output FIFO, and a new conditioning round is automatically started. Four new words are
added to the conditioning output register after a number of clock cycles specified in
Section 28.5: RNG processing time.
Whenever a random number is available through the RNG_DR register the DRDY flag
transitions from “0” to “1”. This flag remains high until output buffer becomes empty after
reading four words from the RNG_DR register.
Note: When interrupts are enabled an interrupt is generated when this data ready flag transitions
from “0” to “1”. Interrupt is then cleared automatically by the RNG as explained above.
Health checks
This component ensures that the entire entropy source (with its noise source) starts then
operates as expected, obtaining assurance that failures are caught quickly and with a high
probability and reliability.
The RNG implements the following health check features in accordance with NIST SP800-
90B. The described thresholds correspond to the value recommended for register
RNG_HTCR (in Section 28.6.2).
1. Start-up health tests, performed after reset and before the first use of the RNG as
entropy source
– Adaptive proportion test running on one 1024 bit windows: the RNG verifies that
the first bit on the outputs of the noise source is not repeated more than 691 times.
– Known-answer tests, to verify the conditioning stage.
– Repetition count test, flagging an error when the noise source has provided more
than 40 consecutive bits at a constant value (“0” or “1”)
2. Continuous health tests, running indefinitely on the outputs of the noise source
– Repetition count test, similar to the one running in start-up tests
– Adaptive proportion test running on 1024 consecutive samples, like during start-up
health tests.
3. Vendor specific continuous tests
– Transition count test, flagging an error when the noise source has delivered more
than 32 consecutive occurrence of two bits patterns (“01” or “10”).
– Real-time “too slow” sampling clock detector, flagging an error when one RNG
clock cycle (before divider) is smaller than AHB clock cycle divided by 32.
4. On-demand test of digitized noise source (raw data)
– Supported by restarting the entropy source and re-running the startup tests (see
software reset sequence in Section 28.3.4: RNG initialization). Other kinds of on-
demand testing (software based) are not supported.
The CECS and SECS status bits in the RNG_SR register indicate when an error condition is
detected, as detailed in Section 28.3.7: Error management.
Note: An interrupt can be generated when an error is detected.
Above health test thresholds are modified by changing value in RNG_HTCR register. See
Section 28.6: RNG entropy source validation for details.
2
Software reset
Generate samples
MSv44204V2
Figure 193 also highlights a possible software reset sequence, implemented by:
a) Writing bits RNGEN=0 and CONDRST=1 in the RNG_CR register with the same
RNG configuration and a new CLKDIV if needed.
b) Then writing RNGEN=1 and CONDRST=0 in the RNG_CR register.
c) Wait for random number to be ready, after initialization completes
Note: When RNG peripheral is reset through RCC (hardware reset) the RNG configuration for
optimal randomness is lost in RNG registers. Software reset with CONFIGLOCK set
preserves the RNG configuration.
additional words can be read by the application (in this case the DRDY bit is still high).
If one or both of above conditions are false, the RNG_DR register must not be read. If
an error occurred error recovery sequence described in Section 28.3.7 must be used.
Note: When data is not ready (DRDY=”0”) RNG_DR returns zero.
It is recommended to always verify that RNG_DR is different from zero. Because when it is
the case a seed error occurred between RNG_SR polling and RND_DR output reading (rare
event).
If the random number generation period is a concern to the application and if NIST
compliance is not required it is possible to select a faster RNG configuration by using the
RNG configuration “B”, described in Section 28.6: RNG entropy source validation. The gain
in random number generation speed is summarized in Section 28.5: RNG processing time.
Low-power operations
If the power consumption is a concern to the application, low-power strategies can be used,
as described in Section 28.3.8: RNG low-power usage.
Software post-processing
No specific software post-processing/conditioning is expected to meet the AIS-31 or NIST
SP800-90B approvals.
Built-in health check functions are described in Section 28.3.3: Random number generation.
The user can enable or disable the above interrupt sources individually by changing the
mask bits or the general interrupt control bit IE in the RNG_CR register. The status of the
individual interrupt sources can be read from the RNG_SR register.
Note: Interrupts are generated only when RNG is enabled.
28.6.1 Introduction
In order to assess the amount of entropy available from the RNG, STMicroelectronics has
tested the peripheral using German BSI AIS-31 statistical tests (T0 to T8), and NIST SP800-
90B test suite. The results can be provided on demand or the customer can reproduce the
tests.
1. When writing this register magic number 0x17590ABC must be written immediately before the indicated value
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
CONFI COND
Res. Res. Res. Res. RNG_CONFIG1[5:0] CLKDIV[3:0]
GLOCK RST
rs 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
RNG_CONFIG2[2:0] NISTC RNG_CONFIG3[3:0] Res. Res. CED Res. IE RNGEN 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
Res. Res. Res. Res. Res. Res. Res. Res. Res. SEIS CEIS Res. Res. SECS CECS DRDY
rc_w0 rc_w0 r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
RNDATA[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
RNDATA[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
HTCFG[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
HTCFG[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
10
11
9
8
7
6
5
4
3
2
1
0
CONFIGLOCK
CONDRST
RNG_C RNG_CO
RNGEN
NISTC
RNG_CONFIG1 .CLKDIV
CED
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
RNG_CR ONFIG NFIG3
IE
0x000 [5:0] [3:0]
2[2:0] [3:0]
Reset value 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DRDY
CECS
SECS
CEIS
SEIS
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.
RNG_SR
0x004
Reset value 0 0 0 0 0
RNG_DR RNDATA[31: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 0 0 0 0 0 0 0 0 0 0
RNG_HTCR HTCFG[31:0]
0x010
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 1 0 1 0 0 1 1 1 0 1 0 0
29.1 Introduction
The AES hardware accelerator (AES) encrypts or decrypts data, using an algorithm and
implementation fully compliant with the advanced encryption standard (AES) defined in
Federal information processing standards (FIPS) publication 197.
The peripheral supports CTR, GCM, GMAC, CCM, ECB, and CBC chaining modes for key
sizes of 128 or 256 bits.
AES is an AMBA AHB slave peripheral accessible through 32-bit single accesses only.
Other access types generate an AHB error, and other than 32-bit writes may corrupt the
register content.
The peripheral supports DMA single transfers for incoming and outgoing data (two DMA
channels required).
AES 32-bit
access Banked registers
status AES_SR
AHB
interface control AES_CR
swap AES
aes_hclk
data in AES_DINR DIN Core
(AEA)
data out AES_DOUTR DOUT
aes_in_dma DMA
aes_out_dma interface Control Logic
IRQ
aes_it
interface
MSv42154V1
Chaining modes
The following chaining modes are supported by AES, selected through the CHMOD[2:0]
bitfield of the AES_CR register:
• Electronic code book (ECB)
• Cipher block chaining (CBC)
• Counter (CTR)
• Galois counter mode (GCM)
• Galois message authentication code (GMAC)
• Counter with CBC-MAC (CCM)
Note: The chaining mode may be changed only when AES is disabled (bit EN of the AES_CR
register cleared).
Principle of each AES chaining mode is provided in the following subsections.
Detailed information is in dedicated sections, starting from Section 29.4.8: AES basic
chaining modes (ECB, CBC).
Decryption
Plaintext block 1 Plaintext block 2 Plaintext block 3
output
key
scheduling Ciphertext block 1 Ciphertext block 2 Ciphertext block 3
MSv42140V1
ECB is the simplest mode of operation. There are no chaining operations, and no special
initialization stage. The message is divided into blocks and each block is encrypted or
decrypted separately.
Note: For decryption, a special key scheduling is required before processing the first block.
Encryption
Plaintext block 1 Plaintext block 2 Plaintext block 3
initialization
vector
Decryption
Plaintext block 1 Plaintext block 2 Plaintext block 3
initialization
vector
Legend key key key
Decrypt Decrypt Decrypt
input
output
key
scheduling Ciphertext block 1 Ciphertext block 2 Ciphertext block 3
MSv42141V1
In CBC mode the output of each block chains with the input of the following block. To make
each message unique, an initialization vector is used during the first block processing.
Note: For decryption, a special key scheduling is required before processing the first block.
Decryption
Counter +1 Counter +1 Counter
output
Plaintext block 1 Plaintext block 2 Plaintext block 3
XOR
Ciphertext block 1 Ciphertext block 2 Ciphertext block 3
MSv42142V1
The CTR mode uses the AES core to generate a key stream. The keys are then XORed
with the plaintext to obtain the ciphertext as specified in NIST Special Publication 800-38A,
Recommendation for Block Cipher Modes of Operation.
Note: Unlike with ECB and CBC modes, no key scheduling is required for the CTR decryption,
since in this chaining scheme the AES core is always used in encryption mode for producing
the key stream, or counter blocks.
Legend
output
XOR
Final TAG
MSv42143V1
Initialization
vector
input
output
Final TAG
XOR
MSv42144V1
GMAC is similar to GCM, except that it is applied on a message composed only by plaintext
authenticated data (that is, only header, no payload).
Legend
key
input Encrypt Encrypt Encrypt
output
XOR
Final TAG
MSv42145V1
In Counter with cipher block chaining-message authentication code (CCM) mode, the
plaintext message is encrypted while a message authentication code (MAC) is computed in
parallel, thus generating the corresponding ciphertext and the corresponding MAC (also
known as tag). It is described by NIST in Special Publication 800-38C, Recommendation for
Block Cipher Modes of Operation - The CCM Mode for Authentication and Confidentiality.
CCM mode is based on AES in counter mode for confidentiality and it uses CBC for
computing the message authentication code. It requires an initial value.
Like GCM, the CCM chaining mode can be applied on a message composed only by
plaintext authenticated data (that is, only header, no payload). Note that this way of using
CCM is not called CMAC (it is not similar to GCM/GMAC), and its usage is not
recommended by NIST.
Initialization of AES
To initialize AES, first disable it by clearing the EN bit of the AES_CR register. Then perform
the following steps in any order:
• Configure the AES mode, by programming the MODE[1:0] bitfield of the AES_CR
register.
– For encryption, select Mode 1 (MODE[1:0] = 00).
– For decryption, select Mode 3 (MODE[1:0] = 10), unless ECB or CBC chaining
modes are used. In this latter case, perform an initial key derivation of the
encryption key, as described in Section 29.4.5: AES decryption round key
preparation.
• Select the chaining mode, by programming the CHMOD[2:0] bitfield of the AES_CR
register.
• Configure the data type (1-, 8-, 16- or 32-bit), with the DATATYPE[1:0] bitfield in the
AES_CR register.
• When it is required (for example in CBC or CTR chaining modes), write the initialization
vector into the AES_IVRx registers.
• Configure the key size (128-bit or 256-bit), with the KEYSIZE bitfield of the AES_CR
register.
• Write a symmetric key into the AES_KEYRx registers (4 or 8 registers depending on
the key size).
Data append
This section describes different ways of appending data for processing, where the size of
data to process is not a multiple of 128 bits.
For ECB or CBC mode, refer to Section 29.4.6: AES ciphertext stealing and data padding.
The last block management in these cases is more complex than in the sequence described
in this section.
Data append through polling
This method uses flag polling to control the data append through the following sequence:
1. Enable the AES peripheral by setting the EN bit of the AES_CR register.
2. Repeat the following sub-sequence until the payload is entirely processed:
a) Write four input data words into the AES_DINR register.
b) Wait until the status flag CCF is set in the AES_SR, then read the four data words
from the AES_DOUTR register.
c) Clear the CCF flag, by setting the CCFC bit of the AES_CR register.
d) If the data block just processed is the second-last block of the message and the
significant data in the last block to process is inferior to 128 bits, pad the
remainder of the last block with zeros and, in case of GCM payload encryption or
CCM payload decryption, specify the number of non-valid bytes, using the NPBLB
bitfield of the AES_CR register, for AES to compute a correct tag;.
3. As it is the last block, discard the data that is not part of the data, then disable the AES
peripheral by clearing the EN bit of the AES_CR register.
Note: Up to three wait cycles are automatically inserted between two consecutive writes to the
AES_DINR register, to allow sending the key to the AES processor.
NPBLB bits are not used in header phase of GCM, GMAC and CCM chaining modes.
Message 1 Message 2
128-bit block 1
128-bit block 1
128-bit block 2
128-bit block 4
AES resume
128-bit block 5
sequence
128-bit block 6
...
MSv42148V1
O1 O2
Legend Swap AES core Swap
DATATYPE[1:0] management DATATYPE[1:0] management
input
In ECB encrypt mode, the 128-bit plaintext input data block Px in the AES_DINR register
first goes through bit/byte/half-word swapping. The swap result Ix is processed with the AES
core set in encrypt mode, using a 128- or 256-bit key. The encryption result Ox goes through
bit/byte/half-word swapping, then is stored in the AES_DOUTR register as 128-bit ciphertext
output data block Cx. The ECB encryption continues in this way until the last complete
plaintext block is encrypted.
Figure 203 illustrates the electronic codebook (ECB) decryption.
O1 O2
Legend Swap Swap
DATATYPE[1:0] management DATATYPE[1:0] management
input
output
AES_DOUTR (plaintext P1) AES_DOUTR (plaintext P2)
MSv19106V2
To perform an AES decryption in the ECB mode, the secret key has to be prepared by
collecting the last-round encryption key (which requires to first execute the complete key
schedule for encryption), and using it as the first-round key for the decryption of the
ciphertext. This preparation is supported by the AES core.
In ECB decrypt mode, the 128-bit ciphertext input data block C1 in the AES_DINR register
first goes through bit/byte/half-word swapping. The keying sequence is reversed compared
to that of the ECB encryption. The swap result I1 is processed with the AES core set in
decrypt mode, using the formerly prepared decryption key. The decryption result goes
through bit/byte/half-word swapping, then is stored in the AES_DOUTR register as 128-bit
plaintext output data block P1. The ECB decryption continues in this way until the last
complete ciphertext block is decrypted.
output
AES_DOUTR (ciphertext C1) AES_DOUTR (ciphertext C2)
XOR
MSv19107V2
In CBC encrypt mode, the first plaintext input block, after bit/byte/half-word swapping (P1’),
is XOR-ed with a 128-bit IVI bitfield (initialization vector and counter), producing the I1 input
data for encrypt with the AES core, using a 128- or 256-bit key. The resulting 128-bit output
block O1, after swapping operation, is used as ciphertext C1. The O1 data is then XOR-ed
with the second-block plaintext data P2’ to produce the I2 input data for the AES core to
produce the second block of ciphertext data. The chaining of data blocks continues in this
way until the last plaintext block in the message is encrypted.
If the message size is not a multiple of 128 bits, the final partial data block is encrypted in
the way explained in Section 29.4.6: AES ciphertext stealing and data padding.
Figure 205 illustrates the cipher block chaining (CBC) decryption.
I1 I2
AES_KEYRx (KEY) AES_KEYRx (KEY)
Decrypt Decrypt
AES_IVRx (IV) O1 O2
IVI
P1' P2'
Legend
DATATYPE[1:0] Swap DATATYPE[1:0] Swap
management management
input
output
AES_DOUTR (plaintext P1) AES_DOUTR (plaintext P2)
XOR
MSv19104V2
In CBC decrypt mode, like in ECB decrypt mode, the secret key must be prepared to
perform an AES decryption.
After the key preparation process, the decryption goes as follows: the first 128-bit ciphertext
block (after the swap operation) is used directly as the AES core input block I1 for decrypt
operation, using the 128-bit or 256-bit key. Its output O1 is XOR-ed with the 128-bit IVI field
(that must be identical to that used during encryption) to produce the first plaintext block P1.
The second ciphertext block is processed in the same way as the first block, except that the
I1 data from the first block is used in place of the initialization vector.
The decryption continues in this way until the last complete ciphertext block is decrypted.
If the message size is not a multiple of 128 bits, the final partial data block is decrypted in
the way explained in Section 29.4.6: AES ciphertext stealing and data padding.
For more information on data swapping, refer to Section 29.4.13: AES data registers and
data swapping.
WR WR WR WR RD RD RD RD
Wait until flag CCF = 1
PT3 PT2 PT1 PT0 CT3 CT2 CT1 CT0
MSB LSB MSB LSB
register to 000 or 001, respectively. Data type can also be defined, using
DATATYPE[1:0] bitfield. KEYSIZE bitfield must be kept as-is.
3. Write the AES_IVRx registers with the initialization vector (required in CBC mode only).
4. Enable AES by setting the EN bit of the AES_CR register.
5. Write the AES_DINR register four times to input the cipher text (MSB first), as shown in
Figure 207.
6. Wait until the CCF flag is set in the AES_SR register.
7. Read the AES_DOUTR register four times to get the plain text (MSB first), as shown in
Figure 207. Then clear the CCF flag by setting the CCFC bit of the AES_CR register.
8. Repeat steps 5-6-7 to process all the blocks encrypted with the same key.
WR WR WR WR RD RD RD RD
Wait until flag CCF = 1
CT3 CT2 CT1 CT0 PT3 PT2 PT1 PT0
MSB LSB MSB LSB
16-byte boundaries
Zero
ICB Ciphertext (C) 0 padding
decrypt
4-byte boundaries
Plaintext (P)
Initialization vector (IV) Counter
MSv42156V1
output
AES_DOUTR (plaintext P1) AES_DOUTR (plaintext P2)
XOR
MSv18942V2
In CTR mode, the cryptographic core output (also called keystream) Ox is XOR-ed with
relevant input block (Px' for encryption, Cx' for decryption), to produce the correct output
block (Cx' for encryption, Px' for decryption). Initialization vectors in AES must be initialized
as shown in Table 217.
Unlike in CBC mode that uses the AES_IVRx registers only once when processing the first
data block, in CTR mode AES_IVRx registers are used for processing each data block, and
the AES peripheral increments the counter bits of the initialization vector (leaving the nonce
bits unchanged).
CTR decryption does not differ from CTR encryption, since the core always encrypts the
current counter block to produce the key stream that is then XOR-ed with the plaintext (CTR
encryption) or ciphertext (CTR decryption) input. In CTR mode, the MODE[1:0] bitfield
setting 01 (key derivation) is forbidden and all the other settings default to encryption mode.
The sequence of events to perform an encryption or a decryption in CTR chaining mode:
1. Ensure that AES is disabled (the EN bit of the AES_CR must be 0).
2. Select CTR chaining mode by setting to 010 the CHMOD[2:0] bitfield of the AES_CR
register. Set MODE[1:0] bitfield to any value other than 01.
3. Initialize the AES_KEYRx registers, and load the AES_IVRx registers as described in
Table 217.
4. Set the EN bit of the AES_CR register, to start encrypting the current counter (EN is
automatically reset when the calculation finishes).
5. If it is the last block, pad the data with zeros to have a complete block, if needed.
6. Append data in AES, and read the result. The three possible scenarios are described in
Section 29.4.4: AES procedure to perform a cipher operation.
7. Repeat the previous step till the second-last block is processed. For the last block,
apply the two previous steps and discard the bits that are not part of the payload (if the
size of the significant data in the last input block is less than 16 bytes).
[Len(A)]64 [Len(C)]64
encrypt
authenticate
authenticate
4-byte boundaries
Authenticated & encrypted ciphertext (C) 0
Initialization vector (IV) Counter
auth.
Authentication tag (T)
Zero padding / zeroed bits
MSv42157V1
GCM processing
Figure 212 describes the GCM implementation in the AES peripheral. The GCM is selected
by writing 011 to the CHMOD[2:0] bitfield of the AES_CR register.
H
Swap DATATYPE Swap DATATYPE
management [1:0] management [1:0]
H GF2mul
AES_IVRx
Legend (IV + 32-bit counter (= 0x0))
S
input Encrypt
output
XOR AES_DOUTR
AES_KEYRx (key) (Authentication TAG T)
MSv42149V1
The mechanism for the confidentiality of the plaintext in GCM mode is similar to that in the
Counter mode, with a particular increment function (denoted 32-bit increment) that
generates the sequence of input counter blocks.
AES_IVRx registers keeping the counter block of data are used for processing each data
block. The AES peripheral automatically increments the Counter[31:0] bitfield. The first
counter block (CB1) is derived from the initial counter block ICB by the application software
(see Table 219).
Note: In this mode, the setting 01 of the MODE[1:0] bitfield (key derivation) is forbidden.
The authentication mechanism in GCM mode is based on a hash function called GF2mul
that performs multiplication by a fixed parameter, called hash subkey (H), within a binary
Galois field.
A GCM message is processed through the following phases, further described in next
subsections:
• Init phase: AES prepares the GCM hash subkey (H).
• Header phase: AES processes the additional authenticated data (AAD), with hash
computation only.
• Payload phase: AES processes the plaintext (P) with hash computation, counter block
encryption and data XOR-ing. It operates in a similar way for ciphertext (C).
• Final phase: AES generates the authenticated tag (T) using the last block of the
message.
GCM init phase
During this first step, the GCM hash subkey (H) is calculated and saved internally, to be
used for processing all the blocks. The recommended sequence is:
1. Ensure that AES is disabled (the EN bit of the AES_CR must be 0).
2. Select GCM chaining mode, by setting to 011 the CHMOD[2:0] bitfield of the AES_CR
register, and optionally, set the DATATYPE[1:0] bitfield.
3. Indicate the Init phase, by setting to 00 the GCMPH[1:0] bitfield of the AES_CR
register.
4. Set the MODE[1:0] bitfield of the AES_CR register to 00 or 10. Although the bitfield is
only used in payload phase, it is recommended to set it in the Init phase and keep it
unchanged in all subsequent phases.
5. Initialize the AES_KEYRx registers with a key, and initialize AES_IVRx registers with
the information as defined in Table 219.
6. Start the calculation of the hash key, by setting to 1 the EN bit of the AES_CR register
(EN is automatically reset when the calculation finishes).
7. Wait until the end of computation, indicated by the CCF flag of the AES_SR transiting
to 1. Alternatively, use the corresponding interrupt.
8. Clear the CCF flag of the AES_SR register, by setting the CCFC bit of the AES_CR
register.
GCM header phase
This phase coming after the GCM Init phase must be completed before the payload phase.
The sequence to execute, identical for encryption and decryption, is:
1. Indicate the header phase, by setting to 01 the GCMPH[1:0] bitfield of the AES_CR
register. Do not modify the MODE[1:0] bitfield as set in the Init phase.
2. Enable the AES peripheral by setting the EN bit of the AES_CR register.
3. If it is the last block and the AAD size in the block is inferior to 128 bits, pad the
remainder of the block with zeros. Then append the data block into AES in one of ways
described in Section 29.4.4: AES procedure to perform a cipher operation. No data is
read during this phase.
4. Repeat the step 3 until the last additional authenticated data block is processed.
Note: The header phase can be skipped if there is no AAD, that is, Len(A) = 0.
1. Indicate the final phase, by setting to 11 the GCMPH[1:0] bitfield of the AES_CR
register.
2. Compose the data of the block, by concatenating the AAD bit length and the payload
bit length, as shown in Table 218. Write the block into the AES_DINR register.
3. Wait until the end of computation, indicated by the CCF flag of the AES_SR transiting
to 1.
4. Get the GCM authentication tag, by reading the AES_DOUTR register four times.
5. Clear the CCF flag of the AES_SR register, by setting the CCFC bit of the AES_CR
register.
6. Disable the AES peripheral, by clearing the bit EN of the AES_CR register. If it is an
authenticated decryption, compare the generated tag with the expected tag passed
with the message.
Note: In the final phase, data is written to AES_DINR normally (no swapping), while swapping is
applied to tag data read from AES_DOUTR.
When transiting from the header or the payload phase to the final phase, the AES peripheral
must not be disabled, otherwise the result is wrong.
[Len(A)]64 [0]64
Len(A)
16-byte
boundaries
Last
ICB Authenticated data 0 block
auth.
4-byte boundaries
Authentication tag (T)
Initialization vector (IV) Counter
Zero padding
MSv42158V2
AES_KEYRx (KEY)
H
Encrypt
(2) Header
AES_DINR AES_DINR AES_DINR
(message block 1) (message block n) len(A)64 || [0]64
Swap Swap
management DATATYPE management
[1:0]
H GF2mul
S
H GF2mul H GF2mul
Legend
input AES_DOUTR
(authentication tag T)
output
XOR
MSv42150V2
The GMAC algorithm corresponds to the GCM algorithm applied on a message only
containing a header. As a consequence, all steps and settings are the same as with the
GCM, except that the payload phase is omitted.
Len(C)
Len(A) Len(P) Len(T)
16-byte
boundaries
[a]32 Enc
B0 [a]16 Associated data (A) 0 Plaintext (P)
encrypt 0 (T)
authenticate
4-byte boundaries
Authenticated & encrypted ciphertext (C)
flags Nonce (N) Q
Zero padding
MSv42159V2
standard also states that, on MSB bits of the first message block (B1), the associated
data length expressed in bytes (a) must be encoded as follows:
– If 0 < a < 216 - 28, then it is encoded as [a]16, that is, on two bytes.
– If 216 - 28 < a < 232, then it is encoded as 0xff || 0xfe || [a]32, that is, on six bytes.
– If 232 < a < 264, then it is encoded as 0xff || 0xff || [a]64, that is, on ten bytes.
• 16-byte blocks (B) associated to the plaintext message P, which is both authenticated
and encrypted as ciphertext C, with a known length Len(P). This length can be a non-
multiple of 16 bytes (see Figure 215).
• Encrypted MAC (T) of length Len(T) appended to the ciphertext C of overall length
Len(C).
When a part of the message (A or P) has a length that is a non-multiple of 16-bytes, a
special padding scheme is required.
Note: CCM chaining mode can also be used with associated data only (that is, no payload).
As an example, the C.1 section in NIST Special Publication 800-38C gives the following
values (hexadecimal numbers):
N: 10111213 141516 (Len(N)= 56 bits or 7 bytes)
A: 00010203 04050607 (Len(A)= 64 bits or 8 bytes)
P: 20212223 (Len(P)= 32 bits or 4 bytes)
T: 6084341B (Len(T)= 32 bits or t = 4)
B0: 4F101112 13141516 00000000 00000004
B1: 00080001 02030405 06070000 00000000
B2: 20212223 00000000 00000000 00000000
CTR0: 0710111213 141516 00000000 00000000
CTR1: 0710111213 141516 00000000 00000001
Generation of formatted input data blocks Bx (especially B0 and B1) must be managed by
the application.
CCM processing
Figure 216 describes the CCM implementation within the AES peripheral (encryption
example). This mode is selected by writing 100 into the CHMOD[2:0] bitfield of the AES_CR
register.
AES_KEYRx (KEY)
Encrypt Encrypt Encrypt Encrypt
AES_DINR (CTR0)
AES_KEYRx (KEY) AES_KEYRx (KEY) AES_KEYRx (KEY)
MAC (T)
S0
Legend Encrypt
input
AES_DOUTR
output (EncTAG)
AES_KEYRx (KEY)
XOR (4) Final
MSv42152V2
The data input to the generation-encryption process are a valid nonce, a valid payload
string, and a valid associated data string, all properly formatted. The CBC chaining
mechanism is applied to the formatted plaintext data to generate a MAC, with a known
length. Counter mode encryption that requires a sufficiently long sequence of counter blocks
as input, is applied to the payload string and separately to the MAC. The resulting ciphertext
C is the output of the generation-encryption process on plaintext P.
AES_IVRx registers are used for processing each data block, AES automatically
incrementing the CTR counter with a bit length defined by the first block B0. Table 220
shows how the application must load the B0 data.
Note: The AES peripheral in CCM mode supports counters up to 64 bits, as specified by NIST.
Note: In this mode, the setting 01 of the MODE[1:0] bitfield (key derivation) is forbidden.
A CCM message is processed through the following phases, further described in next
subsections:
• Init phase: AES processes the first block and prepares the first counter block.
• Header phase: AES processes associated data (A), with tag computation only.
• Payload phase: IP processes plaintext (P), with tag computation, counter block
encryption, and data XOR-ing. It works in a similar way for ciphertext (C).
• Final phase: AES generates the message authentication code (MAC).
CCM Init phase
In this phase, the first block B0 of the CCM message is written into the AES_IVRx register.
The AES_DOUTR register does not contain any output data. The recommended sequence
is:
1. Ensure that the AES peripheral is disabled (the EN bit of the AES_CR must be 0).
2. Select CCM chaining mode, by setting to 100 the CHMOD[2:0] bitfield of the AES_CR
register, and optionally, set the DATATYPE[1:0] bitfield.
3. Indicate the Init phase, by setting to 00 the GCMPH[1:0] bitfield of the AES_CR
register.
4. Set the MODE[1:0] bitfield of the AES_CR register to 00 or 10. Although the bitfield is
only used in payload phase, it is recommended to set it in the Init phase and keep it
unchanged in all subsequent phases.
5. Initialize the AES_KEYRx registers with a key, and initialize AES_IVRx registers with
B0 data as described in Table 220.
6. Start the calculation of the counter, by setting to 1 the EN bit of the AES_CR register
(EN is automatically reset when the calculation finishes).
7. Wait until the end of computation, indicated by the CCF flag of the AES_SR transiting
to 1. Alternatively, use the corresponding interrupt.
8. Clear the CCF flag in the AES_SR register, by setting to 1 the CCFC bit of the AES_CR
register.
CCM header phase
This phase coming after the GCM Init phase must be completed before the payload phase.
During this phase, the AES_DOUTR register does not contain any output data.
The sequence to execute, identical for encryption and decryption, is:
1. Indicate the header phase, by setting to 01 the GCMPH[1:0] bitfield of the AES_CR
register. Do not modify the MODE[1:0] bitfield as set in the Init phase.
2. Enable the AES peripheral by setting the EN bit of the AES_CR register.
3. If it is the last block and the AAD size in the block is inferior to 128 bits, pad the
remainder of the block with zeros. Then append the data block into AES in one of ways
described in Section 29.4.4: AES procedure to perform a cipher operation. No data is
read during this phase.
4. Repeat the step 3 until the last additional authenticated data block is processed.
Note: The header phase can be skipped if there is no associated data, that is, Len(A) = 0.
The first block of the associated data (B1) must be formatted by software, with the
associated data length.
Note: In this final phase, swapping is applied to tag data read from AES_DOUTR register.
When transiting from the header phase to the final phase, the AES peripheral must not be
disabled, otherwise the result is wrong.
Application must mask the authentication tag output with tag length to obtain a valid tag.
Data swapping
The AES peripheral can be configured to perform a bit-, a byte-, a half-word-, or no
swapping on the input data word in the AES_DINR register, before loading it to the AES
processing core, and on the data output from the AES processing core, before sending it to
the AES_DOUTR register. The choice depends on the type of data. For example, a byte
swapping is used for an ASCII text stream.
The data swap type is selected through the DATATYPE[1:0] bitfield of the AES_CR register.
The selection applies both to the input and the output of the AES core.
For different data swap types, Figure 217 shows the construction of AES processing core
input buffer data P127..0, from the input data entered through the AES_DINR register, or the
construction of the output data available through the AES_DOUTR register, from the AES
processing core output buffer data P127..0.
1 2 3 4
D127 D96 D95
P95 D64 D63 D32 D31 D0
MSB LSB
1 2 3 4
D111 D96 D127 D112 D79 D64 D95 D80 D47 D32 D63 D48 D15 D0 D31 D16
MSB LSB
1 2 3 4
D103..96 D111.104 D119..112 D127..120 D71...64 D79..72 D87..80 D95..88 D39...32 D47...40 D55...48 D63...56 D7...0 D15...8 D23...16 D31...24
MSB LSB
1 2 3 4
D96 D97 D98 D125 D126 D127 D64 D65 D66 D93 D94 D95 D32 D33 D34 D61 D62 D63 D0 D1 D2 D29 D30 D31
MSB LSB
Legend: AES input/output data block in memory MSB most significant bit (127) of memory data block / AEC core buffer
AES core input/output buffer data LSB least significant bit (0) of memory data block / AEC core buffer
Zero padding (example) 1 4 Order of write to AES_DINR / read from AES_DOUTR
Data swap Dx input/output data bit ‘x’ MSv42153V2
Note: The data in AES key registers (AES_KEYRx) and initialization registers (AES_IVRx) are not
sensitive to the swap mode selection.
Data padding
Figure 217 also gives an example of memory data block padding with zeros such that the
zeroed bits after the data swap form a contiguous zone at the MSB end of the AES core
input buffer. The example shows the padding of an input data block containing:
• 48 message bits, with DATATYPE[1:0] = 01
• 56 message bits, with DATATYPE[1:0] = 10
• 34 message bits, with DATATYPE[1:0] = 11
Table 221. Key endianness in AES_KEYRx registers (128- or 256-bit key length)
AES_KEYR7 AES_KEYR6 AES_KEYR5 AES_KEYR4 AES_KEYR3 AES_KEYR2 AES_KEYR1 AES_KEYR0
[31:0] [31:0] [31:0] [31:0] [31:0] [31:0] [31:0] [31:0]
- - - - KEY[127:96] KEY[95:64] KEY[63:32] KEY[31:0]
The key for encryption or decryption may be written into these registers when the AES
peripheral is disabled, by clearing the EN bit of the AES_CR register.
The key registers are not affected by the data swapping controlled by DATATYPE[1:0]
bitfield of the AES_CR register.
DMA transfer must not include the last block. For details, refer to Section 29.4.4: AES
procedure to perform a cipher operation.
Figure 218. DMA transfer of a 128-bit data block during input phase
Chronological order
Increasing address
Memory accessed through DMA
Word3 Word2 Word1 Word0
System
D127 DIN[127:96] D96 D95 DIN[95:64] D64 D63 DIN[63:32] D32 D31 DIN[31:0] D0
MSB LSB
1 2 3 4
AES_DINR
peripheral
(No swapping) 1 2 3 4
AES
AES core input buffer
I127 I96 I95 I64 I63 I32 I31 I0
MSB LSB
Figure 219. DMA transfer of a 128-bit data block during output phase
Chronological order
Increasing address
Memory accessed through DMA
Word3 Word2 Word1 Word0
System
D127 DOUT[127:96] D96 D95 DOUT[95:64] D64 D63 DOUT[63:32] D32 D31 DOUT[31:0] D0
MSB LSB
1 2 3 4
AES_DOUTR
peripheral
(No swapping) 1 2 3 4
AES
When the data transferring between AES and memory is managed by DMA, the CCF flag is
not relevant and can be ignored (left set) by software. It must only be cleared when
transiting back to data transferring managed by software. See Suspend/resume operations
in ECB/CBC modes in Section 29.4.8: AES basic chaining modes (ECB, CBC) as example.
Table 224. Processing latency for GCM and CCM (in clock cycles)
Header Payload
Key size Mode of operation Algorithm Init Phase Tag phase(1)
phase(1) phase(1)
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
CHMOD[2]
KEYSIZE
Res. Res. Res. Res. Res. Res. Res. Res. NPBLB[3:0] Res. Res.
rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DMAOUTEN
DMAINEN
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. BUSY WRERR RDERR CCF
r r r r
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DIN[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
DIN[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
DOUT[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
DOUT[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
KEY[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
KEY[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
KEY[63:48]
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
KEY[47:32]
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
KEY[95:80]
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
KEY[79:64]
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
KEY[127:112]
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
KEY[111:96]
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
IVI[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
IVI[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
IVI[63:48]
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
IVI[47:32]
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
IVI[95:80]
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
IVI[79:64]
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
IVI[127:112]
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
IVI[111:96]
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
KEY[159:144]
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
KEY[143:128]
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
KEY[191:176]
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
KEY[175:160]
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
KEY[223:208]
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
KEY[207:192]
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
KEY[255:240]
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
KEY[239:224]
w w w w w w w w w w w w w w w w
Note: The key registers from 4 to 7 are used only when the key length of 256 bits is selected. They
have no effect when the key length of 128 bits is selected (only key registers 0 to 3 are used
in that case).
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
SUSP[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
SUSP[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
DATATYPE[1:0]
CHMOD[1:0]
DMAOUTEN
GCMPH[1:0]
NPBLB[3:0]
MODE[1:0]
CHMOD[2]
DMAINEN
KEYSIZE
ERRIE
CCFIE
ERRC
CCFC
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
EN
AES_CR
0x000
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
WRERR
RDERR
BUSY
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.
CCF
AES_SR
0x004
Reset value 0 0 0 0
AES_DINR DIN[31: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 0 0 0 0 0 0 0 0 0 0
AES_DOUTR DOUT[31:0]
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 0 0 0 0 0 0 0 0 0 0
AES_KEYR0 KEY[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
AES_KEYR1 KEY[63:32]
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
AES_KEYR2 KEY[95:64]
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 0 0 0 0 0 0 0 0 0 0
AES_KEYR3 KEY[127:96]
0x01C
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
AES_IVR0 IVI[31:0]
0x020
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
AES_IVR1 IVI[63:32]
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
AES_IVR2 IVI[95:64]
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
AES_IVR3 IVI[127:96]
0x02C
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
AES_KEYR4 KEY[159:128]
0x030
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
AES_KEYR5 KEY[191:160]
0x034
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
AES_KEYR6 KEY[223:192]
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
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
AES_KEYR7 KEY[255:224]
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
AES_SUSP0R SUSP[31:0]
0x040
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
AES_SUSP1R SUSP[31:0]
0x044
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
AES_SUSP2R SUSP[31:0]
0x048
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
AES_SUSP3R SUSP[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
AES_SUSP4R SUSP[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
AES_SUSP5R SUSP[31:0]
0x054
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
AES_SUSP6R SUSP[31:0]
0x058
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
AES_SUSP7R SUSP[31:0]
0x05C
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
0x060-
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
0x3FF
30.1 Introduction
The hash processor is a fully compliant implementation of the secure hash algorithm
(SHA-1, SHA-224, SHA-256), the MD5 (message-digest algorithm 5) hash algorithm and
the HMAC (keyed-hash message authentication code) algorithm. HMAC is suitable for
applications requiring message authentication.
The hash processor computes FIPS (Federal Information Processing Standards) approved
digests of length of 160, 224, 256 bits, for messages of up to (264 – 1) bits. It also computes
128-bit digests for the MD5 algorithm.
Banked Registers
swapping
16x32-bit
IN FIFO
Data, key HASH_DIN HASH
Core
32-bit AHB2 bus
(SHA-1,
HASH_HRx Secure digest SHA-224,
SHA-256,
Status HASH_SR MD5)
Control HASH_CR
AHB +
interface Start HASH_STR
HMAC
logic
HASH_CSRx Suspend/Resume
hash_hclk
DMA
hash_dma Control Logic
interface
IRQ
hash_it
interface
MSv62405V3
In accordance to the kind of data to be processed (e.g. byte swapping when data are ASCII
text stream) there must be a bit, byte, half-word or no swapping operation to be performed
on data from the input FIFO before entering the little-endian hash processing core.
Figure 221 shows how the hash processing core 32-bit data block M0...31 is constructed
from one 32-bit words popped into input FIFO by the driver, according to the DATATYPE
bitfield in the HASH control register (HASH_CR).
HASH_DIN data endianness when bit swapping is disabled (DATATYPE = 00) can be
described as following: the least significant bit of the message has to be at MSB position in
the first word entered into the hash processor, the 32nd bit of the bit string has to be at MSB
position in the second word entered into the hash processor and so on.
M0 M15 M16 M31 M32 M47 M48 M63 M96 M111 M112 M127
LSB HASH core interface MSB
M0 M1 M2 M29 M30 M31 M32 M33 M34 M61 M62 M63 M96 M97 M98 M125M126M127
LSB HASH core interface MSB
MSv41984V4
For more information about HMAC detailed instructions, refer to Section 30.4.7: HMAC
operation.
Padding processing
Detailed padding sequences with DMA enabled or disabled are described in Section 30.4.5:
Message digest computing.
Padding example
As specified by Federal Information Processing Standards PUB 180-4, the message
padding consists in appending a “1” followed by k “0”s, itself followed by a 64-bit integer that
is equal to the length L in bits of the message. These three padding operations generate a
padded message of length L + 1 + k + 64, which by construction is a multiple of 512 bits.
For the hash processor, the “1” is added to the last word written to the HASH_DIN register at
the bit position defined by the NBLW[4:0] bitfield, and the remaining upper bits are cleared
(“0”s).
HMAC processing
Four different steps are required to compute the HMAC:
1. The software writes the INIT bit to 1 with the MODE bit at 1 and the ALGO bits set to
the value corresponding to the desired algorithm. The LKEY bit must also be set to 1 if
the key being used is longer than 64 bytes. In this case, as required by HMAC
specifications, the hash processor uses the hash of the key instead of the real key.
2. The software provides the key to be used for the inner hash function, using the same
mechanism as the message string loading, that is writing the key data into HASH_DIN
register then completing the transfer by writing DCAL bit to 1 and the correct
NBLW[4:0] to HASH_STR register.
Note: Endianness details can be found in Section 30.4.4: Message data feeding.
3. Once the processor is ready again (DINIS = 1 in HASH_SR), the software can write the
message string to HASH_DIN. When the last word of the last block is entered and the
software writes DCAL bit to 1 in HASH_STR register, the NBLW[4:0] bitfield must be
written at the same time to a value different from zero if the message length is not an
exact multiple of the block size. Note that the DMA can also be used to feed the
message string, as described in Section 30.4.4: Message data feeding.
4. Once the processor is ready again (DINIS = 1 in HASH_SR), the software provides the
key to be used for the outer hash function, writing the key data into HASH_DIN register
then completing the transfer by writing DCAL bit to 1 and the correct NBLW[4:0] to
HASH_STR register. The HMAC result can be found in the valid output registers
(HASH_HR7) as soon as DCIS bit is set to 1.
Note: The computation latency of the HMAC primitive depends on the lengths of the keys and
message, as described in Section 30.6: HASH processing time.
HMAC example
Below is an example of HMAC SHA-1 algorithm (ALGO = 00 and MODE = 1 in HASH_CR)
as specified by NIST.
Let us assume that the original message is the ASCII binary-coded form of “Sample
message for keylen = blocklen”, of length L = 34 bytes. If the HASH is programmed
in no swapping mode (DATATYPE = 00 in HASH_CR), the following data must be loaded
sequentially into HASH_DIN register:
1. Inner hash key input (length = 64, that is no padding), specified by NIST. As key
length = 64, LKEY bit is set to 0 in HASH_CR register
00010203 04050607 08090A0B 0C0D0E0F 10111213 14151617
18191A1B 1C1D1E1F 20212223 24252627 28292A2B 2C2D2E2F
30313233 34353637 38393A3B 3C3D3E3F
2. Message input (length = 34, that is padding required). HASH_STR must be set to
0x20 to start message padding and inner hash computation (see ‘U’ as don’t care)
53616D70 6C65206D 65737361 67652066 6F72206B 65796C65
6E3D626C 6F636B6C 656EUUUU
3. Outer hash key input (length = 64, that is no padding). A key identical to the inner
hash key is entered here.
4. Final outer hash computing is then performed by the HASH. The HMAC-SHA1 digest
result is available in the HASH_HRx registers (x = 0 to 4), as shown below:
HASH_HR0 = 0x5FD596EE
HASH_HR1 = 0x78D5553C
HASH_HR2 = 0x8FF4E72D
HASH_HR3 = 0x266DFD19
HASH_HR4 = 0x2366DA29
Block 2
Block 2
(last block)
Block 4
HASH resume
sequence
Block 5
Block 6
... MSv41985V2
To do so, the context of the interrupted task must be saved from the HASH registers to
memory, and then be restored from memory to the HASH registers.
The procedures where the data flow is controlled by software or by DMA are described
below.
The status of each maskable interrupt source can be read from the HASH_SR register.
Table 228 gives a summary of the available features.
MD5 16 50 66
SHA-1 16 66 82
SHA-224
16 50 66
SHA-256
1. Add the time required to load the block into the processor.
The time required to process the last block of a message (or of a key in HMAC) can be
longer. This time depends on the length of the last block and the size of the key (in HMAC
mode).
Compared to the processing of an intermediate block, it can be increased by the factor
below:
• 1 to 2.5 for a hash message
• ~2.5 for an HMAC input-key
• 1 to 2.5 for an HMAC message
• ~2.5 for an HMAC output key in case of a short key
• 3.5 to 5 for an HMAC output key in case of a long key
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. ALGO1 Res. LKEY
rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Res. Res. MDMAT DINNE NBW[3:0] ALGO0 MODE DATATYPE[1:0] DMAE INIT Res. Res.
rw r r r r r rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DATAIN[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
DATAIN[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. DCAL Res. Res. Res. NBLW[4:0]
rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Hx[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
Hx[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
Hx[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
Hx[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
Hx[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
Hx[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. Res. Res. DCIE DINIE
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. BUSY DMAS DCIS DINIS
r r rc_w0 rc_w0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
CSx[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
CSx[15:0]
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw
10
11
9
8
7
6
5
4
3
2
1
0
name
DATATYPE
NBW[3:0]
ALGO[1]
ALGO[0]
.MDMAT
DINNE
MODE
DMAE
LKEY
HASH_CR
INIT
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
0x00
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0
HASH_DIN DATAIN[31:16]
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
NBLW[4:0]
DCAL
HASH_STR
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.
0x08
Reset value 0 0 0 0 0 0
HASH_HRA0 H0[31: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
HASH_HRA1 H1[31:0]
0x10
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
HASH_HRA2 H2[31: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 0
HASH_HRA3 H3[31: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 0 0 0 0
HASH_HRA4 H4[31:0]
0x1C
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
DINIE
DCIE
HASH_IMR
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.
0x20
Reset value 0 0
DMAS
BUSY
DINIS
DCIS
HASH_SR
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.
0x24
Reset value 0 0 0 1
0x28 to
Reserved Res.
0xF4
HASH_CSR0 CS0[31:0]
0x0F8
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 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
0x0F8 + HASH_CSRx CSx[31:0]
0x4 * x,
(x = 1 to
53)
Last 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
address:
0x1CC
...
0x1D0
Reserved Res.
to 0x30C
HASH_HR0 H0[31:0]
0x310
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
HASH_HR1 H1[31:0]
0x314
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
HASH_HR2 H2[31:0]
0x318
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
HASH_HR3 H3[31:0]
0x31C
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
HASH_HR4 H4[31:0]
0x320
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
HASH_HR5 H5[31:0]
0x324
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
HASH_HR6 H6[31:0]
0x328
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
HASH_HR7 H7[31:0]
0x32C
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
31.1 Introduction
OTFDEC allows on-the-fly decryption of the AHB traffic based on the read request address
information. Four independent and non-overlapping encrypted regions can be defined in
OTFDEC.
OTFDEC uses AES-128 in counter mode to achieve the lowest possible latency. As a
consequence, each time the content of one encrypted region is changed, the entire region
must be re-encrypted with a different cryptographic context (key or initialization vector). This
constraint makes OTFDEC suitable to decrypt read-only data or code, stored in external
NOR Flash.
Note: When OTFDEC is used in conjunction with OCTOSPI, it is mandatory to access the Flash
memory using the Memory-mapped mode of the Flash memory controller.
When security is enabled in the product, OTFDEC can be programmed only by a secure
host.
OTFDEC
IRQ
otfdec_it interface
Banked registers
(x=1 to 4)
RxCFGR Control
AHB lite
RxADDR Logic
32-bit AHB bus
slave
interface RxKEYR
Key
IVs
RxNONCE
...
AES-CTR
otfdec_hclk
To/From Keystream[0]
control logic Keystream[1]
otfdec_tzen AHB clock domain
OCTOSPI (Slave)
hreadyout_o Proprietary hreadyout_i
AHB memory
XOR
32-bit AHB bus
hrdata_o[31:0] hrdata_in[31:0]
interface
XOR
MS48972V2
The TZEN option bit in FLASH is used to activate TrustZone in the device.
• TZEN = 1: TrustZone security is enabled in the product.
• TZEN = 0: TrustZone security is disabled in the product.
Instruction data/system
cache cache
OTFDEC
OCTOSPI
SPI bus
SoC boundary
SPI NOR
Flash
MS48973V1
OTFDEC architecture
OTFDEC analyzes all AHB read transfers on the associated AHB bus. If the read request is
within one of the four regions programmed in OTFDEC, the control logic triggers a
keystream computation based on AES algorithm in counter mode. This keystream is then
used to decrypt on-the-fly the data present in the read transfer from the OCTOSPI AHB
master, tying low the HREADYOUT signal of this master while the keystream information is
being computed (this takes up to 11 cycles). Any accesses outside the enabled OTFDEC
regions belong to a non-encrypted region.
Each OTFDEC region is programmed through OTFDEC_RxCFGR,
OTFDEC_RxSTARTADDR, OTFDEC_RxENDADDR, OTFDEC_RxNONCER and
128-bit
AES_KEY AES_KEY
AES Block cipher AES Block cipher
encryption encryption
128-bit 128-bit
Keystream_0 Keystream_1
128-bit
AES_DIN (cipher text 0) AES_DIN (cipher text 1)
128-bit 128-bit
Every 128-bit data block, a special keystream information is computed using AES block
cipher, as defined below:
• initialization vector AES_IV[127:0] = RxNONCER1[31:0] || RxNONCER0[31:0] ||
0b0000 0000 0000 0000 || RxCFGR[31:16] || 0b00 || (x-1) || ReadAddress[31:4]
• key material AES_KEY[127:0] = RxKEYR3[31:0] || RxKEYR2[31:0] || RxKEYR1[31:0] ||
RxKEYR0[31:0]
Note: Above x is the RegionID of the selected encrypted region (x=1 to 4).
ReadAddress is the AHB address of the encrypted data block, modulo 128-bit.
Resulting 128-bit keystream is XORed with 128-bit cipher text data to produce the 128-bit
clear text data.
• AES_DIN and AES_DOUT data blocks are constructed following the rule below (“|”
represents a binary concatenation):
AES_Dx[127:0]= AHB_word(@ | 0xC)[31:0] | AHB_word(@ | 0x8)[31:0] | AHB_word(@
| 0x4)[31:0] || AHB_word(@ | 0x0)[31:0], where @ is the hexadecimal address used to
compute the keystream (ReadAddress[31:4] above).
When the read request is not within an encrypted region, or the decryption is not enabled in
this region, the AHB data is not changed.
Note: When the application sets the MODE bitfield to 11 in OTFDEC_RxCFGR, an additional layer
of protection is added on top of the AES stream cipher. This enhanced encryption mode can
only be used with instructions (execute-only region).
Figure 226. OTFDEC flow control overview (dual burst read request)
AHB Clock
120MHz
HREADY
HRDATA 1 Data(A) Data(B) Data(C) Data(D)
2
Keystream[0] Keystream[1]
OTFDEC (AES)
OTFDEC (XOR) XOR(A) XOR(B) XOR(C) XOR(D)
Note: Those sequences are for production code, as during firmware development, it is not always
recommended to lock the key or the region configuration.
Writes to configuration registers are effective when the configuration locks allow it, even if
the region is enabled.
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. ENC
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. PRIV
rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
REGx_VERSION[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
CONFI REG_
KEYCRC[7:0] Res. Res. MODE[1:0] Res. KEYLOCK
GLOCK EN
r r r r r r r r rw rw rs rs rw