15. Nested vectored interrupt controller (NVIC) 440

ST logo
ST logo
15.1NVIC main features440
15.2SysTick calibration value register440
15.3Interrupt and exception vectors440
16Extended interrupts and event controller (EXTI)445
16.1EXTI main features445
16.2EXTI block diagram446
16.2.1EXTI connections between peripherals and CPU447
16.2.2EXTI interrupt/event mapping447
16.3EXTI functional description448
16.3.1EXTI configurable event input wake-up449
16.3.2EXTI direct event input wake-up449
16.3.3EXTI mux selection450
16.4EXTI functional behavior450
16.5EXTI event protection451
16.5.1EXTI privilege protection452
16.6EXTI registers452
16.6.1EXTI rising trigger selection register (EXTI_RTSR1)452
16.6.2EXTI falling trigger selection register (EXTI_FTSR1)453
16.6.3EXTI software interrupt event register (EXTI_SWIER1)454
16.6.4EXTI rising edge pending register (EXTI_RPR1)454
16.6.5EXTI falling edge pending register (EXTI_FPR1)455
16.6.6EXTI privilege configuration register (EXTI_PRIVCFGR1)455
16.6.7EXTI rising trigger selection register 2 (EXTI_RTSR2)456
16.6.8EXTI falling trigger selection register 2 (EXTI_FTSR2)457
16.6.9EXTI software interrupt event register 2 (EXTI_SWIER2)458
16.6.10EXTI rising edge pending register 2 (EXTI_RPR2)459
16.6.11EXTI falling edge pending register 2 (EXTI_FPR2)460
16.6.12EXTI privilege configuration register 2 (EXTI_PRIVCFGR2)461
16.6.13EXTI external interrupt selection register (EXTI_EXTICR1)461
16.6.14EXTI external interrupt selection register (EXTI_EXTICR2)463
16.6.15EXTI external interrupt selection register (EXTI_EXTICR3)464
16.6.16EXTI external interrupt selection register (EXTI_EXTICR4)466
16.6.17EXTI CPU wake-up with interrupt mask register (EXTI_IMR1)468
16.6.18EXTI CPU wake-up with event mask register (EXTI_EMR1)468
16.6.19EXTI CPU wake-up with interrupt mask register 2 (EXTI_IMR2)469
16.6.20EXTI CPU wake-up with event mask register 2 (EXTI_EMR2) . . . . .469
16.6.21EXTI register map . . . . .470
17Cyclic redundancy check calculation unit (CRC) . . . . .472
17.1CRC introduction . . . . .472
17.2CRC main features . . . . .472
17.3CRC functional description . . . . .473
17.3.1CRC block diagram . . . . .473
17.3.2CRC internal signals . . . . .473
17.3.3CRC operation . . . . .473
17.4CRC registers . . . . .475
17.4.1CRC data register (CRC_DR) . . . . .475
17.4.2CRC independent data register (CRC_IDR) . . . . .475
17.4.3CRC control register (CRC_CR) . . . . .476
17.4.4CRC initial value (CRC_INIT) . . . . .477
17.4.5CRC polynomial (CRC_POL) . . . . .477
17.4.6CRC register map . . . . .478
18CORDIC coprocessor (CORDIC) . . . . .479
18.1CORDIC introduction . . . . .479
18.2CORDIC main features . . . . .479
18.3CORDIC functional description . . . . .479
18.3.1General description . . . . .479
18.3.2CORDIC functions . . . . .479
18.3.3Fixed point representation . . . . .486
18.3.4Scaling factor . . . . .486
18.3.5Precision . . . . .487
18.3.6Zero-overhead mode . . . . .490
18.3.7Polling mode . . . . .491
18.3.8Interrupt mode . . . . .492
18.3.9DMA mode . . . . .492
18.4CORDIC registers . . . . .493
18.4.1CORDIC control/status register (CORDIC_CSR) . . . . .493
18.4.2CORDIC argument register (CORDIC_WDATA) . . . . .495
18.4.3CORDIC result register (CORDIC_RDATA) . . . . .496
18.4.4CORDIC register map . . . . .496
19Extended-SPI interface (XSPI)497
19.1XSPI introduction497
19.2XSPI main features497
19.3XSPI implementation498
19.4XSPI functional description499
19.4.1XSPI block diagram499
19.4.2XSPI pins and internal signals500
19.4.3XSPI interface to memory modes501
19.4.4XSPI regular-command protocol501
19.4.5XSPI regular-command protocol signal interface504
19.4.6HyperBus protocol508
19.4.7Specific features511
19.4.8XSPI operating mode introduction512
19.4.9XSPI indirect mode512
19.4.10XSPI automatic status-polling mode514
19.4.11XSPI memory-mapped mode515
19.4.12XSPI configuration introduction516
19.4.13XSPI system configuration516
19.4.14XSPI device configuration517
19.4.15XSPI regular-command mode configuration519
19.4.16XSPI HyperBus protocol configuration522
19.4.17XSPI error management523
19.4.18XSPI BUSY and ABORT523
19.4.19XSPI reconfiguration or deactivation524
19.4.20NCS behavior524
19.4.21Software control of two external memories524
19.4.22Hardware-controlled extended memory support525
19.5Address alignment and data number526
19.6XSPI interrupts527
19.7XSPI registers528
19.7.1XSPI control register (XSPI_CR)528
19.7.2XSPI device configuration register 1 (XSPI_DCR1)531
19.7.3XSPI device configuration register 2 (XSPI_DCR2)533
19.7.4XSPI device configuration register 3 (XSPI_DCR3)534
19.7.5XSPI device configuration register 4 (XSPI_DCR4)534
19.7.6XSPI status register (XSPI_SR)535
19.7.7XSPI flag clear register (XSPI_FCR) . . . . .536
19.7.8XSPI data length register (XSPI_DLR) . . . . .537
19.7.9XSPI address register (XSPI_AR) . . . . .537
19.7.10XSPI data register (XSPI_DR) . . . . .538
19.7.11XSPI polling status mask register (XSPI_PSMKR) . . . . .538
19.7.12XSPI polling status match register (XSPI_PSMAR) . . . . .539
19.7.13XSPI polling interval register (XSPI_PIR) . . . . .539
19.7.14XSPI communication configuration register (XSPI_CCR) . . . . .540
19.7.15XSPI timing configuration register (XSPI_TCR) . . . . .542
19.7.16XSPI instruction register (XSPI_IR) . . . . .542
19.7.17XSPI alternate bytes register (XSPI_ABR) . . . . .543
19.7.18XSPI low-power timeout register (XSPI_LPTR) . . . . .543
19.7.19XSPI wrap communication configuration register
(XSPI_WPCCR) . . . . .
544
19.7.20XSPI wrap timing configuration register (XSPI_WPTCR) . . . . .546
19.7.21XSPI wrap instruction register (XSPI_WPIR) . . . . .546
19.7.22XSPI wrap alternate bytes register (XSPI_WPABR) . . . . .547
19.7.23XSPI write communication configuration register
(XSPI_WCCR) . . . . .
547
19.7.24XSPI write timing configuration register (XSPI_WTCR) . . . . .549
19.7.25XSPI write instruction register (XSPI_WIR) . . . . .550
19.7.26XSPI write alternate bytes register (XSPI_WABR) . . . . .550
19.7.27XSPI HyperBus latency configuration register
(XSPI_HLCR) . . . . .
551
19.7.28XSPI register map . . . . .551
20Delay block (DLYB) . . . . .555
20.1DLYB introduction . . . . .555
20.2DLYB main features . . . . .555
20.3DLYB functional description . . . . .555
20.3.1DLYB diagram . . . . .555
20.3.2DLYB pins and internal signals . . . . .556
20.3.3General description . . . . .556
20.3.4Delay line length configuration procedure . . . . .557
20.3.5Output clock phase configuration procedure . . . . .558
20.4DLYB registers . . . . .558
20.4.1DLYB control register (DLYB_CR) . . . . .558
20.4.2DLYB configuration register (DLYB_CFGR) . . . . .559
20.4.3DLYB register map .....560
21Analog-to-digital converters (ADC) .....561
21.1ADC introduction .....561
21.2ADC main features .....561
21.3ADC implementation .....563
21.4ADC functional description .....564
21.4.1ADC block diagram .....564
21.4.2ADC pins and internal signals .....565
21.4.3ADC clocks .....567
21.4.4ADC connectivity .....569
21.4.5Slave AHB interface .....571
21.4.6ADC Deep-power-down mode (DEEPPWD) and ADC voltage regulator (ADVREGEN) .....572
21.4.7Calibration (ADCAL, ADC_CALFACT) .....572
21.4.8ADC on-off control (ADEN, ADDIS, ADRDY) .....574
21.4.9Constraints when writing the ADC control bits .....575
21.4.10Channel selection (ADC_SQRy, ADC_JSQR) .....576
21.4.11Channel preselection register (ADC_PCSEL) .....576
21.4.12Channel-wise programmable sampling time (SMPR1, SMPR2) ....577
21.4.13Single conversion mode .....578
21.4.14Continuous conversion mode (CONT = 1) .....579
21.4.15Discontinuous mode (DISCEN, DISCNUM, JDISCEN) .....580
21.4.16Starting conversions (ADSTART, JADSTART) .....581
21.4.17Timing .....582
21.4.18Stopping an ongoing conversion (ADSTP, JADSTP) .....583
21.4.19Conversion on external trigger and trigger polarity (EXTSEL, EXTEN, JEXTSEL, JEXTEN) .....585
21.4.20Injected channel management .....586
21.4.21Programmable resolution (RES) - fast conversion mode .....587
21.4.22End of conversion and end of sampling phase (EOC, JEOC, EOSMP) .....588
21.4.23End of conversion sequence (EOS, JEOS) .....588
21.4.24Timing diagram examples (single/continuous modes, hardware/software triggers) .....589
21.4.25Data management .....591
21.4.26Dynamic low-power features .....599
21.4.27Analog window watchdog (AWD1EN, JAWD1EN, AWD1SGL, AWD1CH, AWDCH of ADC_AWD2CR and ADC_AWD3CR, HTR, LTR, AWDFILT) .....603
21.4.28Oversampler .....608
21.4.29Dual ADC modes .....614
21.4.30Temperature sensor .....629
21.4.31Monitoring the internal voltage reference .....631
21.5ADC interrupts .....633
21.6ADC registers (for each ADC) .....634
21.6.1ADC interrupt and status register (ADC_ISR) .....634
21.6.2ADC interrupt enable register (ADC_IER) .....636
21.6.3ADC control register (ADC_CR) .....638
21.6.4ADC configuration register (ADC_CFGR1) .....641
21.6.5ADC configuration register 2 (ADC_CFGR2) .....644
21.6.6ADC sample time register 1 (ADC_SMPR1) .....647
21.6.7ADC sample time register 2 (ADC_SMPR2) .....648
21.6.8ADC channel preselection register (ADC_PCSEL) .....649
21.6.9ADC regular sequence register 1 (ADC_SQR1) .....649
21.6.10ADC regular sequence register 2 (ADC_SQR2) .....650
21.6.11ADC regular sequence register 3 (ADC_SQR3) .....651
21.6.12ADC regular sequence register 4 (ADC_SQR4) .....652
21.6.13ADC regular data register (ADC_DR) .....653
21.6.14ADC injected sequence register (ADC_JSQR) .....653
21.6.15ADC offset y configuration register (ADC_OF_CFGRy) .....655
21.6.16ADC offset y register (ADC_OFy) .....656
21.6.17ADC gain compensation register (ADC_GCOMP) .....657
21.6.18ADC injected channel y data register (ADC_JDRy) .....658
21.6.19ADC analog watchdog 2 configuration register (ADC_AWD2CR) ....658
21.6.20ADC analog watchdog 3 configuration register (ADC_AWD3CR) ....659
21.6.21ADC analog watchdog 1 lower threshold register (ADC_AWD1LTR) .659
21.6.22ADC analog watchdog 1 higher threshold register (ADC_AWD1HTR) .....660
21.6.23ADC analog watchdog 2 lower threshold register (ADC_AWD2LTR) .660
21.6.24ADC analog watchdog 2 higher threshold register (ADC_AWD2HTR) .....661
21.6.25ADC analog watchdog 3 lower threshold register (ADC_AWD3LTR) .661
21.6.26ADC analog watchdog 3 higher threshold register (ADC_AWD3HTR) .....661
21.6.27ADC calibration factors (ADC_CALFACT) .....662
21.6.28ADC option register (ADC_OR) .....663
21.7ADC common registers .....663
21.7.1ADC common status register (ADCC_CSR) .....663
21.7.2ADC common control register (ADCC_CCR) .....665
21.7.3ADC common regular data register for dual mode
(ADCC_CDR) .....
666
21.7.4ADC common regular data register for dual mode
(ADCC_CDR2) .....
667
21.8ADC register map .....667
22Digital-to-analog converter (DAC) .....672
22.1DAC introduction .....672
22.2DAC main features .....672
22.3DAC implementation .....673
22.4DAC functional description .....674
22.4.1DAC block diagram .....674
22.4.2DAC pins and internal signals .....675
22.4.3DAC clocks .....676
22.4.4DAC channel enable .....676
22.4.5DAC data format .....677
22.4.6DAC conversion .....678
22.4.7DAC output voltage .....679
22.4.8DAC trigger selection .....680
22.4.9DMA requests .....680
22.4.10Noise generation .....681
22.4.11Triangle-wave generation .....682
22.4.12DAC channel modes .....683
22.4.13DAC channel buffer calibration .....686
22.4.14DAC channel conversion modes .....687
22.4.15Dual DAC channel conversion modes (if dual channels are
available) .....
688
22.5DAC in low-power modes .....692
22.6DAC interrupts .....692
22.7DAC registers .....693
22.7.1DAC control register (DAC_CR) .....693
22.7.2DAC software trigger register (DAC_SWTRGR) .....696
22.7.3DAC channel1 12-bit right-aligned data holding register
(DAC_DHR12R1) .....
697
22.7.4DAC channel1 12-bit left aligned data holding register
(DAC_DHR12L1) .....
698
22.7.5DAC channel1 8-bit right aligned data holding register
(DAC_DHR8R1) .....
698
22.7.6DAC channel2 12-bit right aligned data holding register
(DAC_DHR12R2) .....
699
22.7.7DAC channel2 12-bit left aligned data holding register
(DAC_DHR12L2) .....
699
22.7.8DAC channel2 8-bit right-aligned data holding register
(DAC_DHR8R2) .....
700
22.7.9Dual DAC 12-bit right-aligned data holding register
(DAC_DHR12RD) .....
700
22.7.10Dual DAC 12-bit left aligned data holding register
(DAC_DHR12LD) .....
701
22.7.11Dual DAC 8-bit right aligned data holding register
(DAC_DHR8RD) .....
701
22.7.12DAC channel1 data output register (DAC_DOR1) .....702
22.7.13DAC channel2 data output register (DAC_DOR2) .....702
22.7.14DAC status register (DAC_SR) .....703
22.7.15DAC calibration control register (DAC_CCR) .....704
22.7.16DAC mode control register (DAC_MCR) .....705
22.7.17DAC channel1 sample and hold sample time register
(DAC_SHSR1) .....
706
22.7.18DAC channel2 sample and hold sample time register
(DAC_SHSR2) .....
707
22.7.19DAC sample and hold time register (DAC_SHHR) .....707
22.7.20DAC sample and hold refresh time register (DAC_SHRR) .....708
22.7.21DAC register map .....709
23Comparator (COMP) .....711
23.1Introduction .....711
23.2COMP main features .....711
23.3COMP implementation .....712
23.3.1COMP implementation
for STM32C55x/562 and STM32C59x/5A3 devices .....
712
23.3.2COMP implementation for STM32C53x/542 device .....712
23.4COMP functional description .....713
23.4.1COMP block diagram .....713
23.4.2COMP pins and internal signals713
23.4.3COMP reset and clocks715
23.4.4Comparator LOCK mechanism715
23.4.5Window comparator (optional feature)715
23.4.6Hysteresis716
23.4.7Comparator output blanking function716
23.4.8COMP startup stabilization time717
23.4.9COMP power and speed modes717
23.5COMP low-power modes717
23.6COMP interrupts718
23.6.1COMP wake-up interrupt through EXTI718
23.6.2COMP NVIC interrupt through EXTI718
23.6.3COMP interrupt through NVIC of the CPU719
23.7SCALER function719
23.8COMP registers720
23.8.1Comparator status register (COMP_SR)720
23.8.2Comparator interrupt clear flag register (COMP_ICFR)721
23.8.3Comparator configuration register 1 (COMP_CFGR1)721
23.8.4Comparator configuration register 2 (COMP_CFGR2)723
23.8.5COMP register map725
24Operational amplifier (OPAMP)726
24.1Introduction726
24.2OPAMP main features726
24.3OPAMP implementation726
24.4OPAMP functional description727
24.4.1OPAMP block diagram727
24.4.2OPAMP pins and internal signals728
24.4.3OPAMP reset and clocks729
24.4.4OPAMP output redirection to an internal COMP channel729
24.4.5OPAMP initial configuration730
24.4.6OPAMP operational amplifier speed730
24.4.7OPAMP enable730
24.4.8OPAMP operating modes730
24.4.9OPAMP programmable gain736
24.4.10OPAMP operational amplifier offset compensation737
24.4.11OPAMP calibration737
24.4.12Timer-controlled operation739
24.5OPAMP in low-power modes740
24.6OPAMP registers741
24.6.1OPAMP control/status register (OPAMP_CSR)741
24.6.2OPAMP timer-controlled mode register (OPAMP_TCMR)743
24.6.3OPAMP register map746
25Coupling and chaining bridge (CCB)747
25.1CCB introduction747
25.2CCB main features747
25.3CCB implementation748
25.4CCB functional description748
25.4.1CCB block diagram748
25.4.2CCB internal signals749
25.4.3CCB reset and clocks749
25.4.4CCB coupling and chaining749
25.4.5CCB error management752
25.5CCB coupling and chaining operations752
25.5.1Preliminary steps before any protected operation754
25.5.2ECDSA signature755
25.5.3ECC scalar multiplication762
25.5.4RSA modular exponentiation765
25.6CCB interrupts767
25.7CCB registers768
25.7.1CCB control register (CCB_CR)768
25.7.2CCB status register (CCB_SR)769
25.7.3CCB reference tag register (CCB_REFTAGRx)771
25.7.4CCB register map772
26True random number generator (RNG)773
26.1RNG introduction773
26.2RNG main features773
26.3RNG functional description774
26.3.1RNG block diagram774
26.3.2RNG internal signals774
26.3.3Random number generation775
26.3.4RNG initialization777
26.3.5RNG operation778
26.3.6RNG clocking780
26.3.7Error management780
26.3.8RNG low-power use782
26.4RNG interrupts782
26.5RNG processing time783
26.6RNG entropy source validation783
26.6.1Introduction783
26.6.2Validation conditions783
26.7RNG registers785
26.7.1RNG control register (RNG_CR)785
26.7.2RNG status register (RNG_SR)787
26.7.3RNG data register (RNG_DR)788
26.7.4RNG noise source control register (RNG_NSCR)789
26.7.5RNG health test control register x (RNG_HTCRx)789
26.7.6RNG health test status register 0 (RNG_HTSR0)790
26.7.7RNG health test status register 1 (RNG_HTSR1)790
26.7.8RNG noise source mask register (RNG_NSMR)791
26.7.9RNG register map792
27AES hardware accelerator (AES)793
27.1AES introduction793
27.2AES main features793
27.3AES implementation794
27.4AES functional description794
27.4.1AES block diagram794
27.4.2AES internal signals795
27.4.3AES reset and clocks795
27.4.4AES symmetric cipher implementation795
27.4.5AES encryption or decryption typical usage796
27.4.6AES authenticated encryption, decryption, and cipher-based message authentication799
27.4.7AES ciphertext stealing and data padding799
27.4.8AES suspend and resume operations800
27.4.9AES basic chaining modes (ECB, CBC) .....800
27.4.10AES counter (CTR) mode .....804
27.4.11AES Galois/counter mode (GCM) .....806
27.4.12AES Galois message authentication code (GMAC) .....811
27.4.13AES counter with CBC-MAC (CCM) .....812
27.4.14AES key sharing with secure AES co-processor .....817
27.4.15AES data registers and data swapping .....818
27.4.16AES key registers .....820
27.4.17AES initialization vector registers .....820
27.4.18AES error management .....821
27.5AES interrupts .....822
27.6AES DMA requests .....822
27.7AES processing latency .....823
27.8AES registers .....825
27.8.1AES control register (AES_CR) .....825
27.8.2AES status register (AES_SR) .....827
27.8.3AES data input register (AES_DINR) .....828
27.8.4AES data output register (AES_DOUTR) .....829
27.8.5AES key register 0 (AES_KEYR0) .....829
27.8.6AES key register 1 (AES_KEYR1) .....830
27.8.7AES key register 2 (AES_KEYR2) .....830
27.8.8AES key register 3 (AES_KEYR3) .....830
27.8.9AES initialization vector register 0 (AES_IVR0) .....831
27.8.10AES initialization vector register 1 (AES_IVR1) .....831
27.8.11AES initialization vector register 2 (AES_IVR2) .....831
27.8.12AES initialization vector register 3 (AES_IVR3) .....832
27.8.13AES key register 4 (AES_KEYR4) .....832
27.8.14AES key register 5 (AES_KEYR5) .....832
27.8.15AES key register 6 (AES_KEYR6) .....833
27.8.16AES key register 7 (AES_KEYR7) .....833
27.8.17AES suspend registers (AES_SUSPRx) .....833
27.8.18AES interrupt enable register (AES_IER) .....834
27.8.19AES interrupt status register (AES_ISR) .....835
27.8.20AES interrupt clear register (AES_ICR) .....836
27.8.21AES register map .....836