STM32L5 Series Highly Secure With Low Power Consumption User Guide

STM32L5 Series Highly Secure With Low Power Consumption

Specifications:

  • Product Name: RM0438 Reference manual
  • Revision: Rev 8
  • Pages: 1 to 2187
  • Release Date: June 2025
  • Manufacturer: www.st.com

Product Information:

The RM0438 Reference manual provides detailed information about
memory and bus architecture, TrustZone security architecture,
memory organization, embedded SRAM, flash memory overview, boot
configuration, and system security.

Product Usage Instructions:

Memory and Bus Architecture:

The system architecture includes Fast C-bus, Slow C-bus, S-bus,
DMA-bus, SDMMC controller DMA bus, and BusMatrix.

TrustZone Security Architecture:

Explains the default TrustZone security state and TrustZone
peripheral classification.

Memory Organization:

Describes the memory map, register boundary addresses, and the
organization of embedded SRAM.

Embedded SRAM:

Details SRAM2 parity check, write protection, read protection,
erase operations.

Flash Memory Overview:

Provides an overview of the flash memory used in the system.

Boot Configuration:

Covers the boot configuration settings for the system.

System Security:

Introduction to system security measures.

Frequently Asked Questions (FAQ):

Q: Where can I find information about register reset
values?

A: The register reset values are detailed in section 1.3 of the
manual.

Q: What is TrustZone security architecture?

A: TrustZone security architecture is explained in section 2.2
of the manual.

Q: How do I configure the boot settings?

A: Instructions for boot configuration can be found in section 3
of the manual.

“`

RM0438 Reference manual
STM32L5 series 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. The STM32L552xx and STM32L562xx microprocessors include ST state-of-the-art patented technology.
Related documents
· Cortex®-M33 Technical Reference Manual available at http://infocenter.arm.com · STM32L552xx and STM32L562xx datasheets · STM32L552xx and STM32L562xx errata sheets

June 2025

RM0438 Rev 8

1/2187

www.st.com

1

Contents
Contents

RM0438

1

Documentation conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

1.1 General information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

1.2 List of abbreviations for registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

1.3 Register reset value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

1.4 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

1.5 Availability of peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

2

Memory and bus architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

2.1 System architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

2.1.1 Fast C-bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

2.1.2 Slow C-bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

2.1.3 S-bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

2.1.4 DMA-bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

2.1.5 SDMMC controller DMA bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

2.1.6 BusMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

2.2 TrustZone security architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

2.2.1 Default TrustZone security state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

2.2.2 TrustZone peripheral classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

2.3 Memory organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

2.3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

2.3.2 Memory map and register boundary addresses . . . . . . . . . . . . . . . . . . 87

2.4 Embedded SRAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

2.4.1 SRAM2 parity check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

2.4.2 SRAM2 Write protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

2.4.3 SRAM2 Read protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

2.4.4 SRAM2 Erase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

2.5 Flash memory overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

3

Boot configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

4

System security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

4.2 Key security features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

2/2187

RM0438 Rev 8

RM0438

Contents

4.3 4.4 4.5 4.6
4.7 4.8
4.9 4.10 4.11 4.12 4.13

Secure install . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 Secure boot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
4.4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 4.4.2 Unique boot entry and BOOT_LOCK . . . . . . . . . . . . . . . . . . . . . . . . . 102 4.4.3 Immutable root of trust in system flash memory . . . . . . . . . . . . . . . . . 102
Secure update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 Resource isolation using TrustZone . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
4.6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 4.6.2 TrustZone security architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 4.6.3 Armv8-M security extension of Cortex-M33 . . . . . . . . . . . . . . . . . . . . . 104 4.6.4 Memory and peripheral allocation using IDAU/SAU . . . . . . . . . . . . . . 104 4.6.5 Memory and peripheral allocation using GTZC . . . . . . . . . . . . . . . . . . 106 4.6.6 Managing security in TrustZone-aware peripherals . . . . . . . . . . . . . . . 109 4.6.7 Activating TrustZone security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 4.6.8 De-activating TrustZone security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Other resource isolations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117
4.7.1 Temporal isolation using secure hide protection (HDP) . . . . . . . . . . . . 117
Secure execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .118
4.8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 4.8.2 Memory protection unit (MPU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 4.8.3 Embedded flash memory write protection . . . . . . . . . . . . . . . . . . . . . . 118 4.8.4 Tamper detection and response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Secure storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
4.9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 4.9.2 Unique ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Crypto engines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
4.10.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 4.10.2 Crypto engines features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 4.10.3 On-the-fly decryption engine (OTFDEC) . . . . . . . . . . . . . . . . . . . . . . . 122
Product lifecycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
4.11.1 Lifecycle management with readout protection (RDP) . . . . . . . . . . . . 124 4.11.2 Recommended option byte settings . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Access controlled debug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
4.12.1 Debug protection with readout protection (RDP) . . . . . . . . . . . . . . . . . 125
Software intellectual property protection and collaborative development 126

RM0438 Rev 8

3/2187
54

Contents

RM0438

4.13.1
4.13.2 4.13.3

Software intellectual property protection with readout protection (RDP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Software intellectual property protection with OTFDEC . . . . . . . . . . . 127
Other software intellectual property protections . . . . . . . . . . . . . . . . . 129

5

Global TrustZone® controller (GTZC) . . . . . . . . . . . . . . . . . . . . . . . . . 130

5.1 GTZC introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

5.2 GTZC main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

5.2.1 GTZC TrustZone system architecture . . . . . . . . . . . . . . . . . . . . . . . . . 130

5.3 GTZC functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

5.3.1 GTZC block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

5.3.2 Illegal access definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

5.3.3 TrustZone security controller (TZSC) . . . . . . . . . . . . . . . . . . . . . . . . . . 134

5.3.4 Memory protection controller – block based (MPCBB) . . . . . . . . . . . . . 134

5.3.5 TrustZone illegal access controller (TZIC) . . . . . . . . . . . . . . . . . . . . . . 135

5.3.6 Power-on/reset state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

5.3.7 DMA requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

5.4 GTZC events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

5.5 GTZC_TZSC registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

5.5.1 GTZC_TZSC control register (GTZC_TZSC_CR) . . . . . . . . . . . . . . . . 136

5.5.2

GTZC_TZSC secure configuration register 1 (GTZC_TZSC_SECCFGR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137

5.5.3

GTZC_TZSC secure configuration register 2 (GTZC_TZSC_SECCFGR2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

5.5.4

GTZC_TZSC privilege configuration register 1 (GTZC_TZSC_PRIVCFGR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142

5.5.5

GTZC_TZSC privilege configuration register 2 (GTZC_TZSC_PRIVCFGR2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

5.5.6

GTZC_TZSC external memory x non-secure watermark register 1 (GTZC_TZSC_MPCWMxANSR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

5.5.7

GTZC_TZSC external memory x non-secure watermark register 2 (GTZC_TZSC_MPCWMxBNSR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

5.5.8 GTZC_TZSC register map and reset values . . . . . . . . . . . . . . . . . . . . 148

5.6 GTZC_MPCBB registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150

5.6.1 GTZC_MPCBBx control register (GTZC_MPCBBx_CR) (x = 1 to 2) . 150

5.6.2 GTZC_MPCBB1 lock register 1(GTZC_MPCBB1_LCKVTR1) . . . . . . 151

5.6.3

GTZC_MPCBB2 lock register 1 (GTZC_MPCBB2_LCKVTR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

4/2187

RM0438 Rev 8

RM0438

Contents

5.6.4

GTZC_MPCBBx vector register y (GTZC_MPCBBx_VCTRy) (x = 1 to 2) . . . . . . . . . . . . . . . . . . . . . . . . 152

5.6.5 GTZC_MPCBB1 register map and reset values . . . . . . . . . . . . . . . . . 153

5.6.6 GTZC_MPCBB2 register map and reset values . . . . . . . . . . . . . . . . . 153

5.7 GTZC_TZIC registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154

5.7.1 GTZC_TZIC interrupt enable register 1 (GTZC_TZIC_IER1) . . . . . . . 154

5.7.2 GTZC_TZIC interrupt enable register 2 (GTZC_TZIC_IER2) . . . . . . . 157

5.7.3 GTZC_TZIC interrupt enable register 3 (GTZC_TZIC_IER3) . . . . . . . 159

5.7.4 GTZC_TZIC status register 1 (GTZC_TZIC_SR1) . . . . . . . . . . . . . . . 160

5.7.5 GTZC_TZIC status register 2 (GTZC_TZIC_SR2) . . . . . . . . . . . . . . . 163

5.7.6 GTZC_TZIC status register 3 (GTZC_TZIC_SR3) . . . . . . . . . . . . . . . 165

5.7.7 GTZC_TZIC flag clear register 1 (GTZC_TZIC_FCR1) . . . . . . . . . . . . 166

5.7.8 GTZC_TZIC flag clear register 2 (GTZC_TZIC_FCR2) . . . . . . . . . . . . 169

5.7.9 GTZC_TZIC flag clear register 3 (GTZC_TZIC_FCR3) . . . . . . . . . . . . 171

5.7.10 GTZC_TZIC register map and reset values . . . . . . . . . . . . . . . . . . . . . 172

6

Embedded flash memory (FLASH) . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

6.2 FLASH main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

6.3 Flash memory functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

6.3.1 Flash memory organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

6.3.2 Error code correction (ECC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178

6.3.3 Read access latency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179

6.3.4 Low-voltage read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180

6.3.5 Flash program and erase operations . . . . . . . . . . . . . . . . . . . . . . . . . . 180

6.3.6 Flash main memory erase sequences . . . . . . . . . . . . . . . . . . . . . . . . . 182

6.3.7 Flash main memory programming sequences . . . . . . . . . . . . . . . . . . . 185

6.3.8 Flash errors flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186

6.3.9

Read-while-write (RWW) available only in dual-bank mode (DBANK = 1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188

6.4 Flash memory option bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190

6.4.1 Option bytes description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190

6.4.2 Option bytes programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191

6.5 Flash TrustZone security and privilege protections . . . . . . . . . . . . . . . . 193

6.5.1 TrustZone security protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193

6.5.2 Secure watermark-based area protection . . . . . . . . . . . . . . . . . . . . . . 195

6.5.3 Secure hide protection (HDP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195

RM0438 Rev 8

5/2187
54

Contents

RM0438

6.5.4 Secure block-based area (SECBB) protection . . . . . . . . . . . . . . . . . . 196 6.5.5 Forcing boot from a secure memory address . . . . . . . . . . . . . . . . . . . 197 6.5.6 Flash security attribute state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 6.5.7 Flash registers privileged and unprivileged modes . . . . . . . . . . . . . . . 198
6.6 Secure system memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
6.6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 6.6.2 RSS allocates resource to bootloader . . . . . . . . . . . . . . . . . . . . . . . . . 198 6.6.3 RSSLIB functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
6.7 FLASH memory protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
6.7.1 Write protection (WRP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 6.7.2 Readout protection (RDP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
6.8 FLASH interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 6.9 FLASH registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
6.9.1 Flash access control register (FLASH_ACR) . . . . . . . . . . . . . . . . . . . 213 6.9.2 Flash power-down key register (FLASH_PDKEYR) . . . . . . . . . . . . . . 214 6.9.3 Flash non-secure key register (FLASH_NSKEYR) . . . . . . . . . . . . . . . 215 6.9.4 Flash secure key register (FLASH_SECKEYR) . . . . . . . . . . . . . . . . . 215 6.9.5 Flash option key register (FLASH_OPTKEYR) . . . . . . . . . . . . . . . . . . 216 6.9.6 Flash low voltage key register (FLASH_LVEKEYR) . . . . . . . . . . . . . . 216 6.9.7 Flash status register (FLASH_NSSR) . . . . . . . . . . . . . . . . . . . . . . . . . 217 6.9.8 Flash status register (FLASH_SECSR) . . . . . . . . . . . . . . . . . . . . . . . . 218 6.9.9 Flash non-secure control register (FLASH_NSCR) . . . . . . . . . . . . . . . 220 6.9.10 Flash secure control register (FLASH_SECCR) . . . . . . . . . . . . . . . . . 222 6.9.11 Flash ECC register (FLASH_ECCR) . . . . . . . . . . . . . . . . . . . . . . . . . . 223 6.9.12 Flash option register (FLASH_OPTR) . . . . . . . . . . . . . . . . . . . . . . . . . 225 6.9.13 Flash non-secure boot address 0 register (FLASH_NSBOOTADD0R) 227 6.9.14 Flash non-secure boot address 1 register (FLASH_NSBOOTADD1R) 228 6.9.15 Flash secure boot address 0 register (FLASH_SECBOOTADD0R) . . 228 6.9.16 Flash bank 1 secure watermak1 register (FLASH_SECWM1R1) . . . . 229 6.9.17 Flash secure watermak1 register 2 (FLASH_SECWM1R2) . . . . . . . . 230 6.9.18 Flash WPR1 area A address register (FLASH_WRP1AR) . . . . . . . . . 231 6.9.19 Flash WPR1 area B address register (FLASH_WRP1BR) . . . . . . . . . 232 6.9.20 Flash secure watermak2 register (FLASH_SECWM2R1) . . . . . . . . . . 233 6.9.21 Flash secure watermak2 register 2 (FLASH_SECWM2R2) . . . . . . . . 234 6.9.22 Flash WPR2 area A address register (FLASH_WRP2AR) . . . . . . . . . 235 6.9.23 Flash WPR2 area B address register (FLASH_WRP2BR) . . . . . . . . . 236

6/2187

RM0438 Rev 8

RM0438

Contents

6.9.24
6.9.25
6.9.26 6.9.27 6.9.28

FLASH secure block based bank 1 register (FLASH_SECBB1Rx) (where x=1..4) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
FLASH secure block based bank 2 register (FLASH_SECBB2Rx) (where x=1..4) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
FLASH secure HDP control register (FLASH_SECHDPCR) . . . . . . . . 238
FLASH privilege configuration register (FLASH_PRIVCFGR) . . . . . . . 238
FLASH register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . 239

7

Instruction cache (ICACHE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242

7.1 ICACHE introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242

7.2 ICACHE main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242

7.3 ICACHE implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243

7.4 ICACHE functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243

7.4.1 ICACHE block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244

7.4.2 ICACHE reset and clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244

7.4.3 ICACHE TAG memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245

7.4.4 Direct-mapped ICACHE (1-way cache) . . . . . . . . . . . . . . . . . . . . . . . . 246

7.4.5 ICACHE enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247

7.4.6 Cacheable and noncacheable traffic . . . . . . . . . . . . . . . . . . . . . . . . . . 247

7.4.7 Address remapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248

7.4.8 Cacheable accesses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250

7.4.9 Dual-master cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251

7.4.10 ICACHE security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251

7.4.11 ICACHE maintenance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251

7.4.12 ICACHE performance monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252

7.4.13 ICACHE boot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252

7.5 ICACHE low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252

7.6 ICACHE error management and interrupts . . . . . . . . . . . . . . . . . . . . . . 253

7.7 ICACHE registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253

7.7.1 ICACHE control register (ICACHE_CR) . . . . . . . . . . . . . . . . . . . . . . . 253

7.7.2 ICACHE status register (ICACHE_SR) . . . . . . . . . . . . . . . . . . . . . . . . 254

7.7.3 ICACHE interrupt enable register (ICACHE_IER) . . . . . . . . . . . . . . . . 255

7.7.4 ICACHE flag clear register (ICACHE_FCR) . . . . . . . . . . . . . . . . . . . . 255

7.7.5 ICACHE hit monitor register (ICACHE_HMONR) . . . . . . . . . . . . . . . . 256

7.7.6 ICACHE miss monitor register (ICACHE_MMONR) . . . . . . . . . . . . . . 256

7.7.7 ICACHE region x configuration register (ICACHE_CRRx) . . . . . . . . . 256

7.7.8 ICACHE register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258

RM0438 Rev 8

7/2187
54

Contents

RM0438

8

Power control (PWR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259

8.1 Power supplies and supply domains . . . . . . . . . . . . . . . . . . . . . . . . . . . 259

8.1.1 Independent analog peripherals supply . . . . . . . . . . . . . . . . . . . . . . . . 264

8.1.2 Independent I/O supply rail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264

8.1.3 Independent USB transceivers supply . . . . . . . . . . . . . . . . . . . . . . . . . 264

8.1.4 Battery backup domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265

8.2 System supply voltage regulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266

8.2.1 Voltage regulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266

8.2.2 Embedded SMPS step down converter . . . . . . . . . . . . . . . . . . . . . . . . 267

8.2.3 SMPS step down converter power supply scheme . . . . . . . . . . . . . . . 268

8.2.4 SMPS step down converter versus low-power mode . . . . . . . . . . . . . 269

8.2.5 Dynamic voltage scaling management . . . . . . . . . . . . . . . . . . . . . . . . 270

8.2.6 VDD12 domain and external SMPS . . . . . . . . . . . . . . . . . . . . . . . . . . 271

8.3 Power supply supervision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273

8.3.1

Power-on reset (POR) / power-down reset (PDR) / brown-out reset (BOR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273

8.3.2 Programmable voltage detector (PVD) . . . . . . . . . . . . . . . . . . . . . . . . 274

8.3.3 Peripheral voltage monitoring (PVM) . . . . . . . . . . . . . . . . . . . . . . . . . . 275

8.3.4 Upper voltage threshold monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . 276

8.3.5 Temperature threshold monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276

8.4 Power management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277

8.4.1 Power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277

8.4.2 Run mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283

8.4.3 Low-power run mode (LP run) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283

8.4.4 Low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284

8.4.5 Sleep mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285

8.4.6 Low-power sleep mode (LP sleep) . . . . . . . . . . . . . . . . . . . . . . . . . . . 286

8.4.7 Stop 0 mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287

8.4.8 Stop 1 mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289

8.4.9 Stop 2 mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290

8.4.10 Standby mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292

8.4.11 Shutdown mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295

8.4.12 Auto-wakeup from a low-power mode . . . . . . . . . . . . . . . . . . . . . . . . . 296

8.5 PWR TrustZone security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296

8.5.1 PWR Privileged and Unprivileged modes . . . . . . . . . . . . . . . . . . . . . . 298

8.6 PWR registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298

8/2187

RM0438 Rev 8

RM0438

Contents

8.6.1 8.6.2 8.6.3 8.6.4 8.6.5 8.6.6 8.6.7 8.6.8 8.6.9 8.6.10 8.6.11 8.6.12 8.6.13 8.6.14 8.6.15 8.6.16 8.6.17 8.6.18 8.6.19 8.6.20 8.6.21 8.6.22 8.6.23 8.6.24 8.6.25 8.6.26

Power control register 1 (PWR_CR1) . . . . . . . . . . . . . . . . . . . . . . . . . 299 Power control register 2 (PWR_CR2) . . . . . . . . . . . . . . . . . . . . . . . . . 300 Power control register 3 (PWR_CR3) . . . . . . . . . . . . . . . . . . . . . . . . . 301 Power control register 4 (PWR_CR4) . . . . . . . . . . . . . . . . . . . . . . . . . 303 Power status register 1 (PWR_SR1) . . . . . . . . . . . . . . . . . . . . . . . . . . 304 Power status register 2 (PWR_SR2) . . . . . . . . . . . . . . . . . . . . . . . . . . 306 Power status clear register (PWR_SCR) . . . . . . . . . . . . . . . . . . . . . . . 307 Power Port A pull-up control register (PWR_PUCRA) . . . . . . . . . . . . . 308 Power Port A pull-down control register (PWR_PDCRA) . . . . . . . . . . 308 Power Port B pull-up control register (PWR_PUCRB) . . . . . . . . . . . . . 309 Power Port B pull-down control register (PWR_PDCRB) . . . . . . . . . . 310 Power Port C pull-up control register (PWR_PUCRC) . . . . . . . . . . . . 310 Power Port C pull-down control register (PWR_PDCRC) . . . . . . . . . . 311 Power Port D pull-up control register (PWR_PUCRD) . . . . . . . . . . . . 311 Power Port D pull-down control register (PWR_PDCRD) . . . . . . . . . . 312 Power Port E pull-up control register (PWR_PUCRE) . . . . . . . . . . . . . 313 Power Port E pull-down control register (PWR_PDCRE) . . . . . . . . . . 313 Power Port F pull-up control register (PWR_PUCRF) . . . . . . . . . . . . . 314 Power Port F pull-down control register (PWR_PDCRF) . . . . . . . . . . 314 Power Port G pull-up control register (PWR_PUCRG) . . . . . . . . . . . . 315 Power Port G pull-down control register (PWR_PDCRG) . . . . . . . . . . 316 Power Port H pull-up control register (PWR_PUCRH) . . . . . . . . . . . . 316 Power Port H pull-down control register (PWR_PDCRH) . . . . . . . . . . 317 Power secure configuration register (PWR_SECCFGR) . . . . . . . . . . . 317 Power privilege configuration register (PWR_PRIVCFGR) . . . . . . . . . 319 PWR register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . 320

9

Reset and clock control (RCC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323

9.1 Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323

9.1.1 Power reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323

9.1.2 System reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323

9.1.3 Backup domain reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325

9.2 RCC pins and internal signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325

9.3 Clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325

9.3.1 HSE clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329

9.3.2 HSI16 clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330

9.3.3 MSI clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331

RM0438 Rev 8

9/2187
54

Contents

RM0438

9.3.4 HSI48 clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 9.3.5 PLL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 9.3.6 LSE clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 9.3.7 LSE system clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 9.3.8 LSI clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 9.3.9 System clock (SYSCLK) selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 9.3.10 Clock source frequency versus voltage scaling . . . . . . . . . . . . . . . . . . 335 9.3.11 Clock security system (CSS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335 9.3.12 Clock security system on LSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335 9.3.13 ADC clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 9.3.14 RTC clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 9.3.15 Timer clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 9.3.16 Watchdog clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 9.3.17 Clock-out capability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 9.3.18 Internal/external clock measurement with TIM15/TIM16/TIM17 . . . . . 337 9.3.19 Peripheral clock enable registers
(RCC_AHBxENR, RCC_APBxENRy) . . . . . . . . . . . . . . . . . . . . . . . . . 340
9.4 Low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340 9.5 RCC TrustZone® security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 9.6 RCC Privileged and Unprivileged mode . . . . . . . . . . . . . . . . . . . . . . . . . 343 9.7 RCC interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 9.8 RCC registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
9.8.1 RCC clock control register (RCC_CR) . . . . . . . . . . . . . . . . . . . . . . . . . 345 9.8.2 RCC internal clock sources calibration register (RCC_ICSCR) . . . . . . 348 9.8.3 RCC clock configuration register (RCC_CFGR) . . . . . . . . . . . . . . . . . 349 9.8.4 RCC PLL configuration register (RCC_PLLCFGR) . . . . . . . . . . . . . . . 352 9.8.5 RCC PLLSAI1 configuration register (RCC_PLLSAI1CFGR) . . . . . . . 355 9.8.6 RCC PLLSAI2 configuration register (RCC_PLLSAI2CFGR) . . . . . . . 358 9.8.7 RCC clock interrupt enable register (RCC_CIER) . . . . . . . . . . . . . . . . 360 9.8.8 RCC clock interrupt flag register (RCC_CIFR) . . . . . . . . . . . . . . . . . . 361 9.8.9 RCC clock interrupt clear register (RCC_CICR) . . . . . . . . . . . . . . . . . 363 9.8.10 RCC AHB1 peripheral reset register (RCC_AHB1RSTR) . . . . . . . . . . 364 9.8.11 RCC AHB2 peripheral reset register (RCC_AHB2RSTR) . . . . . . . . . . 365 9.8.12 RCC AHB3 peripheral reset register (RCC_AHB3RSTR) . . . . . . . . . . 367 9.8.13 RCC APB1 peripheral reset register 1 (RCC_APB1RSTR1) . . . . . . . . 368 9.8.14 RCC APB1 peripheral reset register 2 (RCC_APB1RSTR2) . . . . . . . . 370 9.8.15 RCC APB2 peripheral reset register (RCC_APB2RSTR) . . . . . . . . . . 371

10/2187

RM0438 Rev 8

RM0438

Contents

9.8.16 9.8.17 9.8.18 9.8.19 9.8.20 9.8.21 9.8.22
9.8.23
9.8.24
9.8.25
9.8.26
9.8.27
9.8.28
9.8.29 9.8.30 9.8.31 9.8.32
9.8.33 9.8.34 9.8.35 9.8.36 9.8.37 9.8.38 9.8.39 9.8.40 9.8.41 9.8.42

RCC AHB1 peripheral clock enable register (RCC_AHB1ENR) . . . . . 373 RCC AHB2 peripheral clock enable register (RCC_AHB2ENR) . . . . . 374 RCC AHB3 peripheral clock enable register(RCC_AHB3ENR) . . . . . . 376
RCC APB1 peripheral clock enable register 1 (RCC_APB1ENR1) . . . 377 RCC APB1 peripheral clock enable register 2 (RCC_APB1ENR2) . . . 379
RCC APB2 peripheral clock enable register (RCC_APB2ENR) . . . . . 381 RCC AHB1 peripheral clocks enable in Sleep and Stop modes register (RCC_AHB1SMENR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382 RCC AHB2 peripheral clocks enable in Sleep and Stop modes register (RCC_AHB2SMENR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
RCC AHB3 peripheral clocks enable in Sleep and Stop modes register (RCC_AHB3SMENR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386 RCC APB1 peripheral clocks enable in Sleep and Stop modes register 1 (RCC_APB1SMENR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 RCC APB1 peripheral clocks enable in Sleep and Stop modes register 2 (RCC_APB1SMENR2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
RCC APB2 peripheral clocks enable in Sleep and Stop modes register (RCC_APB2SMENR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 RCC peripherals independent clock configuration register 1 (RCC_CCIPR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 RCC Backup domain control register (RCC_BDCR) . . . . . . . . . . . . . . 395
RCC control/status register (RCC_CSR) . . . . . . . . . . . . . . . . . . . . . . . 398 RCC clock recovery RC register (RCC_CRRCR) . . . . . . . . . . . . . . . . 400 RCC peripherals independent clock configuration register 2 (RCC_CCIPR2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
OCTOSPI delay configuration register (RCC_DLYCFGR) . . . . . . . . . 402 RCC secure configuration register (RCC_SECCFGR) . . . . . . . . . . . . 403 RCC secure status register (RCC_SECSR) . . . . . . . . . . . . . . . . . . . . 405
RCC AHB1 security status register (RCC_AHB1SECSR) . . . . . . . . . . 407 RCC AHB2 security status register (RCC_AHB2SECSR) . . . . . . . . . . 408 RCC AHB3 security status register (RCC_AHB3SECSR) . . . . . . . . . . 410
RCC APB1 security status register 1 (RCC_APB1SECSR1) . . . . . . . 411 RCC APB1 security status register 2 (RCC_APB1SECSR2) . . . . . . . 414 RCC APB2 security status register (RCC_APB2SECSR) . . . . . . . . . . 415
RCC register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417

10

Clock recovery system (CRS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424

10.1 CRS introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424

10.2 CRS main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424

RM0438 Rev 8

11/2187
54

Contents

RM0438

10.3 10.4
10.5 10.6 10.7

CRS implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424 CRS functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
10.4.1 CRS block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425 10.4.2 CRS internal signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425 10.4.3 Synchronization input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426 10.4.4 Frequency error measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426 10.4.5 Frequency error evaluation and automatic trimming . . . . . . . . . . . . . . 427 10.4.6 CRS initialization and configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
CRS in low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429 CRS interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429 CRS registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
10.7.1 CRS control register (CRS_CR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429 10.7.2 CRS configuration register (CRS_CFGR) . . . . . . . . . . . . . . . . . . . . . . 430 10.7.3 CRS interrupt and status register (CRS_ISR) . . . . . . . . . . . . . . . . . . . 431 10.7.4 CRS interrupt flag clear register (CRS_ICR) . . . . . . . . . . . . . . . . . . . . 433 10.7.5 CRS register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434

11

General-purpose I/Os (GPIO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435

11.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435

11.2 GPIO main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435

11.3 GPIO functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435

11.3.1 General-purpose I/O (GPIO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438

11.3.2 I/O pin alternate function multiplexer and mapping . . . . . . . . . . . . . . . 438

11.3.3 I/O port control registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439

11.3.4 I/O port data registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439

11.3.5 I/O data bitwise handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439

11.3.6 GPIO locking mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440

11.3.7 I/O alternate function input/output . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440

11.3.8 External interrupt/wakeup lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440

11.3.9 Input configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441

11.3.10 Output configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441

11.3.11 Alternate function configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442

11.3.12 Analog configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443

11.3.13 Using the HSE or LSE oscillator pins as GPIOs . . . . . . . . . . . . . . . . . 443

11.3.14 Using the GPIO pins in the RTC supply domain . . . . . . . . . . . . . . . . . 443

11.3.15 Using PH3 as GPIO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444

12/2187

RM0438 Rev 8

RM0438

Contents

11.4 11.5 11.6

TrustZone security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
Privileged and Unprivileged modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
GPIO registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
11.6.1 GPIO port mode register (GPIOx_MODER) (x =A to H) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
11.6.2 GPIO port output type register (GPIOx_OTYPER) (x = A to H) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
11.6.3 GPIO port output speed register (GPIOx_OSPEEDR) (x = A to H) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
11.6.4 GPIO port pull-up/pull-down register (GPIOx_PUPDR) (x = A to H) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
11.6.5 GPIO port input data register (GPIOx_IDR) (x = A to H) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448
11.6.6 GPIO port output data register (GPIOx_ODR) (x = A to H) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448
11.6.7 GPIO port bit set/reset register (GPIOx_BSRR) (x = A to H) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448
11.6.8 GPIO port configuration lock register (GPIOx_LCKR) (x = A to H) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
11.6.9 GPIO alternate function low register (GPIOx_AFRL) (x = A to H) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450
11.6.10 GPIO alternate function high register (GPIOx_AFRH) (x = A to H) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
11.6.11 GPIO port bit reset register (GPIOx_BRR) (x = A to H) . . . . . . . . . . . . 452
11.6.12 GPIO secure configuration register (GPIOx_SECCFGR) (x = A to H) . 452
11.6.13 GPIO register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454

12

System configuration controller (SYSCFG) . . . . . . . . . . . . . . . . . . . . 456

12.1 SYSCFG main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456

12.2 SYSCFG TrustZone security and privilege . . . . . . . . . . . . . . . . . . . . . . . 456

12.3 SYSCFG registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458

12.3.1 SYSCFG secure configuration register (SYSCFG_SECCFGR) . . . . . 458

12.3.2 SYSCFG configuration register 1 (SYSCFG_CFGR1) . . . . . . . . . . . . 459

12.3.3 FPU interrupt mask register (SYSCFG_FPUIMR) . . . . . . . . . . . . . . . . 461

12.3.4 SYSCFG CPU non-secure lock register (SYSCFG_CNSLCKR) . . . . . 461

12.3.5 SYSCFG CPU secure lock register (SYSCFG_CSLOCKR) . . . . . . . . 462

12.3.6 SYSCFG configuration register 2 (SYSCFG_CFGR2) . . . . . . . . . . . . 463

12.3.7 SYSCFG SRAM2 control and status register (SYSCFG_SCSR) . . . . 464

12.3.8 SYSCFG SRAM2 key register (SYSCFG_SKR) . . . . . . . . . . . . . . . . . 465

RM0438 Rev 8

13/2187
54

Contents

RM0438

12.3.9 SYSCFG SRAM2 write protection register (SYSCFG_SWPR) . . . . . . 465 12.3.10 SYSCFG SRAM2 write protection register 2 (SYSCFG_SWPR2) . . . 466 12.3.11 SYSCFG RSS command register (SYSCFG_RSSCMDR) . . . . . . . . . 466 12.3.12 SYSCFG register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467

13

Peripherals interconnect matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469

13.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469

13.2 Connection summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469

13.3 Interconnection details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470

13.3.1 From timer (TIM1/TIM2/TIM3/TIM4/TIM5/TIM8/TIM15/TIM16/TIM17) to timer (TIM1/TIM2/TIM3/TIM4/TIM5/TIM8/TIM15) . . . . . . . . . . . . . . . . 470

13.3.2 From timer (TIM1/TIM2/TIM3/TIM4/TIM6/TIM8/TIM15) and EXTI to ADC (ADC1/ADC2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471

13.3.3 From ADC1/ADC2 to timer (TIM1/TIM8) . . . . . . . . . . . . . . . . . . . . . . . 471

13.3.4 From timer (TIM2/TIM4/TIM5/TIM6/TIM7/TIM8) and EXTI to DAC (DAC1/DAC2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472

13.3.5 From timer (TIM1/TIM3/TIM4/TIM6/TIM7/TIM8/TIM16/LPTIM1) and EXTI to DFSDM1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472

13.3.6 From DFSDM1 to timer (TIM1/TIM8/TIM15/TIM16/TIM17) . . . . . . . . . 473

13.3.7 From HSE, LSE, LSI, MSI, MCO, RTC to timer (TIM2/TIM15/TIM16/TIM17) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473

13.3.8 From RTC, COMP1, COMP2 to low-power timer (LPTIM1/LPTIM2/LPTIM3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474

13.3.9 From timer (TIM1/TIM2/TIM3/TIM8/TIM15) to comparators (COMP1/COMP2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474

13.3.10 From ADC (ADC1) to ADC (ADC2) . . . . . . . . . . . . . . . . . . . . . . . . . . . 474

13.3.11 From USB to timer (TIM2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475

13.3.12 From internal analog source to ADC (ADC1/ADC2) and OPAMP (OPAMP1/OPAM2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475

13.3.13 From comparators (COMP1/COMP2) to timers (TIM1/TIM2/TIM3/TIM8/TIM15/TIM16/TIM17) . . . . . . . . . . . . . . . . . . . 475

13.3.14 From system errors to timers (TIM1/TIM8/TIM15/TIM16/TIM17) . . . . 476

13.3.15 From timers (TIM16/TIM17) to IRTIM . . . . . . . . . . . . . . . . . . . . . . . . . 476

13.3.16 From ADC (ADC1/ADC2) to DFSDM . . . . . . . . . . . . . . . . . . . . . . . . . . 477

14

Direct memory access controller (DMA) . . . . . . . . . . . . . . . . . . . . . . . 478

14.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478

14.2 DMA main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478

14.3 DMA implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479

14/2187

RM0438 Rev 8

RM0438

Contents

14.4
14.5 14.6

14.3.1 DMA1 and DMA2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479 14.3.2 DMA request mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479
DMA functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
14.4.1 DMA block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480 14.4.2 DMA pins and internal signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481 14.4.3 DMA transfers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481 14.4.4 DMA arbitration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482 14.4.5 DMA channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483 14.4.6 DMA data width, alignment and endianness . . . . . . . . . . . . . . . . . . . . 488 14.4.7 DMA error management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489
DMA interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490 DMA registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490
14.6.1 DMA interrupt status register (DMA_ISR) . . . . . . . . . . . . . . . . . . . . . . 490 14.6.2 DMA interrupt flag clear register (DMA_IFCR) . . . . . . . . . . . . . . . . . . 494 14.6.3 DMA channel x configuration register (DMA_CCRx) . . . . . . . . . . . . . . 495 14.6.4 DMA channel x number of data to transfer register (DMA_CNDTRx) . 500 14.6.5 DMA channel x peripheral address register (DMA_CPARx) . . . . . . . . 501 14.6.6 DMA channel x memory 0 address register (DMA_CM0ARx) . . . . . . . 501 14.6.7 DMA channel x memory 1 address register (DMA_CM1ARx) . . . . . . . 502 14.6.8 DMA register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502

15

DMA request multiplexer (DMAMUX) . . . . . . . . . . . . . . . . . . . . . . . . . 506

15.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506

15.2 DMAMUX main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507

15.3 DMAMUX implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507

15.3.1 DMAMUX instantiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507

15.3.2 DMAMUX mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508

15.4 DMAMUX functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .511

15.4.1 DMAMUX block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511

15.4.2 DMAMUX signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512

15.4.3 DMAMUX channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512

15.4.4 DMAMUX secure/non-secure channels . . . . . . . . . . . . . . . . . . . . . . . . 513

15.4.5 DMAMUX privileged / unprivileged channels . . . . . . . . . . . . . . . . . . . . 513

15.4.6 DMAMUX request line multiplexer . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513

15.4.7 DMAMUX request generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516

15.5 DMAMUX interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517

RM0438 Rev 8

15/2187
54

Contents

RM0438

15.6

DMAMUX registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
15.6.1 DMAMUX request line multiplexer channel x configuration register (DMAMUX_CxCR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
15.6.2 DMAMUX request line multiplexer interrupt channel status register (DMAMUX_CSR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520
15.6.3 DMAMUX request line multiplexer interrupt channel clear flag register (DMAMUX_CCFR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520
15.6.4 DMAMUX request generator channel x configuration register (DMAMUX_RGxCR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
15.6.5 DMAMUX request generator interrupt status register (DMAMUX_RGSR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522
15.6.6 DMAMUX request generator interrupt clear flag register (DMAMUX_RGCFR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523
15.6.7 DMAMUX register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524

16

Nested vectored interrupt controller (NVIC) . . . . . . . . . . . . . . . . . . . . 528

16.1 NVIC main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528

16.2 SysTick calibration value register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528

16.3 Interrupt and exception vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529

17

Extended interrupts and event controller (EXTI) . . . . . . . . . . . . . . . . 533

17.1 EXTI main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533

17.2 EXTI block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534

17.2.1 EXTI connections between peripherals and CPU . . . . . . . . . . . . . . . . 535

17.2.2 EXTI interrupt/event mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535

17.3 EXTI functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537

17.3.1 EXTI configurable event input wakeup . . . . . . . . . . . . . . . . . . . . . . . . 537

17.3.2 EXTI direct event input wakeup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539

17.3.3 EXTI mux selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539

17.4 EXTI functional behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540

17.5 EXTI event protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541

17.5.1 EXTI security protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541

17.5.2 EXTI privilege protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542

17.6 EXTI registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543

17.6.1 17.6.2 17.6.3 17.6.4

EXTI rising trigger selection register (EXTI_RTSR1) . . . . . . . . . . . . . . 543 EXTI falling trigger selection register (EXTI_FTSR1) . . . . . . . . . . . . . 544 EXTI software interrupt event register (EXTI_SWIER1) . . . . . . . . . . . 545 EXTI rising edge pending register (EXTI_RPR1) . . . . . . . . . . . . . . . . 546

16/2187

RM0438 Rev 8

RM0438

Contents

17.6.5 EXTI falling edge pending register (EXTI_FPR1) . . . . . . . . . . . . . . . . 547 17.6.6 EXTI security configuration register (EXTI_SECCFGR1) . . . . . . . . . . 548 17.6.7 EXTI privilege configuration register (EXTI_PRIVCFGR1) . . . . . . . . . 549 17.6.8 EXTI rising trigger selection register (EXTI_RTSR2) . . . . . . . . . . . . . . 549 17.6.9 EXTI falling trigger selection register (EXTI_FTSR2) . . . . . . . . . . . . . 550 17.6.10 EXTI software interrupt event register (EXTI_SWIER2) . . . . . . . . . . . 551 17.6.11 EXTI rising edge pending register (EXTI_RPR2) . . . . . . . . . . . . . . . . 551 17.6.12 EXTI falling edge pending register (EXTI_FPR2) . . . . . . . . . . . . . . . . 552 17.6.13 EXTI security enable register (EXTI_SECCFGR2) . . . . . . . . . . . . . . . 553 17.6.14 EXTI privilege enable register (EXTI_PRIVCFGR2) . . . . . . . . . . . . . . 553 17.6.15 EXTI external interrupt selection register (EXTI_EXTICRn) . . . . . . . . 554 17.6.16 EXTI lock register (EXTI_LOCKR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557 17.6.17 EXTI CPU wakeup with interrupt mask register (EXTI_IMR1) . . . . . . . 557 17.6.18 EXTI CPU wakeup with event mask register (EXTI_EMR1) . . . . . . . . 558 17.6.19 EXTI CPU wakeup with interrupt mask register (EXTI_IMR2) . . . . . . . 559 17.6.20 EXTI CPU wakeup with event mask register (EXTI_EMR2) . . . . . . . . 559 17.6.21 EXTI register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 560

18

Cyclic redundancy check calculation unit (CRC) . . . . . . . . . . . . . . . . 563

18.1 CRC introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563

18.2 CRC main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563

18.3 CRC functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564

18.3.1 CRC block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564

18.3.2 CRC internal signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564

18.3.3 CRC operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564

18.4 CRC registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566

18.4.1 18.4.2 18.4.3 18.4.4

CRC data register (CRC_DR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566 CRC independent data register (CRC_IDR) . . . . . . . . . . . . . . . . . . . . 566 CRC control register (CRC_CR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567 CRC initial value (CRC_INIT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568

18.4.5 CRC polynomial (CRC_POL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568

18.4.6 CRC register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569

19

Flexible static memory controller (FSMC) . . . . . . . . . . . . . . . . . . . . . 570

19.1 FMC introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570

19.2 FMC main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570

RM0438 Rev 8

17/2187
54

Contents

RM0438

19.3 19.4 19.5 19.6
19.7

FMC block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571 AHB interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571
19.4.1 Supported memories and transactions . . . . . . . . . . . . . . . . . . . . . . . . 572
External device address mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
19.5.1 NOR/PSRAM address mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573 19.5.2 NAND flash memory address mapping . . . . . . . . . . . . . . . . . . . . . . . . 574
NOR flash/PSRAM controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575
19.6.1 External memory interface signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576 19.6.2 Supported memories and transactions . . . . . . . . . . . . . . . . . . . . . . . . 578 19.6.3 General timing rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580 19.6.4 NOR flash/PSRAM controller asynchronous transactions . . . . . . . . . . 580 19.6.5 Synchronous transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598 19.6.6 NOR/PSRAM controller registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605
NAND flash controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613
19.7.1 External memory interface signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613 19.7.2 NAND flash supported memories and transactions . . . . . . . . . . . . . . . 614 19.7.3 Timing diagrams for NAND flash memory . . . . . . . . . . . . . . . . . . . . . . 615 19.7.4 NAND flash operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615 19.7.5 NAND flash prewait functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616 19.7.6 Computation of the error correction code (ECC)
in NAND flash memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617 19.7.7 NAND flash controller registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 618 19.7.8 FMC register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624

20

Octo-SPI interface (OCTOSPI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626

20.1 OCTOSPI introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626

20.2 OCTOSPI main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626

20.3 OCTOSPI implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 627

20.4 OCTOSPI functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628

20.4.1 OCTOSPI block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628

20.4.2 OCTOSPI pins and internal signals . . . . . . . . . . . . . . . . . . . . . . . . . . . 629

20.4.3 OCTOSPI interface to memory modes . . . . . . . . . . . . . . . . . . . . . . . . 630

20.4.4 OCTOSPI regular-command protocol . . . . . . . . . . . . . . . . . . . . . . . . . 630

20.4.5 OCTOSPI regular-command protocol signal interface . . . . . . . . . . . . . 634

20.4.6 HyperBus protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637

20.4.7 Specific features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641

18/2187

RM0438 Rev 8

RM0438

Contents

20.5 20.6 20.7

20.4.8 OCTOSPI operating mode introduction . . . . . . . . . . . . . . . . . . . . . . . . 642 20.4.9 OCTOSPI indirect mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 642 20.4.10 OCTOSPI automatic status-polling mode . . . . . . . . . . . . . . . . . . . . . . 644 20.4.11 OCTOSPI memory-mapped mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645 20.4.12 OCTOSPI configuration introduction . . . . . . . . . . . . . . . . . . . . . . . . . . 646 20.4.13 OCTOSPI system configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 646 20.4.14 OCTOSPI device configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 646 20.4.15 OCTOSPI regular-command mode configuration . . . . . . . . . . . . . . . . 649 20.4.16 OCTOSPI HyperBus protocol configuration . . . . . . . . . . . . . . . . . . . . . 651 20.4.17 OCTOSPI error management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 652 20.4.18 OCTOSPI BUSY and ABORT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 653 20.4.19 OCTOSPI reconfiguration or deactivation . . . . . . . . . . . . . . . . . . . . . . 653 20.4.20 NCS behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 653
Address alignment and data number . . . . . . . . . . . . . . . . . . . . . . . . . . . 655 OCTOSPI interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656 OCTOSPI registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657
20.7.1 OCTOSPI control register (OCTOSPI_CR) . . . . . . . . . . . . . . . . . . . . . 657 20.7.2 OCTOSPI device configuration register 1 (OCTOSPI_DCR1) . . . . . . 659 20.7.3 OCTOSPI device configuration register 2 (OCTOSPI_DCR2) . . . . . . 661 20.7.4 OCTOSPI device configuration register 3 (OCTOSPI_DCR3) . . . . . . 662 20.7.5 OCTOSPI device configuration register 4 (OCTOSPI_DCR4) . . . . . . 662 20.7.6 OCTOSPI status register (OCTOSPI_SR) . . . . . . . . . . . . . . . . . . . . . . 663 20.7.7 OCTOSPI flag clear register (OCTOSPI_FCR) . . . . . . . . . . . . . . . . . . 664 20.7.8 OCTOSPI data length register (OCTOSPI_DLR) . . . . . . . . . . . . . . . . 664 20.7.9 OCTOSPI address register (OCTOSPI_AR) . . . . . . . . . . . . . . . . . . . . 665 20.7.10 OCTOSPI data register (OCTOSPI_DR) . . . . . . . . . . . . . . . . . . . . . . . 665 20.7.11 OCTOSPI polling status mask register (OCTOSPI_PSMKR) . . . . . . . 666 20.7.12 OCTOSPI polling status match register (OCTOSPI_PSMAR) . . . . . . . 667 20.7.13 OCTOSPI polling interval register (OCTOSPI_PIR) . . . . . . . . . . . . . . 667 20.7.14 OCTOSPI communication configuration register (OCTOSPI_CCR) . . 667 20.7.15 OCTOSPI timing configuration register (OCTOSPI_TCR) . . . . . . . . . . 670 20.7.16 OCTOSPI instruction register (OCTOSPI_IR) . . . . . . . . . . . . . . . . . . . 670 20.7.17 OCTOSPI alternate bytes register (OCTOSPI_ABR) . . . . . . . . . . . . . 671 20.7.18 OCTOSPI low-power timeout register (OCTOSPI_LPTR) . . . . . . . . . . 671 20.7.19 OCTOSPI wrap communication configuration register
(OCTOSPI_WPCCR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 672 20.7.20 OCTOSPI wrap timing configuration register (OCTOSPI_WPTCR) . . 674

RM0438 Rev 8

19/2187
54

Contents

RM0438

20.7.21 OCTOSPI wrap instruction register (OCTOSPI_WPIR) . . . . . . . . . . . . 674 20.7.22 OCTOSPI wrap alternate bytes register (OCTOSPI_WPABR) . . . . . . 675 20.7.23 OCTOSPI write communication configuration register
(OCTOSPI_WCCR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675 20.7.24 OCTOSPI write timing configuration register (OCTOSPI_WTCR) . . . . 677 20.7.25 OCTOSPI write instruction register (OCTOSPI_WIR) . . . . . . . . . . . . . 678 20.7.26 OCTOSPI write alternate bytes register (OCTOSPI_WABR) . . . . . . . 678 20.7.27 OCTOSPI HyperBus latency configuration register
(OCTOSPI_HLCR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679 20.7.28 OCTOSPI register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679

21

Analog-to-digital converters (ADC) . . . . . . . . . . . . . . . . . . . . . . . . . . . 683

21.1 ADC introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 683

21.2 ADC main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 684

21.3 ADC implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685

21.4 ADC functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 686

21.4.1 ADC block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 686

21.4.2 ADC pins and internal signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687

21.4.3 ADC clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688

21.4.4 ADC1/2 connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690

21.4.5 Slave AHB interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 692

21.4.6 ADC Deep-power-down mode (DEEPPWD) and ADC voltage regulator (ADVREGEN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 692

21.4.7 Single-ended and differential input channels . . . . . . . . . . . . . . . . . . . . 693

21.4.8 Calibration (ADCAL, ADCALDIF, ADC_CALFACT) . . . . . . . . . . . . . . . 693

21.4.9 ADC on-off control (ADEN, ADDIS, ADRDY) . . . . . . . . . . . . . . . . . . . . 696

21.4.10 Constraints when writing the ADC control bits . . . . . . . . . . . . . . . . . . . 697

21.4.11 Channel selection (ADC_SQRy, ADC_JSQR) . . . . . . . . . . . . . . . . . . . 698

21.4.12 Channel-wise programmable sampling time (SMPR1, SMPR2) . . . . . 699

21.4.13 Single conversion mode (CONT = 0) . . . . . . . . . . . . . . . . . . . . . . . . . . 699

21.4.14 Continuous conversion mode (CONT = 1) . . . . . . . . . . . . . . . . . . . . . . 700

21.4.15 Starting conversions (ADSTART, JADSTART) . . . . . . . . . . . . . . . . . . . 701

21.4.16 ADC timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702

21.4.17 Stopping an ongoing conversion (ADSTP, JADSTP) . . . . . . . . . . . . . . 702

21.4.18 Conversion on external trigger and trigger polarity (EXTSEL, EXTEN, JEXTSEL, JEXTEN) . . . . . . . . . . . . . . . . . . . . . . . 704

21.4.19 Injected channel management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706

21.4.20 Discontinuous mode (DISCEN, DISCNUM, JDISCEN) . . . . . . . . . . . . 708

20/2187

RM0438 Rev 8

RM0438

Contents

21.5 21.6 21.7

21.4.21 Queue of context for injected conversions . . . . . . . . . . . . . . . . . . . . . . 709 21.4.22 Programmable resolution (RES) – Fast conversion mode . . . . . . . . . . 717 21.4.23 End of conversion, end of sampling phase (EOC, JEOC, EOSMP) . . 718 21.4.24 End of conversion sequence (EOS, JEOS) . . . . . . . . . . . . . . . . . . . . . 718 21.4.25 Timing diagrams example (single/continuous modes,
hardware/software triggers) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 719 21.4.26 Data management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 721 21.4.27 Managing conversions using the DFSDM . . . . . . . . . . . . . . . . . . . . . . 726 21.4.28 Dynamic low-power features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727 21.4.29 Analog window watchdog (AWD1EN, JAWD1EN, AWD1SGL,
AWD1CH, AWD2CH, AWD3CH, AWD_HTx, AWD_LTx, AWDx) . . . . . 732 21.4.30 Oversampler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 736 21.4.31 Dual ADC modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 742 21.4.32 Temperature sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 755 21.4.33 VBAT supply monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 757 21.4.34 Monitoring the internal voltage reference . . . . . . . . . . . . . . . . . . . . . . 758
ADC in low-power mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 759 ADC interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 760 ADC registers (for each ADC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 761
21.7.1 ADC interrupt and status register (ADC_ISR) . . . . . . . . . . . . . . . . . . . 761 21.7.2 ADC interrupt enable register (ADC_IER) . . . . . . . . . . . . . . . . . . . . . . 763 21.7.3 ADC control register (ADC_CR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 765 21.7.4 ADC configuration register (ADC_CFGR) . . . . . . . . . . . . . . . . . . . . . . 768 21.7.5 ADC configuration register 2 (ADC_CFGR2) . . . . . . . . . . . . . . . . . . . 772 21.7.6 ADC sample time register 1 (ADC_SMPR1) . . . . . . . . . . . . . . . . . . . . 774 21.7.7 ADC sample time register 2 (ADC_SMPR2) . . . . . . . . . . . . . . . . . . . . 775 21.7.8 ADC watchdog threshold register 1 (ADC_TR1) . . . . . . . . . . . . . . . . . 776 21.7.9 ADC watchdog threshold register 2 (ADC_TR2) . . . . . . . . . . . . . . . . . 776 21.7.10 ADC watchdog threshold register 3 (ADC_TR3) . . . . . . . . . . . . . . . . . 777 21.7.11 ADC regular sequence register 1 (ADC_SQR1) . . . . . . . . . . . . . . . . . 778 21.7.12 ADC regular sequence register 2 (ADC_SQR2) . . . . . . . . . . . . . . . . . 779 21.7.13 ADC regular sequence register 3 (ADC_SQR3) . . . . . . . . . . . . . . . . . 780 21.7.14 ADC regular sequence register 4 (ADC_SQR4) . . . . . . . . . . . . . . . . . 781 21.7.15 ADC regular data register (ADC_DR) . . . . . . . . . . . . . . . . . . . . . . . . . 781 21.7.16 ADC injected sequence register (ADC_JSQR) . . . . . . . . . . . . . . . . . . 782 21.7.17 ADC offset y register (ADC_OFRy) . . . . . . . . . . . . . . . . . . . . . . . . . . . 784 21.7.18 ADC injected channel y data register (ADC_JDRy) . . . . . . . . . . . . . . . 785

RM0438 Rev 8

21/2187
54

Contents

RM0438

21.8 21.9

21.7.19 ADC analog watchdog 2 configuration register (ADC_AWD2CR) . . . . 785 21.7.20 ADC analog watchdog 3 configuration register (ADC_AWD3CR) . . . . 786 21.7.21 ADC differential mode selection register (ADC_DIFSEL) . . . . . . . . . . 786 21.7.22 ADC calibration factors (ADC_CALFACT) . . . . . . . . . . . . . . . . . . . . . . 787
ADC common registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 787
21.8.1 ADC common status register (ADC_CSR) . . . . . . . . . . . . . . . . . . . . . 787 21.8.2 ADC common control register (ADC_CCR) . . . . . . . . . . . . . . . . . . . . . 789 21.8.3 ADC common regular data register for dual mode (ADC_CDR) . . . . . 792
ADC register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 792

22

Digital-to-analog converter (DAC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796

22.1 DAC introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796

22.2 DAC main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796

22.3 DAC implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 797

22.4 DAC functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 798

22.4.1 DAC block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 798

22.4.2 DAC channel enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 799

22.4.3 DAC data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 799

22.4.4 DAC conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 801

22.4.5 DAC output voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 801

22.4.6 DAC trigger selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 802

22.4.7 DMA requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 803

22.4.8 Noise generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 803

22.4.9 Triangle-wave generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 805

22.4.10 DAC channel modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 806

22.4.11 DAC channel buffer calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 809

22.4.12 DAC channel conversion modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 810

22.4.13 Dual DAC channel conversion modes (if dual channels are available) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 811

22.5 DAC in low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 815

22.6 DAC interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 816

22.7 DAC registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 816

22.7.1 DAC control register (DAC_CR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 816

22.7.2 DAC software trigger register (DAC_SWTRGR) . . . . . . . . . . . . . . . . . 820

22.7.3 DAC channel1 12-bit right-aligned data holding register (DAC_DHR12R1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 820

22/2187

RM0438 Rev 8

RM0438

Contents

22.7.4 DAC channel1 12-bit left aligned data holding register (DAC_DHR12L1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 821
22.7.5 DAC channel1 8-bit right aligned data holding register (DAC_DHR8R1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 821
22.7.6 DAC channel2 12-bit right aligned data holding register (DAC_DHR12R2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 822
22.7.7 DAC channel2 12-bit left aligned data holding register (DAC_DHR12L2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 822
22.7.8 DAC channel2 8-bit right-aligned data holding register (DAC_DHR8R2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 823
22.7.9 Dual DAC 12-bit right-aligned data holding register (DAC_DHR12RD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 823
22.7.10 Dual DAC 12-bit left aligned data holding register (DAC_DHR12LD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 824
22.7.11 Dual DAC 8-bit right aligned data holding register (DAC_DHR8RD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 824
22.7.12 DAC channel1 data output register (DAC_DOR1) . . . . . . . . . . . . . . . . 825
22.7.13 DAC channel2 data output register (DAC_DOR2) . . . . . . . . . . . . . . . . 825
22.7.14 DAC status register (DAC_SR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 825
22.7.15 DAC calibration control register (DAC_CCR) . . . . . . . . . . . . . . . . . . . 827
22.7.16 DAC mode control register (DAC_MCR) . . . . . . . . . . . . . . . . . . . . . . . 827
22.7.17 DAC channel1 sample and hold sample time register (DAC_SHSR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 829
22.7.18 DAC channel2 sample and hold sample time register (DAC_SHSR2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 829
22.7.19 DAC sample and hold time register (DAC_SHHR) . . . . . . . . . . . . . . . 829
22.7.20 DAC sample and hold refresh time register (DAC_SHRR) . . . . . . . . . 830
22.7.21 DAC register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 831

23

Voltage reference buffer (VREFBUF) . . . . . . . . . . . . . . . . . . . . . . . . . . 833

23.1 VREFBUF introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 833

23.2 VREFBUF functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 833

23.3 VREFBUF trimming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 834

23.4 VREFBUF registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 835

23.4.1 VREFBUF control and status register (VREFBUF_CSR) . . . . . . . . . . 835

23.4.2 VREFBUF calibration control register (VREFBUF_CCR) . . . . . . . . . . 836

23.4.3 VREFBUF register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 836

24

Comparator (COMP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837

24.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837

RM0438 Rev 8

23/2187
54

Contents

RM0438

24.2 24.3
24.4 24.5 24.6

COMP main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837 COMP functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 838
24.3.1 COMP block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 838 24.3.2 COMP pins and internal signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 838 24.3.3 COMP reset and clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 839 24.3.4 Comparator LOCK mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 839 24.3.5 Window comparator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 840 24.3.6 Hysteresis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 840 24.3.7 Comparator output blanking function . . . . . . . . . . . . . . . . . . . . . . . . . . 841 24.3.8 COMP power and speed modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 842
COMP low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 842 COMP interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 842 COMP registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 843
24.6.1 Comparator 1 control and status register (COMP1_CSR) . . . . . . . . . . 843 24.6.2 Comparator 2 control and status register (COMP2_CSR) . . . . . . . . . . 845 24.6.3 COMP register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 848

25

Operational amplifiers (OPAMP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 849

25.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 849

25.2 OPAMP main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 849

25.3 OPAMP functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 849

25.3.1 OPAMP reset and clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 849

25.3.2 Initial configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 850

25.3.3 Signal routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 850

25.3.4 OPAMP modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 851

25.3.5 Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 854

25.4 OPAMP low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 856

25.5 OPAMP registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 857

25.5.1 OPAMP1 control/status register (OPAMP1_CSR) . . . . . . . . . . . . . . . . 857

25.5.2 OPAMP1 offset trimming register in normal mode (OPAMP1_OTR) . . 858

25.5.3 OPAMP1 offset trimming register in low-power mode (OPAMP1_LPOTR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 858

25.5.4 OPAMP2 control/status register (OPAMP2_CRS) . . . . . . . . . . . . . . . . 859

25.5.5 OPAMP2 offset trimming register in normal mode (OPAMP2_OTR) . . 860

25.5.6 OPAMP2 offset trimming register in low-power mode (OPAMP2_LPOTR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 860

25.5.7 OPAMP register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 861

24/2187

RM0438 Rev 8

RM0438

Contents

26

Digital filter for sigma delta modulators (DFSDM) . . . . . . . . . . . . . . . 862

26.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 862

26.2 DFSDM main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 863

26.3 DFSDM implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 864

26.4 DFSDM functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 865

26.4.1 DFSDM block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 865

26.4.2 DFSDM pins and internal signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 866

26.4.3 DFSDM reset and clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 867

26.4.4 Serial channel transceivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 868

26.4.5 Configuring the input serial interface . . . . . . . . . . . . . . . . . . . . . . . . . . 878

26.4.6 Parallel data inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 878

26.4.7 Channel selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 880

26.4.8 Digital filter configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 881

26.4.9 Integrator unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 882

26.4.10 Analog watchdog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 883

26.4.11 Short-circuit detector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 885

26.4.12 Extreme detector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 886

26.4.13 Data unit block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 886

26.4.14 Signed data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 887

26.4.15 Launching conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 888

26.4.16 Continuous and fast continuous modes . . . . . . . . . . . . . . . . . . . . . . . . 888

26.4.17 Request precedence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 889

26.4.18 Power optimization in run mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 890

26.5 DFSDM interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 890

26.6 DFSDM DMA transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 892

26.7 DFSDM channel y registers (y=0..3) . . . . . . . . . . . . . . . . . . . . . . . . . . . 892

26.7.1 DFSDM channel y configuration register (DFSDM_CHyCFGR1) . . . . 892

26.7.2 DFSDM channel y configuration register (DFSDM_CHyCFGR2) . . . . 894

26.7.3 DFSDM channel y analog watchdog and short-circuit detector register (DFSDM_CHyAWSCDR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 895

26.7.4 DFSDM channel y watchdog filter data register (DFSDM_CHyWDATR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 896

26.7.5 DFSDM channel y data input register (DFSDM_CHyDATINR) . . . . . . 896

26.7.6 DFSDM channel y delay register (DFSDM_CHyDLYR) . . . . . . . . . . . . 897

26.8 DFSDM filter x module registers (x=0..3) . . . . . . . . . . . . . . . . . . . . . . . . 898

26.8.1 DFSDM filter x control register 1 (DFSDM_FLTxCR1) . . . . . . . . . . . . 898

26.8.2 DFSDM filter x control register 2 (DFSDM_FLTxCR2) . . . . . . . . . . . . 901

RM0438 Rev 8

25/2187
54

Contents

RM0438

26.8.3 DFSDM filter x interrupt and status register (DFSDM_FLTxISR) . . . . . 902
26.8.4 DFSDM filter x interrupt flag clear register (DFSDM_FLTxICR) . . . . . 904
26.8.5 DFSDM filter x injected channel group selection register (DFSDM_FLTxJCHGR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 905
26.8.6 DFSDM filter x control register (DFSDM_FLTxFCR) . . . . . . . . . . . . . . 905
26.8.7 DFSDM filter x data register for injected group (DFSDM_FLTxJDATAR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 906
26.8.8 DFSDM filter x data register for the regular channel (DFSDM_FLTxRDATAR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 907
26.8.9 DFSDM filter x analog watchdog high threshold register (DFSDM_FLTxAWHTR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 908
26.8.10 DFSDM filter x analog watchdog low threshold register (DFSDM_FLTxAWLTR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 908
26.8.11 DFSDM filter x analog watchdog status register (DFSDM_FLTxAWSR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 909
26.8.12 DFSDM filter x analog watchdog clear flag register (DFSDM_FLTxAWCFR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 910
26.8.13 DFSDM filter x extremes detector maximum register (DFSDM_FLTxEXMAX) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 910
26.8.14 DFSDM filter x extremes detector minimum register (DFSDM_FLTxEXMIN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 911
26.8.15 DFSDM filter x conversion timer register (DFSDM_FLTxCNVTIMR) . . 911
26.8.16 DFSDM register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 912

27

Touch sensing controller (TSC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 920

27.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 920

27.2 TSC main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 920

27.3 TSC functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 921

27.3.1 TSC block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 921

27.3.2 Surface charge transfer acquisition overview . . . . . . . . . . . . . . . . . . . 921

27.3.3 Reset and clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 924

27.3.4 Charge transfer acquisition sequence . . . . . . . . . . . . . . . . . . . . . . . . . 924

27.3.5 Spread spectrum feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 925

27.3.6 Max count error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 926

27.3.7 Sampling capacitor I/O and channel I/O mode selection . . . . . . . . . . . 926

27.3.8 Acquisition mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 927

27.3.9 I/O hysteresis and analog switch control . . . . . . . . . . . . . . . . . . . . . . . 927

27.4 TSC low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 928

27.5 TSC interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 928

26/2187

RM0438 Rev 8

RM0438

Contents

27.6

TSC registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 928
27.6.1 TSC control register (TSC_CR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 928 27.6.2 TSC interrupt enable register (TSC_IER) . . . . . . . . . . . . . . . . . . . . . . 931 27.6.3 TSC interrupt clear register (TSC_ICR) . . . . . . . . . . . . . . . . . . . . . . . . 932 27.6.4 TSC interrupt status register (TSC_ISR) . . . . . . . . . . . . . . . . . . . . . . . 932 27.6.5 TSC I/O hysteresis control register (TSC_IOHCR) . . . . . . . . . . . . . . . 933 27.6.6 TSC I/O analog switch control register
(TSC_IOASCR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 933 27.6.7 TSC I/O sampling control register (TSC_IOSCR) . . . . . . . . . . . . . . . . 934 27.6.8 TSC I/O channel control register (TSC_IOCCR) . . . . . . . . . . . . . . . . . 934 27.6.9 TSC I/O group control status register (TSC_IOGCSR) . . . . . . . . . . . . 935 27.6.10 TSC I/O group x counter register (TSC_IOGxCR) . . . . . . . . . . . . . . . . 935 27.6.11 TSC register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 936

28

True random number generator (RNG) . . . . . . . . . . . . . . . . . . . . . . . . 938

28.1 RNG introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 938

28.2 RNG main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 938

28.3 RNG functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 939

28.3.1 RNG block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 939

28.3.2 RNG internal signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 939

28.3.3 Random number generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 939

28.3.4 RNG initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 942

28.3.5 RNG operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 943

28.3.6 RNG clocking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 945

28.3.7 Error management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 945

28.3.8 RNG low-power use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 946

28.4 RNG interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 946

28.5 RNG processing time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 947

28.6 RNG entropy source validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 947

28.6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 947

28.6.2 Validation conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 947

28.6.3 Data collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 948

28.7 RNG registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 948

28.7.1 RNG control register (RNG_CR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 948

28.7.2 RNG status register (RNG_SR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 950

28.7.3 RNG data register (RNG_DR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 951

28.7.4 RNG health test control register (RNG_HTCR) . . . . . . . . . . . . . . . . . . 952

RM0438 Rev 8

27/2187
54

Contents

RM0438

28.7.5 RNG register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 952

29

AES hardware accelerator (AES) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 953

29.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 953

29.2 AES main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 953

29.3 AES implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 953

29.4 AES functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 954

29.4.1 AES block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 954

29.4.2 AES internal signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 954

29.4.3 AES cryptographic core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 954

29.4.4 AES procedure to perform a cipher operation . . . . . . . . . . . . . . . . . . . 960

29.4.5 AES decryption round key preparation . . . . . . . . . . . . . . . . . . . . . . . . 963

29.4.6 AES ciphertext stealing and data padding . . . . . . . . . . . . . . . . . . . . . . 963

29.4.7 AES task suspend and resume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 964

29.4.8 AES basic chaining modes (ECB, CBC) . . . . . . . . . . . . . . . . . . . . . . . 964

29.4.9 AES counter (CTR) mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 969

29.4.10 AES Galois/counter mode (GCM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 971

29.4.11 AES Galois message authentication code (GMAC) . . . . . . . . . . . . . . 976

29.4.12 AES counter with CBC-MAC (CCM) . . . . . . . . . . . . . . . . . . . . . . . . . . 978

29.4.13 AES data registers and data swapping . . . . . . . . . . . . . . . . . . . . . . . . 983

29.4.14 AES key registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 985

29.4.15 AES initialization vector registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 985

29.4.16 AES DMA interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 986

29.4.17 AES error management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 987

29.5 AES interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 988

29.6 AES processing latency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 988

29.7 AES registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 989

29.7.1 AES control register (AES_CR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 989

29.7.2 AES status register (AES_SR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 991

29.7.3 AES data input register (AES_DINR) . . . . . . . . . . . . . . . . . . . . . . . . . 993

29.7.4 AES data output register (AES_DOUTR) . . . . . . . . . . . . . . . . . . . . . . 993

29.7.5 AES key register 0 (AES_KEYR0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 994

29.7.6 AES key register 1 (AES_KEYR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 994

29.7.7 AES key register 2 (AES_KEYR2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 995

29.7.8 AES key register 3 (AES_KEYR3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 995

29.7.9 AES initialization vector register 0 (AES_IVR0) . . . . . . . . . . . . . . . . . . 995

28/2187

RM0438 Rev 8

RM0438

Contents

29.7.10 AES initialization vector register 1 (AES_IVR1) . . . . . . . . . . . . . . . . . . 996 29.7.11 AES initialization vector register 2 (AES_IVR2) . . . . . . . . . . . . . . . . . . 996 29.7.12 AES initialization vector register 3 (AES_IVR3) . . . . . . . . . . . . . . . . . . 996 29.7.13 AES key register 4 (AES_KEYR4) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 997 29.7.14 AES key register 5 (AES_KEYR5) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 997 29.7.15 AES key register 6 (AES_KEYR6) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 997 29.7.16 AES key register 7 (AES_KEYR7) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 998 29.7.17 AES suspend registers (AES_SUSPxR) . . . . . . . . . . . . . . . . . . . . . . . 998 29.7.18 AES register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 999

30

Hash processor (HASH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1001

30.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1001

30.2 HASH main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1001

30.3 HASH implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1002

30.4 HASH functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1002

30.4.1 HASH block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1002

30.4.2 HASH internal signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1003

30.4.3 About secure hash algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1003

30.4.4 Message data feeding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1003

30.4.5 Message digest computing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1005

30.4.6 Message padding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1006

30.4.7 HMAC operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1008

30.4.8 HASH suspend/resume operations . . . . . . . . . . . . . . . . . . . . . . . . . . 1010

30.4.9 HASH DMA interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1012

30.4.10 HASH error management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1012

30.4.11 HASH processing time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1012

30.5 HASH interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1013

30.6 HASH registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1014

30.6.1 HASH control register (HASH_CR) . . . . . . . . . . . . . . . . . . . . . . . . . . 1014

30.6.2 HASH data input register (HASH_DIN) . . . . . . . . . . . . . . . . . . . . . . . 1016

30.6.3 HASH start register (HASH_STR) . . . . . . . . . . . . . . . . . . . . . . . . . . . 1017

30.6.4 HASH digest registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1018

30.6.5 HASH interrupt enable register (HASH_IMR) . . . . . . . . . . . . . . . . . . 1019

30.6.6 HASH status register (HASH_SR) . . . . . . . . . . . . . . . . . . . . . . . . . . . 1020

30.6.7 HASH context swap registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1020

30.6.8 HASH register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1021

RM0438 Rev 8

29/2187
54

Contents

RM0438

31

On-the-fly decryption engine (OTFDEC) . . . . . . . . . . . . . . . . . . . . . . 1023

31.1 OTFDEC introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1023

31.2 OTFDEC main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1023

31.3 OTFDEC functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1024

31.3.1 OTFDEC block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1024

31.3.2 OTFDEC internal signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1024

31.3.3 OTFDEC on-the-fly decryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1025

31.3.4 OTFDEC usage of AES in counter mode decryption . . . . . . . . . . . . . 1026

31.3.5 Flow control management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1027

31.3.6 OTFDEC error management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1027

31.4 OTFDEC interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1028

31.5 OTFDEC application information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1028

31.5.1 OTFDEC initialization process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1028

31.5.2 OTFDEC and power management . . . . . . . . . . . . . . . . . . . . . . . . . . 1030

31.5.3 Encrypting for OTFDEC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1030

31.5.4 OTFDEC key CRC source code . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1031

31.6 OTFDEC registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1032

31.6.1 OTFDEC control register (OTFDEC_CR) . . . . . . . . . . . . . . . . . . . . . 1032

31.6.2 OTFDEC privileged access control configuration register (OTFDEC_PRIVCFGR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1033

31.6.3 OTFDEC region x configuration register (OTFDEC_RxCFGR) . . . . . 1033

31.6.4 OTFDEC region x start address register (OTFDEC_RxSTARTADDR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1035

31.6.5 OTFDEC region x end address register (OTFDEC_RxENDADDR) . 1035

31.6.6 OTFDEC region x nonce register 0 (OTFDEC_RxNONCER0) . . . . . 1036

31.6.7 OTFDEC region x nonce register 1 (OTFDEC_RxNONCER1) . . . . . 1037

31.6.8 OTFDEC region x key register 0 (OTFDEC_RxKEYR0) . . . . . . . . . . 1037

31.6.9 OTFDEC region x key register 1 (OTFDEC_RxKEYR1) . . . . . . . . . . 1038

31.6.10 OTFDEC region x key register 2 (OTFDEC_RxKEYR2) . . . . . . . . . . 1038

31.6.11 OTFDEC region x key register 3 (OTFDEC_RxKEYR3) . . . . . . . . . . 1039

31.6.12 OTFDEC interrupt status register (OTFDEC_ISR) . . . . . . . . . . . . . . 1039

31.6.13 OTFDEC interrupt clear register (OTFDEC_ICR) . . . . . . . . . . . . . . . 1040

31.6.14 OTFDEC interrupt enable register (OTFDEC_IER) . . . . . . . . . . . . . . 1041

31.6.15 OTFDEC register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1042

32

Public key accelerator (PKA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1046

32.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1046

30/2187

RM0438 Rev 8

RM0438

Contents

32.2 32.3
32.4
32.5 32.6 32.7

PKA main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1046 PKA functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1046
32.3.1 PKA block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1046 32.3.2 PKA internal signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1047 32.3.3 PKA reset and clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1047 32.3.4 PKA public key acceleration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1047 32.3.5 Typical applications for PKA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1049 32.3.6 PKA procedure to perform an operation . . . . . . . . . . . . . . . . . . . . . . 1051 32.3.7 PKA error management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1052
PKA operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1052
32.4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1052 32.4.2 Montgomery parameter computation . . . . . . . . . . . . . . . . . . . . . . . . . 1053 32.4.3 Modular addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1054 32.4.4 Modular subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1054 32.4.5 Modular and Montgomery multiplication . . . . . . . . . . . . . . . . . . . . . . 1055 32.4.6 Modular exponentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1056 32.4.7 Modular inversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1056 32.4.8 Modular reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1057 32.4.9 Arithmetic addition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1057 32.4.10 Arithmetic subtraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1057 32.4.11 Arithmetic multiplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1058 32.4.12 Arithmetic comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1058 32.4.13 RSA CRT exponentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1059 32.4.14 Point on elliptic curve Fp check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1059 32.4.15 ECC Fp scalar multiplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1060 32.4.16 ECDSA sign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1061 32.4.17 ECDSA verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1063
Example of configurations and processing times . . . . . . . . . . . . . . . . . 1064
32.5.1 Supported elliptic curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1064 32.5.2 Computation times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1066
PKA interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1067 PKA registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1068
32.7.1 PKA control register (PKA_CR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1068 32.7.2 PKA status register (PKA_SR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1069 32.7.3 PKA clear flag register (PKA_CLRFR) . . . . . . . . . . . . . . . . . . . . . . . . 1070 32.7.4 PKA RAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1070

RM0438 Rev 8

31/2187
54

Contents

RM0438

32.7.5 PKA register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1071

33

Advanced-control timers (TIM1/TIM8) . . . . . . . . . . . . . . . . . . . . . . . . 1072

33.1 TIM1/TIM8 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1072

33.2 TIM1/TIM8 main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1072

33.3 TIM1/TIM8 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1074

33.3.1 Time-base unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1074

33.3.2 Counter modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1076

33.3.3 Repetition counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1087

33.3.4 External trigger input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1089

33.3.5 Clock selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1090

33.3.6 Capture/compare channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1094

33.3.7 Input capture mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1096

33.3.8 PWM input mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1097

33.3.9 Forced output mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1098

33.3.10 Output compare mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1099

33.3.11 PWM mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1100

33.3.12 Asymmetric PWM mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1103

33.3.13 Combined PWM mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1104

33.3.14 Combined 3-phase PWM mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1105

33.3.15 Complementary outputs and dead-time insertion . . . . . . . . . . . . . . . 1106

33.3.16 Using the break function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1108

33.3.17 Bidirectional break inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1114

33.3.18 Clearing the OCxREF signal on an external event . . . . . . . . . . . . . . 1115

33.3.19 6-step PWM generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1117

33.3.20 One-pulse mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1118

33.3.21 Retriggerable one pulse mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1119

33.3.22 Encoder interface mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1120

33.3.23 UIF bit remapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1122

33.3.24 Timer input XOR function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1123

33.3.25 Interfacing with Hall sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1123

33.3.26 Timer synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1126

33.3.27 ADC synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1130

33.3.28 DMA burst mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1130

33.3.29 Debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1131

33.4 TIM1/TIM8 registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1132

33.4.1 TIMx control register 1 (TIMx_CR1)(x = 1, 8) . . . . . . . . . . . . . . . . . . 1132

32/2187

RM0438 Rev 8

RM0438

Contents
33.4.2 TIMx control register 2 (TIMx_CR2)(x = 1, 8) . . . . . . . . . . . . . . . . . . 1133
33.4.3 TIMx slave mode control register (TIMx_SMCR)(x = 1, 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1136
33.4.4 TIMx DMA/interrupt enable register (TIMx_DIER)(x = 1, 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1138
33.4.5 TIMx status register (TIMx_SR)(x = 1, 8) . . . . . . . . . . . . . . . . . . . . . . 1140
33.4.6 TIMx event generation register (TIMx_EGR)(x = 1, 8) . . . . . . . . . . . . 1142
33.4.7 TIMx capture/compare mode register 1 (TIMx_CCMR1)(x = 1, 8) . . 1143
33.4.8 TIMx capture/compare mode register 1 [alternate] (TIMx_CCMR1)(x = 1, 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1144
33.4.9 TIMx capture/compare mode register 2 (TIMx_CCMR2)(x = 1, 8) . . 1147
33.4.10 TIMx capture/compare mode register 2 [alternate] (TIMx_CCMR2)(x = 1, 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1148
33.4.11 TIMx capture/compare enable register (TIMx_CCER)(x = 1, 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1149
33.4.12 TIMx counter (TIMx_CNT)(x = 1, 8) . . . . . . . . . . . . . . . . . . . . . . . . . . 1153
33.4.13 TIMx prescaler (TIMx_PSC)(x = 1, 8) . . . . . . . . . . . . . . . . . . . . . . . . 1153
33.4.14 TIMx auto-reload register (TIMx_ARR)(x = 1, 8) . . . . . . . . . . . . . . . . 1153
33.4.15 TIMx repetition counter register (TIMx_RCR)(x = 1, 8) . . . . . . . . . . . 1154
33.4.16 TIMx capture/compare register 1 (TIMx_CCR1)(x = 1, 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1154
33.4.17 TIMx capture/compare register 2 (TIMx_CCR2)(x = 1, 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1155
33.4.18 TIMx capture/compare register 3 (TIMx_CCR3)(x = 1, 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1155
33.4.19 TIMx capture/compare register 4 (TIMx_CCR4)(x = 1, 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1156
33.4.20 TIMx break and dead-time register (TIMx_BDTR)(x = 1, 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1156
33.4.21 TIMx DMA control register (TIMx_DCR)(x = 1, 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1160
33.4.22 TIMx DMA address for full transfer (TIMx_DMAR)(x = 1, 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1161
33.4.23 TIM1 option register 1 (TIM1_OR1) . . . . . . . . . . . . . . . . . . . . . . . . . . 1162
33.4.24 TIM8 option register 1 (TIM8_OR1) . . . . . . . . . . . . . . . . . . . . . . . . . . 1162
33.4.25 TIMx capture/compare mode register 3 (TIMx_CCMR3)(x = 1, 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1163
33.4.26 TIMx capture/compare register 5 (TIMx_CCR5)(x = 1, 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1164
33.4.27 TIMx capture/compare register 6 (TIMx_CCR6)(x = 1, 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1165

RM0438 Rev 8

33/2187
54

Contents

RM0438

33.4.28 TIM1 option register 2 (TIM1_OR2) . . . . . . . . . . . . . . . . . . . . . . . . . . 1165 33.4.29 TIM1 option register 3 (TIM1_OR3) . . . . . . . . . . . . . . . . . . . . . . . . . . 1167 33.4.30 TIM8 option register 2 (TIM8_OR2) . . . . . . . . . . . . . . . . . . . . . . . . . . 1168 33.4.31 TIM8 option register 3 (TIM8_OR3) . . . . . . . . . . . . . . . . . . . . . . . . . . 1170 33.4.32 TIM1 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1172 33.4.33 TIM8 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1174

34

General-purpose timers (TIM2/TIM3/TIM4/TIM5) . . . . . . . . . . . . . . . . 1177

34.1 TIM2/TIM3/TIM4/TIM5 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . .1177

34.2 TIM2/TIM3/TIM4/TIM5 main features . . . . . . . . . . . . . . . . . . . . . . . . . . .1177

34.3 TIM2/TIM3/TIM4/TIM5 functional description . . . . . . . . . . . . . . . . . . . . .1179

34.3.1 Time-base unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1179

34.3.2 Counter modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1181

34.3.3 Clock selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1191

34.3.4 Capture/Compare channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1195

34.3.5 Input capture mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1197

34.3.6 PWM input mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1198

34.3.7 Forced output mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1199

34.3.8 Output compare mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1200

34.3.9 PWM mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1201

34.3.10 Asymmetric PWM mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1204

34.3.11 Combined PWM mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1205

34.3.12 Clearing the OCxREF signal on an external event . . . . . . . . . . . . . . 1206

34.3.13 One-pulse mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1208

34.3.14 Retriggerable one pulse mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1209

34.3.15 Encoder interface mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1210

34.3.16 UIF bit remapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1212

34.3.17 Timer input XOR function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1212

34.3.18 Timers and external trigger synchronization . . . . . . . . . . . . . . . . . . . 1213

34.3.19 Timer synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1216

34.3.20 DMA burst mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1221

34.3.21 Debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1222

34.4 TIM2/TIM3/TIM4/TIM5 registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1223

34.4.1 TIMx control register 1 (TIMx_CR1)(x = 2 to 5) . . . . . . . . . . . . . . . . . 1223

34.4.2 TIMx control register 2 (TIMx_CR2)(x = 2 to 5) . . . . . . . . . . . . . . . . . 1224

34.4.3 TIMx slave mode control register (TIMx_SMCR)(x = 2 to 5) . . . . . . . 1226

34.4.4 TIMx DMA/Interrupt enable register (TIMx_DIER)(x = 2 to 5) . . . . . . 1229

34/2187

RM0438 Rev 8

RM0438

Contents

34.4.5 TIMx status register (TIMx_SR)(x = 2 to 5) . . . . . . . . . . . . . . . . . . . . 1230 34.4.6 TIMx event generation register (TIMx_EGR)(x = 2 to 5) . . . . . . . . . . 1231 34.4.7 TIMx capture/compare mode register 1 (TIMx_CCMR1)(x = 2 to 5) . 1232 34.4.8 TIMx capture/compare mode register 1 [alternate] (TIMx_CCMR1)
(x = 2 to 5) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1234 34.4.9 TIMx capture/compare mode register 2 (TIMx_CCMR2)(x = 2 to 5) . 1236 34.4.10 TIMx capture/compare mode register 2 [alternate] (TIMx_CCMR2)
(x = 2 to 5) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1237 34.4.11 TIMx capture/compare enable register
(TIMx_CCER)(x = 2 to 5) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1238 34.4.12 TIMx counter (TIMx_CNT)(x = 2 to 5) . . . . . . . . . . . . . . . . . . . . . . . . 1239 34.4.13 TIMx counter [alternate] (TIMx_CNT)(x = 2 to 5) . . . . . . . . . . . . . . . . 1240 34.4.14 TIMx prescaler (TIMx_PSC)(x = 2 to 5) . . . . . . . . . . . . . . . . . . . . . . . 1240 34.4.15 TIMx auto-reload register (TIMx_ARR)(x = 2 to 5) . . . . . . . . . . . . . . 1241 34.4.16 TIMx capture/compare register 1 (TIMx_CCR1)(x = 2 to 5) . . . . . . . 1241 34.4.17 TIMx capture/compare register 2 (TIMx_CCR2)(x = 2 to 5) . . . . . . . 1241 34.4.18 TIMx capture/compare register 3 (TIMx_CCR3)(x = 2 to 5) . . . . . . . 1242 34.4.19 TIMx capture/compare register 4 (TIMx_CCR4)(x = 2 to 5) . . . . . . . 1242 34.4.20 TIMx DMA control register (TIMx_DCR)(x = 2 to 5) . . . . . . . . . . . . . . 1243 34.4.21 TIMx DMA address for full transfer (TIMx_DMAR)(x = 2 to 5) . . . . . . 1244 34.4.22 TIM2 option register 1 (TIM2_OR1) . . . . . . . . . . . . . . . . . . . . . . . . . . 1244 34.4.23 TIM3 option register 1 (TIM3_OR1) . . . . . . . . . . . . . . . . . . . . . . . . . . 1244 34.4.24 TIM2 option register 2 (TIM2_OR2) . . . . . . . . . . . . . . . . . . . . . . . . . . 1245 34.4.25 TIM3 option register 2 (TIM3_OR2) . . . . . . . . . . . . . . . . . . . . . . . . . . 1245 34.4.26 TIMx register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1247

35

General-purpose timers (TIM15/TIM16/TIM17) . . . . . . . . . . . . . . . . . 1250

35.1 TIM15/TIM16/TIM17 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1250

35.2 TIM15 main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1250

35.3 TIM16/TIM17 main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1251

35.4 TIM15/TIM16/TIM17 functional description . . . . . . . . . . . . . . . . . . . . . 1254

35.4.1 Time-base unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1254

35.4.2 Counter modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1256

35.4.3 Repetition counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1260

35.4.4 35.4.5 35.4.6 35.4.7

Clock selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1261 Capture/compare channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1263 Input capture mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1265 PWM input mode (only for TIM15) . . . . . . . . . . . . . . . . . . . . . . . . . . . 1266

RM0438 Rev 8

35/2187
54

Contents

RM0438

35.5

35.4.8 Forced output mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1267 35.4.9 Output compare mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1268 35.4.10 PWM mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1269 35.4.11 Combined PWM mode (TIM15 only) . . . . . . . . . . . . . . . . . . . . . . . . . 1270 35.4.12 Complementary outputs and dead-time insertion . . . . . . . . . . . . . . . 1271 35.4.13 Using the break function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1273 35.4.14 Bidirectional break inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1278 35.4.15 6-step PWM generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1279 35.4.16 One-pulse mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1281 35.4.17 Retriggerable one pulse mode (TIM15 only) . . . . . . . . . . . . . . . . . . . 1282 35.4.18 UIF bit remapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1283 35.4.19 Timer input XOR function (TIM15 only) . . . . . . . . . . . . . . . . . . . . . . . 1284 35.4.20 External trigger synchronization (TIM15 only) . . . . . . . . . . . . . . . . . . 1285 35.4.21 Slave mode ­ combined reset + trigger mode . . . . . . . . . . . . . . . . . . 1287 35.4.22 DMA burst mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1287 35.4.23 Timer synchronization (TIM15) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1289 35.4.24 Using timer output as trigger for other timers (TIM16/TIM17) . . . . . . 1289 35.4.25 Debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1289
TIM15 registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1290
35.5.1 TIM15 control register 1 (TIM15_CR1) . . . . . . . . . . . . . . . . . . . . . . . 1290 35.5.2 TIM15 control register 2 (TIM15_CR2) . . . . . . . . . . . . . . . . . . . . . . . 1291 35.5.3 TIM15 slave mode control register (TIM15_SMCR) . . . . . . . . . . . . . 1293 35.5.4 TIM15 DMA/interrupt enable register (TIM15_DIER) . . . . . . . . . . . . 1294 35.5.5 TIM15 status register (TIM15_SR) . . . . . . . . . . . . . . . . . . . . . . . . . . 1295 35.5.6 TIM15 event generation register (TIM15_EGR) . . . . . . . . . . . . . . . . 1297 35.5.7 TIM15 capture/compare mode register 1 (TIM15_CCMR1) . . . . . . . 1298 35.5.8 TIM15 capture/compare mode register 1 [alternate] (TIM15_CCMR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1299 35.5.9 TIM15 capture/compare enable register (TIM15_CCER) . . . . . . . . . 1302 35.5.10 TIM15 counter (TIM15_CNT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1305 35.5.11 TIM15 prescaler (TIM15_PSC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1305 35.5.12 TIM15 auto-reload register (TIM15_ARR) . . . . . . . . . . . . . . . . . . . . . 1305 35.5.13 TIM15 repetition counter register (TIM15_RCR) . . . . . . . . . . . . . . . . 1306 35.5.14 TIM15 capture/compare register 1 (TIM15_CCR1) . . . . . . . . . . . . . . 1306 35.5.15 TIM15 capture/compare register 2 (TIM15_CCR2) . . . . . . . . . . . . . . 1307 35.5.16 TIM15 break and dead-time register (TIM15_BDTR) . . . . . . . . . . . . 1307 35.5.17 TIM15 DMA control register (TIM15_DCR) . . . . . . . . . . . . . . . . . . . . 1310

36/2187

RM0438 Rev 8

RM0438

Contents

35.6

35.5.18 TIM15 DMA address for full transfer (TIM15_DMAR) . . . . . . . . . . . . 1310 35.5.19 TIM15 option register 1 (TIM15_OR1) . . . . . . . . . . . . . . . . . . . . . . . . 1311 35.5.20 TIM15 option register 2 (TIM15_OR2) . . . . . . . . . . . . . . . . . . . . . . . . 1311 35.5.21 TIM15 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1313
TIM16/TIM17 registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1316
35.6.1 TIMx control register 1 (TIMx_CR1)(x = 16 to 17) . . . . . . . . . . . . . . . 1316 35.6.2 TIMx control register 2 (TIMx_CR2)(x = 16 to 17) . . . . . . . . . . . . . . . 1317 35.6.3 TIMx DMA/interrupt enable register (TIMx_DIER)(x = 16 to 17) . . . . 1318 35.6.4 TIMx status register (TIMx_SR)(x = 16 to 17) . . . . . . . . . . . . . . . . . . 1319 35.6.5 TIMx event generation register (TIMx_EGR)(x = 16 to 17) . . . . . . . . 1320 35.6.6 TIMx capture/compare mode register 1
(TIMx_CCMR1)(x = 16 to 17) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1321 35.6.7 TIMx capture/compare mode register 1 [alternate] (TIMx_CCMR1)(x = 16 to 17) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1322 35.6.8 TIMx capture/compare enable register (TIMx_CCER)(x = 16 to 17) . 1324 35.6.9 TIMx counter (TIMx_CNT)(x = 16 to 17) . . . . . . . . . . . . . . . . . . . . . . 1326 35.6.10 TIMx prescaler (TIMx_PSC)(x = 16 to 17) . . . . . . . . . . . . . . . . . . . . . 1327 35.6.11 TIMx auto-reload register (TIMx_ARR)(x = 16 to 17) . . . . . . . . . . . . 1327 35.6.12 TIMx repetition counter register (TIMx_RCR)(x = 16 to 17) . . . . . . . . 1328 35.6.13 TIMx capture/compare register 1 (TIMx_CCR1)(x = 16 to 17) . . . . . 1328 35.6.14 TIMx break and dead-time register (TIMx_BDTR)(x = 16 to 17) . . . . 1329 35.6.15 TIMx DMA control register (TIMx_DCR)(x = 16 to 17) . . . . . . . . . . . . 1331 35.6.16 TIMx DMA address for full transfer (TIMx_DMAR)(x = 16 to 17) . . . . 1332 35.6.17 TIM16 option register 1 (TIM16_OR1) . . . . . . . . . . . . . . . . . . . . . . . . 1332 35.6.18 TIM16 option register 2 (TIM16_OR2) . . . . . . . . . . . . . . . . . . . . . . . . 1333 35.6.19 TIM17 option register 1 (TIM17_OR1) . . . . . . . . . . . . . . . . . . . . . . . . 1334 35.6.20 TIM17 option register 2 (TIM17_OR2) . . . . . . . . . . . . . . . . . . . . . . . . 1335 35.6.21 TIM16/TIM17 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1337

36

Basic timers (TIM6/TIM7) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1339

36.1 TIM6/TIM7 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1339

36.2 TIM6/TIM7 main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1339

36.3 TIM6/TIM7 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1340

36.3.1 Time-base unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1340

36.3.2 Counting mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1342

36.3.3 UIF bit remapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1345

36.3.4 Clock source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1345

RM0438 Rev 8

37/2187
54

Contents

RM0438

36.4

36.3.5 Debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1346
TIM6/TIM7 registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1346
36.4.1 TIMx control register 1 (TIMx_CR1)(x = 6 to 7) . . . . . . . . . . . . . . . . . 1346 36.4.2 TIMx control register 2 (TIMx_CR2)(x = 6 to 7) . . . . . . . . . . . . . . . . . 1348 36.4.3 TIMx DMA/Interrupt enable register (TIMx_DIER)(x = 6 to 7) . . . . . . 1348 36.4.4 TIMx status register (TIMx_SR)(x = 6 to 7) . . . . . . . . . . . . . . . . . . . . 1349 36.4.5 TIMx event generation register (TIMx_EGR)(x = 6 to 7) . . . . . . . . . . 1349 36.4.6 TIMx counter (TIMx_CNT)(x = 6 to 7) . . . . . . . . . . . . . . . . . . . . . . . . 1349 36.4.7 TIMx prescaler (TIMx_PSC)(x = 6 to 7) . . . . . . . . . . . . . . . . . . . . . . . 1350 36.4.8 TIMx auto-reload register (TIMx_ARR)(x = 6 to 7) . . . . . . . . . . . . . . 1350 36.4.9 TIMx register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1351

37

Low-power timer (LPTIM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1352

37.1 LPTIM introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1352

37.2 LPTIM main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1352

37.3 LPTIM implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1352

37.4 LPTIM functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1353

37.4.1 LPTIM block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1353

37.4.2 LPTIM pins and internal signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1353

37.4.3 LPTIM input and trigger mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . 1354

37.4.4 LPTIM reset and clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1355

37.4.5 Glitch filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1355

37.4.6 Prescaler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1356

37.4.7 Trigger multiplexer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1356

37.4.8 Operating mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1357

37.4.9 Timeout function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1359

37.4.10 Waveform generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1359

37.4.11 Register update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1360

37.4.12 Counter mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1361

37.4.13 Timer enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1362

37.4.14 Timer counter reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1362

37.4.15 Encoder mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1363

37.4.16 Repetition counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1364

37.4.17 Debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1365

37.5 LPTIM low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1366

37.6 LPTIM interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1366

38/2187

RM0438 Rev 8

RM0438

Contents

37.7

LPTIM registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1367
37.7.1 LPTIM interrupt and status register (LPTIM_ISR) . . . . . . . . . . . . . . . 1367 37.7.2 LPTIM interrupt clear register (LPTIM_ICR) . . . . . . . . . . . . . . . . . . . 1368 37.7.3 LPTIM interrupt enable register (LPTIM_IER) . . . . . . . . . . . . . . . . . . 1369 37.7.4 LPTIM configuration register (LPTIM_CFGR) . . . . . . . . . . . . . . . . . . 1370 37.7.5 LPTIM control register (LPTIM_CR) . . . . . . . . . . . . . . . . . . . . . . . . . 1373 37.7.6 LPTIM compare r

Documents / Resources

ST STM32L5 Series Highly Secure With Low Power Consumption [pdf] User Guide
RM0438, STM32L5 Series Highly Secure With Low Power Consumption, STM32L5 Series, Highly Secure With Low Power Consumption, Low Power Consumption, Consumption

References

Leave a comment

Your email address will not be published. Required fields are marked *