RM0522-STM32C5

This document is addressed to application developers. It provides complete information on how to use the STM32C5 microcontrollers memory and peripherals.

For ordering information, mechanical, and electrical device characteristics, refer to the corresponding datasheets.

For information on the Arm® Cortex®-M33 core, refer to the corresponding Arm® Technical Reference Manual available on http://infocenter.arm.com.

The STM32C5 microcontrollers include ST state-of-the-art patented technology.

Contents

1Documentation conventions85
1.1General information85
1.2List of abbreviations for registers85
1.3Register reset value86
1.4Glossary86
2Memory and bus architecture87
2.1System architecture87
2.1.1Fast C-bus88
2.1.2Slow C-bus89
2.1.3S-bus89
2.1.4LPDMA1 and LPDMA2 buses89
2.1.5Bus matrix89
2.1.6AHB/APB bridges89
2.2Memory organization90
2.2.1Introduction90
2.2.2Memory map and register boundary addresses91
2.2.3Embedded SRAM98
2.2.4Flash memory overview98
3System security99
3.1Key security features99
3.2Resource isolation100
3.2.1Temporal isolation using secure hide protection (HDP)100
3.2.2Resource isolation using Cortex privileged mode100
3.3Secure execution101
3.3.1Memory protection unit (MPU)101
3.3.2Embedded flash memory write protection101
3.3.3Tamper detection and response101
3.4Secure storage103
3.4.1Hardware secret key management104
3.5Unique ID105
3.6Crypto engines105
3.6.1Cryptographic engines features .....105
3.6.2Secure AES co-processor (SAES) .....106
3.7Product life cycle .....107
3.7.1Life cycle management with readout protection (RDP) .....108
3.8Summary of protection mechanism .....110
4Boot modes .....112
4.1STM32C5 boot modes .....112
5RAMs configuration controller (RAMCFG) .....114
5.1RAMCFG introduction .....114
5.2RAMCFG main features .....114
5.3RAMCFG functional description .....114
5.3.1Internal SRAMs features .....114
5.3.2Error code correction (SRAM2) .....115
5.3.3Write protection (SRAM2) .....116
5.3.4Software erase .....116
5.4RAMCFG low-power modes .....117
5.5RAMCFG interrupts .....117
5.6RAMCFG registers .....118
5.6.1RAMCFG memory x control register (RAMCFG_MxCR) .....118
5.6.2RAMCFG memory x interrupt status register (RAMCFG_MxISR) ....119
5.6.3RAMCFG memory x erase key register (RAMCFG_MxERKEYR) ....119
5.6.4RAMCFG memory 2 interrupt enable register (RAMCFG_M2IER) ....120
5.6.5RAMCFG memory 2 ECC single error address register
(RAMCFG_M2SEAR) .....
120
5.6.6RAMCFG memory 2 ECC double error address register
(RAMCFG_M2DEAR) .....
121
5.6.7RAMCFG memory 2 interrupt clear register (RAMCFG_M2ICR) ....121
5.6.8RAMCFG memory 2 write protection register 1
(RAMCFG_M2WPR1) .....
122
5.6.9RAMCFG memory 2 write protection register 2
(RAMCFG_M2WPR2) .....
122
5.6.10RAMCFG memory 2 ECC key register
(RAMCFG_M2ECCKEYR) .....
122
5.6.11RAMCFG memory 2 write protection register 3
(RAMCFG_M2WPR3) .....
123
5.6.12RAMCFG memory 2 write protection register 4
(RAMCFG_M2WPR4) .....
123
5.6.13RAMCFG register map .....124
6Embedded flash memory (FLASH) .....126
6.1FLASH introduction .....126
6.2FLASH main features .....126
6.3FLASH functional description .....127
6.3.1FLASH block diagram .....127
6.3.2FLASH signals .....127
6.3.3Flash memory architecture and usage .....129
6.3.4FLASH read operations .....131
6.3.5FLASH program operations .....133
6.3.6FLASH erase operations .....136
6.3.7FLASH parallel operations .....138
6.3.8Flash memory error protections .....138
6.3.9OTP and RO memory access .....138
6.3.10FLASH data area .....141
6.3.11FLASH bank swapping .....142
6.3.12FLASH reset and clocks .....147
6.4FLASH option bytes .....149
6.4.1About option bytes .....149
6.4.2Option-byte loading .....149
6.4.3Option-byte modification .....150
6.4.4Option-byte overview .....151
6.4.5Description of user and system option bytes .....152
6.4.6Description of data protection option bytes .....153
6.4.7Description of data FLASH option bytes .....153
6.4.8Description of boot-address option byte .....154
6.4.9Specific rules for modifying option bytes .....154
6.5FLASH security and protections .....155
6.5.1Hide protection (HDP) .....155
6.5.2Flash memory register privileged and unprivileged modes .....157
6.5.3Flash memory banks attributes in case of bank swap .....157
6.5.4Flash memory configuration protection .....158
6.5.5Write protection .....159
6.5.6FLASH data area protections .....159
6.5.7RDP protection and life cycle management . . . . .159
6.5.8RDP level transitions . . . . .160
6.5.9OEM key management . . . . .161
6.5.10BS key management . . . . .162
6.5.11One-time-programmable and read-only memory protections . . . . .163
6.6System memory . . . . .163
6.6.1System memory introduction . . . . .163
6.6.2Bootloader user functions . . . . .163
6.7FLASH low-power modes . . . . .165
6.8FLASH error management . . . . .166
6.8.1Write protection error (WRPERR) . . . . .166
6.8.2Programming sequence error (PGSERR) . . . . .167
6.8.3Strobe error (STRBERR) . . . . .168
6.8.4Inconsistency error (INCERR) . . . . .168
6.8.5Error correction code error (ECCC/ECCD) . . . . .169
6.8.6Option-byte change error (OPTCHANGEERR) . . . . .171
6.8.7Miscellaneous HardFault errors . . . . .172
6.9FLASH interrupts . . . . .172
6.10FLASH registers . . . . .173
6.10.1FLASH access control register (FLASH_ACR) . . . . .174
6.10.2FLASH key register (FLASH_KEYR) . . . . .175
6.10.3FLASH option key register (FLASH_OPTKEYR) . . . . .175
6.10.4FLASH operation status register (FLASH_OPSR) . . . . .176
6.10.5FLASH option control register (FLASH_OPTCR) . . . . .177
6.10.6FLASH status register (FLASH_SR) . . . . .178
6.10.7FLASH control register (FLASH_CR) . . . . .180
6.10.8FLASH clear control register (FLASH_CCR) . . . . .183
6.10.9FLASH privilege configuration register (FLASH_PRIVCFGR) . . . . .183
6.10.10FLASH HDP extension register (FLASH_HDPEXTR) . . . . .184
6.10.11FLASH option status register (FLASH_OPTSR_CUR) . . . . .185
6.10.12FLASH option status register (FLASH_OPTSR_PRG) . . . . .186
6.10.13FLASH option status register 2 (FLASH_OPTSR2_CUR) . . . . .188
6.10.14FLASH option status register 2 (FLASH_OPTSR2_PRG) . . . . .189
6.10.15FLASH unique boot entry register (FLASH_BOOTR_CUR) . . . . .190
6.10.16FLASH unique boot entry address (FLASH_BOOTR_PRG) . . . . .190
6.10.17FLASH OTP block lock (FLASH_OTPBLR_CUR) . . . . .191
6.10.18FLASH OTP block lock (FLASH_OTPBLR_PRG) . . . . .192
6.10.19FLASH bootloader interface selection
(FLASH_BL_COM_CFG_CUR) . . . . .
192
6.10.20FLASH bootloader interface selection
(FLASH_BL_COM_CFG_PRG) . . . . .
193
6.10.21FLASH OEM key register 1 (FLASH_OEMKEYR1_PRG) . . . . .193
6.10.22FLASH OEM key register 2 (FLASH_OEMKEYR2_PRG) . . . . .194
6.10.23FLASH OEM key register 3 (FLASH_OEMKEYR3_PRG) . . . . .194
6.10.24FLASH OEM key register 4 (FLASH_OEMKEYR4_PRG) . . . . .194
6.10.25FLASH boundary scan key register (FLASH_BSKEYR_PRG) . . . . .195
6.10.26FLASH write page protection for bank1 (FLASH_WRP1R_CUR) . . . .195
6.10.27FLASH write-page protection for bank1 (FLASH_WRP1R_PRG) . . . .196
6.10.28FLASH HDP bank1 register (FLASH_HDP1R_CUR) . . . . .196
6.10.29FLASH HDP bank1 register (FLASH_HDP1R_PRG) . . . . .197
6.10.30FLASH ECC correction register (FLASH_ECCCORR) . . . . .197
6.10.31FLASH ECC detection register (FLASH_ECCDETR) . . . . .198
6.10.32FLASH ECC data (FLASH_ECCDR) . . . . .199
6.10.33FLASH write page protection for bank2 (FLASH_WRP2R_CUR) . . . .200
6.10.34FLASH write page protection for bank2 (FLASH_WRP2R_PRG) . . . .200
6.10.35FLASH HDP bank2 register (FLASH_HDP2R_CUR) . . . . .201
6.10.36FLASH HDP bank2 register (FLASH_HDP2R_PRG) . . . . .201
6.10.37FLASH register map . . . . .202
7Instruction cache (ICACHE) . . . . .207
7.1ICACHE introduction . . . . .207
7.2ICACHE main features . . . . .207
7.3ICACHE implementation . . . . .208
7.4ICACHE functional description . . . . .208
7.4.1ICACHE block diagram . . . . .209
7.4.2ICACHE reset and clocks . . . . .209
7.4.3ICACHE TAG memory . . . . .210
7.4.4Direct-mapped ICACHE (1-way cache) . . . . .211
7.4.5ICACHE enable . . . . .212
7.4.6Cacheable and noncacheable traffic . . . . .212
7.4.7Address remapping . . . . .213
7.4.8Cacheable accesses . . . . .215
7.4.9Dual-master cache . . . . .216
7.4.10ICACHE maintenance .....216
7.4.11ICACHE performance monitoring .....217
7.4.12ICACHE boot .....217
7.5ICACHE low-power modes .....217
7.6ICACHE error management and interrupts .....218
7.7ICACHE registers .....218
7.7.1ICACHE control register (ICACHE_CR) .....218
7.7.2ICACHE status register (ICACHE_SR) .....219
7.7.3ICACHE interrupt enable register (ICACHE_IER) .....220
7.7.4ICACHE flag clear register (ICACHE_FCR) .....220
7.7.5ICACHE hit monitor register (ICACHE_HMONR) .....221
7.7.6ICACHE miss monitor register (ICACHE_MMONR) .....221
7.7.7ICACHE region x configuration register (ICACHE_CRRx) .....221
7.7.8ICACHE register map .....222
8Power control (PWR) .....224
8.1PWR introduction .....224
8.2PWR main features .....224
8.3PWR pins and internal signals .....224
8.4PWR power supplies and supply domains .....225
8.4.1External power supplies .....225
8.4.2Internal regulator .....226
8.4.3Independent analog peripherals supply .....226
8.4.4RTC domain .....226
8.5PWR system supply voltage regulation .....227
8.5.1Embedded voltage regulator operating modes .....227
8.6PWR power supply and temperature supervision .....227
8.6.1Power-on reset (POR)/power-down reset (PDR) .....227
8.6.2Programmable voltage detector (PVD) .....228
8.7Power modes .....229
8.7.1Slowing down system clocks .....233
8.7.2Peripheral clock gating .....233
8.7.3Low-power modes .....233
8.7.4Sleep mode .....234
8.7.5Stop 0 mode .....235
8.7.6Stop 1 mode .....237
8.7.7Standby mode .....239
8.7.8Power mode output pins .....242
8.8PWR privileged protection .....242
8.9PWR interrupts .....243
8.10PWR registers .....243
8.10.1PWR power mode control register (PWR_PMCR) .....243
8.10.2PWR status register (PWR_PMSR) .....244
8.10.3PWR RTC domain control register (PWR_RTCCR) .....245
8.10.4PWR voltage monitor control register (PWR_VMCR) .....245
8.10.5PWR voltage monitor status register (PWR_VMSR) .....246
8.10.6PWR wake-up status clear register (PWR_WUSCR) .....246
8.10.7PWR wake-up status register (PWR_WUSR) .....247
8.10.8PWR wake-up configuration register (PWR_WUCR) .....247
8.10.9PWR I/O retention register (PWR_IORETR) .....248
8.10.10PWR privilege configuration register (PWR_PRIVCFGR) .....249
8.10.11PWR register map .....249
9Reset and clock control (RCC) .....251
9.1RCC introduction .....251
9.2RCC pins and internal signals .....251
9.3RCC reset functional description .....251
9.3.1Power reset .....251
9.3.2System reset .....252
9.3.3RTC domain reset .....253
9.3.4Reset source identification .....253
9.4RCC clocks functional description .....254
9.4.1HSE clock .....256
9.4.2HSI oscillator and HSIS clock .....257
9.4.3PSI oscillator and PSIS clock .....258
9.4.4HSIDIV3 and PSIDIV3 clock .....260
9.4.5HSIK and PSIK clock .....260
9.4.6LSE clock .....261
9.4.7LSI clock .....262
9.4.8System clock (SYSCLK) selection .....262
9.4.9Handling clock generators in Stop and Standby modes .....262
9.4.10Clock security system (CSS) .....263
9.4.11Clock output generation (MCO1/MCO2/LSCO) . . . . .264
9.4.12Kernel clock selection . . . . .265
9.4.13RTC and TAMP clock . . . . .271
9.4.14Timer clock . . . . .271
9.4.15Peripherals clock gating . . . . .271
9.5RCC privilege functional description . . . . .272
9.6RCC low-power modes . . . . .272
9.7RCC interrupts . . . . .273
9.8RCC registers . . . . .274
9.8.1RCC clock control register (RCC_CR1) . . . . .274
9.8.2RCC clock control register (RCC_CR2) . . . . .277
9.8.3RCC clock configuration register1 (RCC_CFGR1) . . . . .279
9.8.4RCC CPU domain clock configuration register 2 (RCC_CFGR2) . . . . .281
9.8.5RCC clock source interrupt enable register (RCC_CIER) . . . . .283
9.8.6RCC clock source interrupt flag register (RCC_CIFR) . . . . .285
9.8.7RCC clock source interrupt clear register (RCC_CICR) . . . . .286
9.8.8RCC AHB1 reset register (RCC_AHB1RSTR) . . . . .288
9.8.9RCC AHB2 peripheral reset register (RCC_AHB2RSTR) . . . . .289
9.8.10RCC AHB4 peripheral reset register (RCC_AHB4RSTR) . . . . .291
9.8.11RCC APB1 peripheral low reset register (RCC_APB1LRSTR) . . . . .291
9.8.12RCC APB1 peripheral high reset register (RCC_APB1HRSTR) . . . . .293
9.8.13RCC APB2 peripheral reset register (RCC_APB2RSTR) . . . . .294
9.8.14RCC APB3 peripheral reset register (RCC_APB3RSTR) . . . . .295
9.8.15RCC AHB1 peripheral clock register (RCC_AHB1ENR) . . . . .296
9.8.16RCC AHB2 peripheral clock register (RCC_AHB2ENR) . . . . .297
9.8.17RCC AHB4 peripheral clock register (RCC_AHB4ENR) . . . . .299
9.8.18RCC APB1 peripheral clock register (RCC_APB1LENR) . . . . .300
9.8.19RCC APB1 peripheral clock register (RCC_APB1HENR) . . . . .302
9.8.20RCC APB2 peripheral clock register (RCC_APB2ENR) . . . . .303
9.8.21RCC APB3 peripheral clock register (RCC_APB3ENR) . . . . .304
9.8.22RCC AHB1 sleep clock register (RCC_AHB1LPENR) . . . . .305
9.8.23RCC AHB2 sleep clock register (RCC_AHB2LPENR) . . . . .306
9.8.24RCC AHB4 peripheral sleep clock register (RCC_AHB4LPENR) . . . . .308
9.8.25RCC APB1 sleep clock register (RCC_APB1LLPENR) . . . . .309
9.8.26RCC APB1 sleep clock register (RCC_APB1HLPENR) . . . . .311
9.8.27RCC APB2 sleep clock register (RCC_APB2LPENR) . . . . .312
9.8.28RCC APB3 sleep clock register (RCC_APB3LPENR) . . . . .313
9.8.29RCC kernel clock configuration register (RCC_CCIPR1) . . . . .314
9.8.30RCC kernel clock configuration register (RCC_CCIPR2) . . . . .315
9.8.31RCC kernel clock configuration register (RCC_CCIPR3) . . . . .317
9.8.32RCC RTC domain control register (RCC_RTCCR) . . . . .318
9.8.33RCC reset status register (RCC_RSR) . . . . .320
9.8.34RCC privilege configuration register (RCC_PRIVCFGR) . . . . .322
9.8.35RCC register map . . . . .322
10Clock recovery system (CRS) . . . . .327
10.1CRS introduction . . . . .327
10.2CRS main features . . . . .327
10.3CRS implementation . . . . .327
10.4CRS functional description . . . . .328
10.4.1CRS block diagram . . . . .328
10.4.2CRS internal signals . . . . .328
10.4.3Synchronization input . . . . .329
10.4.4Frequency error measurement . . . . .329
10.4.5Frequency error evaluation and automatic trimming . . . . .330
10.4.6CRS initialization and configuration . . . . .331
10.5CRS in low-power modes . . . . .332
10.6CRS interrupts . . . . .332
10.7CRS registers . . . . .332
10.7.1CRS control register (CRS_CR) . . . . .332
10.7.2CRS configuration register (CRS_CFGR) . . . . .334
10.7.3CRS interrupt and status register (CRS_ISR) . . . . .335
10.7.4CRS interrupt flag clear register (CRS_ICR) . . . . .337
10.7.5CRS register map . . . . .337
11General-purpose I/Os (GPIO) . . . . .339
11.1GPIO introduction . . . . .339
11.2GPIO main features . . . . .339
11.3GPIO functional description . . . . .339
11.3.1General-purpose I/O (GPIO) . . . . .341
11.3.2I/O pin alternate function multiplexer and mapping . . . . .342
11.3.3I/O port control registers . . . . .342
11.3.4I/O port data registers . . . . .343
11.3.5I/O data bitwise handling343
11.3.6GPIO locking mechanism343
11.3.7I/O alternate function input/output343
11.3.8External interrupt/wake-up lines344
11.3.9Input configuration344
11.3.10Output configuration345
11.3.11Alternate function configuration345
11.3.12Analog configuration346
11.3.13Using the HSE or LSE oscillator pins as GPIOs346
11.3.14Using the GPIO pins in the RTC supply domain347
11.3.15I/Os state retention during standby mode347
11.3.16Privileged and unprivileged modes347
11.3.17I/O compensation cell347
11.4GPIO registers347
11.4.1GPIO port mode register (GPIOx_MODER) (x = A to H)348
11.4.2GPIO port output type register (GPIOx_OTYPER) (x = A to H)348
11.4.3GPIO port output speed register (GPIOx_OSPEEDR) (x = A to H)349
11.4.4GPIO port pull-up/pull-down register (GPIOx_PUPDR) (x = A to H)349
11.4.5GPIO port input data register (GPIOx_IDR) (x = A to H)350
11.4.6GPIO port output data register (GPIOx_ODR) (x = A to H)350
11.4.7GPIO port bit set/reset register (GPIOx_BSRR) (x = A to H)351
11.4.8GPIO port configuration lock register (GPIOx_LCKR) (x = A to H)351
11.4.9GPIO alternate function low register (GPIOx_AFRL) (x = A to H)352
11.4.10GPIO alternate function high register (GPIOx_AFRH) (x = A to H)353
11.4.11GPIO port bit reset register (GPIOx_BRR) (x = A to H)354
11.4.12GPIO register map355
12System configuration, boot, and security (SBS)357
12.1SBS introduction357
12.2SBS main features357
12.3SBS functional description357
12.3.1SBS block diagram357
12.3.2SBS signals358
12.3.3SBS reset and clocks358
12.3.4SBS I/O compensation cell management358
12.3.5SBS boot control359
12.3.6SBS hardware secure storage control360
12.4SBS interrupts361
12.5SBS registers361
12.5.1SBS temporal isolation control register (SBS_HDPLCR)361
12.5.2SBS temporal isolation status register (SBS_HDPLSR)362
12.5.3SBS next HDPL control register (SBS_NEXTHDPLCR)362
12.5.4SBS product mode and configuration register (SBS_PMCR)363
12.5.5SBS FPU interrupt mask register (SBS_FPUIMR)364
12.5.6SBS memory erase status register (SBS_MESR)365
12.5.7SBS compensation cell for I/Os control and status register (SBS_CCCSR)365
12.5.8SBS compensation cell for I/Os value register (SBS_CCVALR)366
12.5.9SBS compensation cell for I/Os software code register (SBS_CCWCR)367
12.5.10SBS Class B register (SBS_CFGR2)367
12.5.11SBS CPU lock register (SBS_CLCKR)368
12.5.12SBS ECC NMI mask register (SBS_ECCNMIR)369
12.5.13SBS register map369
13Peripherals interconnect matrix371
13.1Interconnect matrix introduction371
13.2Connection summary371
13.3Interconnection details374
14Low-power direct memory access controller (LPDMA)382
14.1LPDMA introduction382
14.2LPDMA main features382
14.3LPDMA implementation383
14.3.1LPDMA instances383
14.3.2LPDMA channels383
14.3.3LPDMA in low-power modes384
14.3.4LPDMA requests384
14.3.5LPDMA block requests387
14.3.6LPDMA channels with peripheral early termination387
14.3.7LPDMA triggers388
14.4LPDMA functional description390
14.4.1LPDMA block diagram390
14.4.2LPDMA channel state and direct programming without any linked-list390
14.4.3LPDMA channel suspend and resume391
14.4.4LPDMA channel abort and restart392
14.4.5LPDMA linked-list data structure393
14.4.6Linked-list item transfer execution395
14.4.7LPDMA channel state and linked-list programming in run-to-completion mode395
14.4.8LPDMA channel state and linked-list programming in link step mode400
14.4.9LPDMA channel state and linked-list programming406
14.4.10LPDMA direct transfers408
14.4.11LPDMA transfer request and arbitration410
14.4.12LPDMA triggered transfer414
14.4.13LPDMA circular buffering with linked-list programming415
14.4.14LPDMA transfer in peripheral flow-control mode417
14.4.15LPDMA privileged/unprivileged channel418
14.4.16LPDMA error management418
14.5LPDMA in debug mode420
14.6LPDMA in low-power modes420
14.7LPDMA interrupts420
14.8LPDMA registers422
14.8.1LPDMA privileged configuration register (LPDMA_PRIVCFGR)422
14.8.2LPDMA configuration lock register (LPDMA_RCFGLOCKR)423
14.8.3LPDMA masked interrupt status register (LPDMA_MISR)423
14.8.4LPDMA channel x linked-list base address register (LPDMA_CxLBAR)424
14.8.5LPDMA channel x flag clear register (LPDMA_CxFCR)424
14.8.6LPDMA channel x status register (LPDMA_CxSR)425
14.8.7LPDMA channel x control register (LPDMA_CxCR)426
14.8.8LPDMA channel x transfer register 1 (LPDMA_CxTR1)429
14.8.9LPDMA channel x transfer register 2 (LPDMA_CxTR2)431
14.8.10LPDMA channel x block register 1 (LPDMA_CxBR1)433
14.8.11LPDMA channel x source address register (LPDMA_CxSAR)435
14.8.12LPDMA channel x destination address register (LPDMA_CxDAR)436
14.8.13LPDMA channel x linked-list address register (LPDMA_CxLLR)437
14.8.14LPDMA register map438

Chapters