小米5这电池健康度多少正常是不是废了,该不该换

stm32L编程手册
RM0038 Reference manualSTM32L151xx, STM32L152xx and STM32L162xx advanced ARM-based 32-bit MCUsIntroductionThis reference manual targets application developers. It provides complete information on how to use the STM32L151xx, STM32L152xx and STM32L162xx microcontroller memory and peripherals. The STM32L151xx, STM32L152xx and STM32L162xx will be referred to as STM32L15xxx throughout the document, unless otherwise specified. The STM32L15xxx is a family 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 programming, erasing and protection of the internal Flash memory please refer to the STM32L15xxx Flash programming manual. For information on the ARM Cortex?-M3 core, please refer to the Cortex?-M3 Technical Reference Manual.Related documentsAvailable from :■ Cortex?-M3 Technical Reference Manual, available from:/help/topic/com.arm.doc.ddi0337g/DDI0337G_cortex_m3_r2p0_trm.pdf Available from :■ STM32L151xx STM32L152xx datasheets ■ STM32L162xx datasheet ■ STM32L15xxx Flash programming manualTable 1.Applicable productsType Product sub-class STM32L151xx, STM32L152xx and STM32L162xxMicrocontrollerJuly 2012Doc ID 15965 Rev 61/822 ContentsRM0038Contents1 Documentation conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371.1 1.2 List of abbreviations for registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Peripheral availability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372Memory and bus architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382.1 2.2 2.3 System architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Memory organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412.3.1 2.3.2 2.3.3 Embedded SRAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 Bit banding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 Embedded Flash memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452.4Boot configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533CRC calculation unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553.1 3.2 3.3 3.4 CRC introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 CRC main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 CRC functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 CRC registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563.4.1 3.4.2 3.4.3 3.4.4 Data register (CRC_DR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 Independent data register (CRC_IDR) . . . . . . . . . . . . . . . . . . . . . . . . . 56 Control register (CRC_CR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 CRC register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574Power control (PWR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584.1 Power supplies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584.1.1 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 Independent A/D and DAC converter supply and reference voltage . . . 59 Independent LCD supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 RTC and RTC backup registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Voltage regulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Dynamic voltage scaling management . . . . . . . . . . . . . . . . . . . . . . . . . 61 Dynamic voltage scaling configuration . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Voltage regulator and clock management when VDD drops below 2.0 V . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 642/822Doc ID 15965 Rev 6 RM.8Contents Voltage regulator and clock management when modifying the VCORE range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644.2Power supply supervisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 644.2.1 4.2.2 4.2.3 4.2.4 Power on reset (POR)/power down reset (PDR) . . . . . . . . . . . . . . . . . . 67 Brown out reset (BOR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Programmable voltage detector (PVD) . . . . . . . . . . . . . . . . . . . . . . . . . 68 Internal voltage reference (VREFINT) . . . . . . . . . . . . . . . . . . . . . . . . . . 694.3Low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 704.3.1 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4.3.8 4.3.9 Behavior of clocks in low power modes . . . . . . . . . . . . . . . . . . . . . . . . . 71 Slowing down system clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 Peripheral clock gating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 Low power run mode (LP run) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 Sleep mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Low power sleep mode (LP sleep) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Stop mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Standby mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Waking up the device from Stop and Standby modes using the RTC and comparators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 794.4Power control registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 804.4.1 4.4.2 4.4.3 PWR power control register (PWR_CR) . . . . . . . . . . . . . . . . . . . . . . . . 81 PWR power control/status register (PWR_CSR) . . . . . . . . . . . . . . . . . . 83 PWR register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 845Reset and clock control (RCC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 855.1 Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 855.1.1 5.1.2 5.1.3 System reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Power reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 RTC and backup registers reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 865.2Clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 875.2.1 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 HSE clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 HSI clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 MSI clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 PLL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 LSE clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 LSI clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 System clock (SYSCLK) selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 System clock source frequency versus voltage range . . . . . . . . . . . . . . 93Doc ID 15965 Rev 63/822 Contents 5.2.9 5.2.10 5.2.11 5.2.12 5.2.13 5.2.14 5.2.15RM0038 Clock security system (CSS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Clock Security System on LSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 RTC and LCD clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Watchdog clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Clock-out capability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Internal/external clock measurement with TIM9/TIM10/TIM11 . . . . . . . 95 Clock-independent system clock sources for TIM9/TIM10/TIM11 . . . . . 965.3RCC registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 975.3.1 5.3.2 5.3.3 5.3.4 5.3.5 5.3.6 5.3.7 5.3.8 5.3.9 5.3.10 5.3.11 5.3.12 5.3.13 5.3.14 5.3.15 Clock control register (RCC_CR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 Internal clock sources calibration register (RCC_ICSCR) . . . . . . . . . . . 99 Clock configuration register (RCC_CFGR) . . . . . . . . . . . . . . . . . . . . . 100 Clock interrupt register (RCC_CIR) . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 AHB peripheral reset register (RCC_AHBRSTR) . . . . . . . . . . . . . . . . 105 APB2 peripheral reset register (RCC_APB2RSTR) . . . . . . . . . . . . . . 107 APB1 peripheral reset register (RCC_APB1RSTR) . . . . . . . . . . . . . . 108 AHB peripheral clock enable register (RCC_AHBENR) . . . . . . . . . . . 111 APB2 peripheral clock enable register (RCC_APB2ENR) . . . . . . . . . . 113 APB1 peripheral clock enable register (RCC_APB1ENR) . . . . . . . . . . 115 AHB peripheral clock enable in low power mode register (RCC_AHBLPENR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 APB2 peripheral clock enable in low power mode register (RCC_APB2LPENR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 APB1 peripheral clock enable in low power mode register (RCC_APB1LPENR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 Control/status register (RCC_CSR) . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 RCC register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1266General-purpose I/Os (GPIO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1286.1 6.2 6.3 GPIO introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 GPIO main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 GPIO functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1286.3.1 6.3.2 6.3.3 6.3.4 6.3.5 6.3.6 6.3.7 General-purpose I/O (GPIO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 I/O pin multiplexer and mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 I/O port control registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 I/O port data registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 I/O data bitwise handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 GPIO locking mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 I/O alternate function input/output . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134Doc ID 15965 Rev 64/822 RM.8 6.3.9 6.3.10 6.3.11 6.3.12 6.3.13 6.3.14 6.3.15Contents External interrupt/wakeup lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 Input configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 Output configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 Alternate function configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 Analog configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 Using the OSC32_IN/OSC32_OUT pins as GPIO PC14/PC15 port pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 Using the OSC_IN/OSC_OUT pins as GPIO PH0/PH1 port pins . . . . 138 Selection of RTC_AF1 alternate functions . . . . . . . . . . . . . . . . . . . . . . 1386.4GPIO registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1396.4.1 6.4.2 6.4.3 6.4.4 6.4.5 6.4.6 6.4.7 6.4.8 6.4.9 6.4.10 6.4.11 GPIO port mode register (GPIOx_MODER) (x = A..H) . . . . . . . . . . . . 139 GPIO port output type register (GPIOx_OTYPER) (x = A..H) . . . . . . . 140 GPIO port output speed register (GPIOx_OSPEEDR) (x = A..H) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 GPIO port pull-up/pull-down register (GPIOx_PUPDR) (x = A..H) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 GPIO port input data register (GPIOx_IDR) (x = A..H) . . . . . . . . . . . . 141 GPIO port output data register (GPIOx_ODR) (x = A..H) . . . . . . . . . . 141 GPIO port bit set/reset register (GPIOx_BSRR) (x = A..H) . . . . . . . . . 142 GPIO port configuration lock register (GPIOx_LCKR) (x = A..H) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 GPIO alternate function low register (GPIOx_AFRL) (x = A..H) . . . . . 143 GPIO alternate function high register (GPIOx_AFRH) (x = A..H) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 GPIO register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1447System configuration controller (SYSCFG) and routing interface (RI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1467.1 7.2 7.3 SYSCFG and RI introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 RI main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 RI functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1507.3.1 7.3.2 7.3.3 Special I/O configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 Input capture routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 Reference voltage routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1547.4RI registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1557.4.1 7.4.2 7.4.3 RI input capture register (RI_ICR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 RI analog switches control register (RI_ASCR1) . . . . . . . . . . . . . . . . . 157 RI analog switch control register 2 (RI_ASCR2) . . . . . . . . . . . . . . . . . 159Doc ID 15965 Rev 65/822 Contents 7.4.4 7.4.5 7.4.6 7.4.7 7.4.8 7.4.9 7.4.10 7.4.11 7.4.12 7.4.13 7.4.14 7.4.15 7.4.16 7.4.17 7.4.18 7.4.19 7.4.20 7.4.21 7.4.22 7.4.23RM0038 RI hysteresis control register (RI_HYSCR1) . . . . . . . . . . . . . . . . . . . . 160 RI Hysteresis control register (RI_HYSCR2) . . . . . . . . . . . . . . . . . . . . 160 RI Hysteresis control register (RI_HYSCR3) . . . . . . . . . . . . . . . . . . . . 161 RI Hysteresis control register (RI_HYSCR4) . . . . . . . . . . . . . . . . . . . . 161 Analog switch mode register (RI_ASMR1) . . . . . . . . . . . . . . . . . . . . . 162 Channel mask register (RI_CMR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 Channel identification for capture register (RI_CICR1) . . . . . . . . . . . . 163 Analog switch mode register (RI_ASMR2) . . . . . . . . . . . . . . . . . . . . . 163 Channel mask register (RI_CMR2) . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 Channel identification for capture register (RI_CICR2) . . . . . . . . . . . . 164 Analog switch mode register (RI_ASMR3) . . . . . . . . . . . . . . . . . . . . . 165 Channel mask register (RI_CMR3) . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 Channel identification for capture register (RI_CICR3) . . . . . . . . . . . . 166 Analog switch mode register (RI_ASMR4) . . . . . . . . . . . . . . . . . . . . . 166 Channel mask register (RI_CMR4) . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 Channel identification for capture register (RI_CICR4) . . . . . . . . . . . . 167 Analog switch mode register (RI_ASMR5) . . . . . . . . . . . . . . . . . . . . . 168 Channel mask register (RI_CMR5) . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 Channel identification for capture register (RI_CICR5) . . . . . . . . . . . . 169 RI register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1697.5SYSCFG registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1717.5.1 7.5.2 7.5.3 7.5.4 7.5.5 7.5.6 7.5.7 SYSCFG memory remap register (SYSCFG_MEMRMP) . . . . . . . . . . 171 SYSCFG peripheral mode configuration register (SYSCFG_PMC) . . 172 SYSCFG external interrupt configuration register 1 (SYSCFG_EXTICR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 SYSCFG external interrupt configuration register 2 (SYSCFG_EXTICR2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 SYSCFG external interrupt configuration register 3 (SYSCFG_EXTICR3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 SYSCFG external interrupt configuration register 4 (SYSCFG_EXTICR4) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 SYSCFG register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1748Touch sensing I/Os . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1758.1 8.2 8.3 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 Main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 Functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1768.3.1 Surface charge transfer acquisition overview . . . . . . . . . . . . . . . . . . . 1766/822Doc ID 15965 Rev 6 RM.2Contents Charge transfer acquisition management . . . . . . . . . . . . . . . . . . . . . . 1788.4Touch sensing library. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1809Interrupts and events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1819.1 Nested vectored interrupt controller (NVIC) . . . . . . . . . . . . . . . . . . . . . . 1819.1.1 9.1.2 SysTick calibration value register . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 Interrupt and exception vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1819.2External interrupt/event controller (EXTI) . . . . . . . . . . . . . . . . . . . . . . . . 1889.2.1 9.2.2 9.2.3 9.2.4 9.2.5 Main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 Block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 Wakeup event management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 External interrupt/event line mapping . . . . . . . . . . . . . . . . . . . . . . . . . 1909.3EXTI registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1929.3.1 9.3.2 9.3.3 9.3.4 9.3.5 9.3.6 9.3.7 EXTI interrupt mask register (EXTI_IMR) . . . . . . . . . . . . . . . . . . . . . . 192 EXTI event mask register (EXTI_EMR) . . . . . . . . . . . . . . . . . . . . . . . . 192 EXTI rising edge trigger selection register (EXTI_RTSR) . . . . . . . . . . 193 Falling edge trigger selection register (EXTI_FTSR) . . . . . . . . . . . . . . 193 EXTI software interrupt event register (EXTI_SWIER) . . . . . . . . . . . . 194 EXTI pending register (EXTI_PR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 EXTI register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19510Direct memory access controller (DMA) . . . . . . . . . . . . . . . . . . . . . . . 19610.1 10.2 10.3 DMA introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 DMA main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 DMA functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19910.3.1 10.3.2 10.3.3 10.3.4 10.3.5 10.3.6 10.3.7 DMA transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 Arbiter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 DMA channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 Programmable data width, data alignment and endians . . . . . . . . . . . 202 Error management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 DMA request mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20310.4DMA registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20610.4.1 10.4.2 DMA interrupt status register (DMA_ISR) . . . . . . . . . . . . . . . . . . . . . . 206 DMA interrupt flag clear register (DMA_IFCR) . . . . . . . . . . . . . . . . . . 208Doc ID 15965 Rev 67/822 Contents 10.4.3 10.4.4 10.4.5 10.4.6 10.4.7RM0038 DMA channel x configuration register (DMA_CCRx) (x = 1..7, where x = channel number) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 DMA channel x number of data register (DMA_CNDTRx) (x = 1..7), where x = channel number) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 DMA channel x peripheral address register (DMA_CPARx) (x = 1..7), where x = channel number) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 DMA channel x memory address register (DMA_CMARx) (x = 1..7), where x = channel number) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 DMA register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21211Analog-to-digital converter (ADC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21411.1 11.2 11.3 ADC introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 ADC main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 ADC functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21511.3.1 11.3.2 11.3.3 11.3.4 11.3.5 11.3.6 11.3.7 11.3.8 11.3.9 ADC power on-off control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 ADC clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 Channel selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 Single conversion mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 Continuous conversion mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 Timing diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 Analog watchdog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 Scan mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Injected channel management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22311.3.10 Discontinuous mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22411.4 11.5 11.6 11.7Data alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 Channel-wise programmable sampling time . . . . . . . . . . . . . . . . . . . . . 226 Conversion on external trigger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 Aborting a conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22811.7.1 11.7.2 Injected channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 Regular channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22911.8 11.9Conversion resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 Hardware freeze and delay insertion modes for slow conversions . . . . . 22911.9.1 11.9.2 Inserting a delay after each regular conversion . . . . . . . . . . . . . . . . . . 230 Inserting a delay after each sequence of auto-injected conversions . . 23111.10 Power saving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 11.11 Data management and overrun detection . . . . . . . . . . . . . . . . . . . . . . . 23411.11.1 Using the DMA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2348/822Doc ID 15965 Rev 6 RM0038Contents 11.11.2 Managing a sequence of conversions without using the DMA . . . . . . 234 11.11.3 Conversions without reading all the data . . . . . . . . . . . . . . . . . . . . . . . 235 11.11.4 Overrun detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23511.12 Temperature sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23511.12.1 How to read the temperature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23611.13 Internal reference voltage (VREFINT) conversion . . . . . . . . . . . . . . . . . . 237 11.14 ADC interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 11.15 ADC registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23811.15.1 ADC status register (ADC_SR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 11.15.2 ADC control register 1 (ADC_CR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 11.15.3 ADC control register 2 (ADC_CR2) . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 11.15.4 ADC sample time register 1 (ADC_SMPR1) . . . . . . . . . . . . . . . . . . . . 246 11.15.5 ADC sample time register 2 (ADC_SMPR2) . . . . . . . . . . . . . . . . . . . . 246 11.15.6 ADC sample time register 3 (ADC_SMPR3) . . . . . . . . . . . . . . . . . . . . 247 11.15.7 ADC injected channel data offset register x (ADC_JOFRx)(x=1..4) . . 248 11.15.8 ADC watchdog higher threshold register (ADC_HTR) . . . . . . . . . . . . . 248 11.15.9 ADC watchdog lower threshold register (ADC_LTR) . . . . . . . . . . . . . . 248 11.15.10 ADC regular sequence register 1 (ADC_SQR1) . . . . . . . . . . . . . . . . . 249 11.15.11 ADC regular sequence register 2 (ADC_SQR2) . . . . . . . . . . . . . . . . . 249 11.15.12 ADC regular sequence register 3 (ADC_SQR3) . . . . . . . . . . . . . . . . . 250 11.15.13 ADC regular sequence register 4 (ADC_SQR4) . . . . . . . . . . . . . . . . . 251 11.15.14 ADC regular sequence register 5 (ADC_SQR5) . . . . . . . . . . . . . . . . . 251 11.15.15 ADC injected sequence register (ADC_JSQR) . . . . . . . . . . . . . . . . . . 252 11.15.16 ADC injected data register x (ADC_JDRx) (x= 1..4) . . . . . . . . . . . . . . 252 11.15.17 ADC regular data register (ADC_DR) . . . . . . . . . . . . . . . . . . . . . . . . . 253 11.15.18 ADC sample time register 0 (ADC_SMPR0) . . . . . . . . . . . . . . . . . . . . 253 11.15.19 ADC common status register (ADC_CSR) . . . . . . . . . . . . . . . . . . . . . 254 11.15.20 ADC common control register (ADC_CCR) . . . . . . . . . . . . . . . . . . . . . 254 11.15.21 ADC register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25612Digital-to-analog converter (DAC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25812.1 12.2 12.3 DAC introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 DAC main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 DAC functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26012.3.1 12.3.2 DAC channel enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 DAC output buffer enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260Doc ID 15965 Rev 69/822 Contents 12.3.3 12.3.4 12.3.5 12.3.6 12.3.7 12.3.8 12.3.9RM0038 DAC data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 DAC conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 DAC output voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 DAC trigger selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 DMA request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 Noise generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 Triangle-wave generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26412.4Dual DAC channel conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26512.4.1 12.4.2 12.4.3 12.4.4 12.4.5 12.4.6 12.4.7 12.4.8 12.4.9 Independent trigger without wave generation . . . . . . . . . . . . . . . . . . . 265 Independent trigger with single LFSR generation . . . . . . . . . . . . . . . . 266 Independent trigger with different LFSR generation . . . . . . . . . . . . . . 266 Independent trigger with single triangle generation . . . . . . . . . . . . . . . 266 Independent trigger with different triangle generation . . . . . . . . . . . . . 267 Simultaneous software start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 Simultaneous trigger without wave generation . . . . . . . . . . . . . . . . . . 267 Simultaneous trigger with single LFSR generation . . . . . . . . . . . . . . . 268 Simultaneous trigger with different LFSR generation . . . . . . . . . . . . . 26812.4.10 Simultaneous trigger with single triangle generation . . . . . . . . . . . . . . 268 12.4.11 Simultaneous trigger with different triangle generation . . . . . . . . . . . . 26912.5DAC registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26912.5.1 12.5.2 12.5.3 12.5.4 12.5.5 12.5.6 12.5.7 12.5.8 12.5.9 DAC control register (DAC_CR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 DAC software trigger register (DAC_SWTRIGR) . . . . . . . . . . . . . . . . . 272 DAC channel1 12-bit right-aligned data holding register (DAC_DHR12R1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 DAC channel1 12-bit left aligned data holding register (DAC_DHR12L1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273 DAC channel1 8-bit right aligned data holding register (DAC_DHR8R1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273 DAC channel2 12-bit right aligned data holding register (DAC_DHR12R2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273 DAC channel2 12-bit left aligned data holding register (DAC_DHR12L2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274 DAC channel2 8-bit right-aligned data holding register (DAC_DHR8R2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274 Dual DAC 12-bit right-aligned data holding register (DAC_DHR12RD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27412.5.10 DUAL DAC 12-bit left aligned data holding register (DAC_DHR12LD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27510/822Doc ID 15965 Rev 6 RM0038Contents 12.5.11 DUAL DAC 8-bit right aligned data holding register (DAC_DHR8RD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 12.5.12 DAC channel1 data output register (DAC_DOR1) . . . . . . . . . . . . . . . . 276 12.5.13 DAC channel2 data output register (DAC_DOR2) . . . . . . . . . . . . . . . . 276 12.5.14 DAC status register (DAC_SR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 12.5.15 DAC register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27713Comparators (COMP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27813.1 13.2 13.3 13.4 13.5 13.6 13.7 13.8 13.9 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 Main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 COMP clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280 Comparator 1 (COMP1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280 Comparator 2 (COMP2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 Comparators in Window mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 Low power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 COMP registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28513.9.1 13.9.2 COMP comparator control and status register (COMP_CSR) . . . . . . . 285 COMP register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28814Operational amplifiers (OPAMP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28914.1 14.2 14.3 OPAMP introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 OPAMP main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 OPAMP functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28914.3.1 14.3.2 14.3.3 Signal routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 Using the OPAMP outputs as ADC inputs . . . . . . . . . . . . . . . . . . . . . . 291 Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29114.4OPAMP registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29314.4.1 14.4.2 OPAMP control/status register (OPAMP_CSR) . . . . . . . . . . . . . . . . . . 293 OPAMP register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29815Liquid crystal display controller (LCD) . . . . . . . . . . . . . . . . . . . . . . . . 29915.1 15.2 15.3 15.4 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 LCD main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 LCD functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301Doc ID 15965 Rev 6 11/822 Contents 15.4.1 15.4.2 15.4.3 15.4.4 15.4.5 15.4.6 15.4.7 15.4.8RM0038 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 Frequency generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 Common driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 Segment driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 Voltage generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 Double buffer memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 COM and SEG multiplexing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 Flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31515.5LCD registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31615.5.1 15.5.2 15.5.3 15.5.4 15.5.5 15.5.6 LCD control register (LCD_CR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 LCD frame control register (LCD_FCR) . . . . . . . . . . . . . . . . . . . . . . . . 317 LCD status register (LCD_SR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 LCD clear register (LCD_CLR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 LCD display memory (LCD_RAM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 LCD register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32116General-purpose timers (TIM2 to TIM5) . . . . . . . . . . . . . . . . . . . . . . . . 32316.1 16.2 16.3 TIM2 to TIM5 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 TIM2 to TIM5 main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 TIM2 to TIM5 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32416.3.1 16.3.2 16.3.3 16.3.4 16.3.5 16.3.6 16.3.7 16.3.8 16.3.9 Time-base unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 Counter modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326 Clock selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335 Capture/compare channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 Input capture mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 PWM input mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340 Forced output mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 Output compare mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342 PWM mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34316.3.10 One-pulse mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 16.3.11 Clearing the OCxREF signal on an external event . . . . . . . . . . . . . . . 347 16.3.12 Encoder interface mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348 16.3.13 Timer input XOR function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350 16.3.14 Timers and external trigger synchronization . . . . . . . . . . . . . . . . . . . . 350 16.3.15 Timer synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 16.3.16 Debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35816.412/822TIMx registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359Doc ID 15965 Rev 6 RM.1 16.4.2 16.4.3 16.4.4 16.4.5 16.4.6 16.4.7 16.4.8 16.4.9Contents TIMx control register 1 (TIMx_CR1) . . . . . . . . . . . . . . . . . . . . . . . . . . 359 TIMx control register 2 (TIMx_CR2) . . . . . . . . . . . . . . . . . . . . . . . . . . 361 TIMx slave mode control register (TIMx_SMCR) . . . . . . . . . . . . . . . . . 362 TIMx DMA/Interrupt enable register (TIMx_DIER) . . . . . . . . . . . . . . . . 364 TIMx status register (TIMx_SR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 TIMx event generation register (TIMx_EGR) . . . . . . . . . . . . . . . . . . . . 367 TIMx capture/compare mode register 1 (TIMx_CCMR1) . . . . . . . . . . . 368 TIMx capture/compare mode register 2 (TIMx_CCMR2) . . . . . . . . . . . 371 TIMx capture/compare enable register (TIMx_CCER) . . . . . . . . . . . . . 37216.4.10 TIMx counter (TIMx_CNT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374 16.4.11 TIMx prescaler (TIMx_PSC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374 16.4.12 TIMx auto-reload register (TIMx_ARR) . . . . . . . . . . . . . . . . . . . . . . . . 374 16.4.13 TIMx capture/compare register 1 (TIMx_CCR1) . . . . . . . . . . . . . . . . . 375 16.4.14 TIMx capture/compare register 2 (TIMx_CCR2) . . . . . . . . . . . . . . . . . 375 16.4.15 TIMx capture/compare register 3 (TIMx_CCR3) . . . . . . . . . . . . . . . . . 376 16.4.16 TIMx capture/compare register 4 (TIMx_CCR4) . . . . . . . . . . . . . . . . . 376 16.4.17 TIMx DMA control register (TIMx_DCR) . . . . . . . . . . . . . . . . . . . . . . . 377 16.4.18 TIMx DMA address for full transfer (TIMx_DMAR) . . . . . . . . . . . . . . . 377 16.4.19 TIM2 option register (TIM2_OR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 16.4.20 TIM3 option register (TIM3_OR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 16.4.21 TIMx register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38017General-purpose timers (TIM9/10/11) . . . . . . . . . . . . . . . . . . . . . . . . . 38317.1 17.2 17.3 17.4 TIM9/10/11 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 TIM9/10/11 main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38317.2.1 TIM9 main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383TIM10/TIM11 main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 TIM9/10/11 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38717.4.1 17.4.2 17.4.3 17.4.4 17.4.5 17.4.6 17.4.7 17.4.8 17.4.9 Time-base unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 Counter modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 Clock selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 Capture/compare channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 Input capture mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394 PWM input mode (only for TIM9) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 Forced output mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396 Output compare mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397 PWM mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398Doc ID 15965 Rev 613/822 ContentsRM.10 One-pulse mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399 17.4.11 TIM9 external trigger synchronization . . . . . . . . . . . . . . . . . . . . . . . . . 401 17.4.12 Timer synchronization (TIM9) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404 17.4.13 Debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40417.5TIM9 registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40517.5.1 17.5.2 17.5.3 17.5.4 17.5.5 17.5.6 17.5.7 17.5.8 17.5.9 TIM9 control register 1 (TIMx_CR1) . . . . . . . . . . . . . . . . . . . . . . . . . . 405 TIM9 control register 2 (TIMx_CR2) . . . . . . . . . . . . . . . . . . . . . . . . . . 407 TIM9 slave mode control register (TIMx_SMCR) . . . . . . . . . . . . . . . . . 408 TIM9 Interrupt enable register (TIMx_DIER) . . . . . . . . . . . . . . . . . . . . 410 TIM9 status register (TIMx_SR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411 TIM9 event generation register (TIMx_EGR) . . . . . . . . . . . . . . . . . . . . 412 TIM9 capture/compare mode register 1 (TIMx_CCMR1) . . . . . . . . . . 413 TIM9 capture/compare enable register (TIMx_CCER) . . . . . . . . . . . . 416 TIM9 counter (TIMx_CNT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41717.5.10 TIM9 prescaler (TIMx_PSC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417 17.5.11 TIM9 auto-reload register (TIMx_ARR) . . . . . . . . . . . . . . . . . . . . . . . . 417 17.5.12 TIM9 capture/compare register 1 (TIMx_CCR1) . . . . . . . . . . . . . . . . . 418 17.5.13 TIM9 capture/compare register 2 (TIMx_CCR2) . . . . . . . . . . . . . . . . . 418 17.5.14 TIM9 option register 1 (TIM9_OR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 17.5.15 TIM9 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41917.6TIM10/11 registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42117.6.1 17.6.2 17.6.3 17.6.4 17.6.5 17.6.6 17.6.7 17.6.8 17.6.9 TIM10/11 control register 1 (TIMx_CR1) . . . . . . . . . . . . . . . . . . . . . . . 421 TIM10/11 slave mode control register 1 (TIMx_SMCR) . . . . . . . . . . . . 422 TIM10/11/13/14 Interrupt enable register (TIMx_DIER) . . . . . . . . . . . 423 TIM10/11 status register (TIMx_SR) . . . . . . . . . . . . . . . . . . . . . . . . . . 423 TIM10/11 event generation register (TIMx_EGR) . . . . . . . . . . . . . . . . 424 TIM10/11 capture/compare mode register 1 (TIMx_CCMR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425 TIM10/11 capture/compare enable register (TIMx_CCER) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427 TIM10/11 counter (TIMx_CNT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428 TIM10/11 prescaler (TIMx_PSC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42817.6.10 TIM10/11 auto-reload register (TIMx_ARR) . . . . . . . . . . . . . . . . . . . . 428 17.6.11 TIM10/11 capture/compare register 1 (TIMx_CCR1) . . . . . . . . . . . . . 429 17.6.12 TIM10 option register 1 (TIM10_OR) . . . . . . . . . . . . . . . . . . . . . . . . . . 429 17.6.13 TIM11 option register 1 (TIM11_OR) . . . . . . . . . . . . . . . . . . . . . . . . . . 430 17.6.14 TIM10/11 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43014/822Doc ID 15965 Rev 6 RM0038Contents18Basic timers (TIM6&TIM7) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43218.1 18.2 18.3 TIM6&TIM7 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432 TIM6&TIM7 main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432 TIM6&TIM7 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43318.3.1 18.3.2 18.3.3 18.3.4 Time-base unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433 Counting mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434 Clock source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437 Debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43718.4TIM6&TIM7 registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43818.4.1 18.4.2 18.4.3 18.4.4 18.4.5 18.4.6 18.4.7 18.4.8 18.4.9 TIM6&TIM7 control register 1 (TIMx_CR1) . . . . . . . . . . . . . . . . . . . . . 438 TIM6&TIM7 control register 2 (TIMx_CR2) . . . . . . . . . . . . . . . . . . . . . 439 TIM6&TIM7 DMA/Interrupt enable register (TIMx_DIER) . . . . . . . . . . 439 TIM6&TIM7 status register (TIMx_SR) . . . . . . . . . . . . . . . . . . . . . . . . 440 TIM6&TIM7 event generation register (TIMx_EGR) . . . . . . . . . . . . . . 440 TIM6&TIM7 counter (TIMx_CNT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440 TIM6&TIM7 prescaler (TIMx_PSC) . . . . . . . . . . . . . . . . . . . . . . . . . . . 441 TIM6&TIM7 auto-reload register (TIMx_ARR) . . . . . . . . . . . . . . . . . . . 441 TIM6&TIM7 register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44219Real-time clock (RTC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44319.1 19.2 19.3 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443 RTC main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444 RTC functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44619.3.1 19.3.2 19.3.3 19.3.4 19.3.5 19.3.6 19.3.7 19.3.8 19.3.9 Clock and prescalers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446 Real-time clock and calendar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446 Programmable alarms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447 Periodic auto-wakeup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447 RTC initialization and configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . 448 Reading the calendar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450 Resetting the RTC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451 RTC synchronization (high and medium+ density devices only) . . . . . 451 RTC reference clock detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45219.3.10 RTC coarse digital calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453 19.3.11 RTC smooth digital calibration (high and medium+ density devices only) . 454 19.3.12 Timestamp function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455Doc ID 15965 Rev 615/822 ContentsRM.13 Tamper detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456 19.3.14 Calibration clock output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458 19.3.15 Alarm output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45819.4 19.5 19.6RTC and low power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459 RTC interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459 RTC registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46119.6.1 19.6.2 19.6.3 19.6.4 19.6.5 19.6.6 19.6.7 19.6.8 19.6.9 RTC time register (RTC_TR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 RTC date register (RTC_DR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462 RTC control register (RTC_CR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463 RTC initialization and status register (RTC_ISR) . . . . . . . . . . . . . . . . . 465 RTC prescaler register (RTC_PRER) . . . . . . . . . . . . . . . . . . . . . . . . . 467 RTC wakeup timer register (RTC_WUTR) . . . . . . . . . . . . . . . . . . . . . . 468 RTC calibration register (RTC_CALIBR) . . . . . . . . . . . . . . . . . . . . . . . 469 RTC alarm A register (RTC_ALRMAR) . . . . . . . . . . . . . . . . . . . . . . . . 470 RTC alarm B register (RTC_ALRMBR) . . . . . . . . . . . . . . . . . . . . . . . . 47119.6.10 RTC write protection register (RTC_WPR) . . . . . . . . . . . . . . . . . . . . . 472 19.6.11 RTC sub second register (RTC_SSR) . . . . . . . . . . . . . . . . . . . . . . . . . 472 19.6.12 RTC shift control register (RTC_SHIFTR) . . . . . . . . . . . . . . . . . . . . . . 473 19.6.13 RTC time stamp time register (RTC_TSTR) . . . . . . . . . . . . . . . . . . . . 474 19.6.14 RTC time stamp date register (RTC_TSDR) . . . . . . . . . . . . . . . . . . . . 475 19.6.15 RTC timestamp sub second register (RTC_TSSSR) . . . . . . . . . . . . . . 475 19.6.16 RTC calibration register (RTC_CALR) . . . . . . . . . . . . . . . . . . . . . . . . . 476 19.6.17 RTC tamper and alternate function configuration register (RTC_TAFCR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478 19.6.18 RTC alarm A sub second register (RTC_ALRMASSR) . . . . . . . . . . . . 480 19.6.19 RTC alarm B sub second register (RTC_ALRMBSSR) . . . . . . . . . . . . 481 19.6.20 RTC backup registers (RTC_BKPxR) . . . . . . . . . . . . . . . . . . . . . . . . . 482 19.6.21 RTC register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48220Independent watchdog (IWDG) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48420.1 20.2 20.3 IWDG introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484 IWDG main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484 IWDG functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48420.3.1 20.3.2 20.3.3 Hardware watchdog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484 Register access protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484 Debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48520.416/822IWDG registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485Doc ID 15965 Rev 6 RM.1 20.4.2 20.4.3 20.4.4 20.4.5Contents Key register (IWDG_KR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486 Prescaler register (IWDG_PR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 Reload register (IWDG_RLR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 Status register (IWDG_SR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488 IWDG register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48821Window watchdog (WWDG) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48921.1 21.2 21.3 21.4 21.5 21.6 WWDG introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489 WWDG main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489 WWDG functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489 How to program the watchdog timeout . . . . . . . . . . . . . . . . . . . . . . . . . . 491 Debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492 WWDG registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49321.6.1 21.6.2 21.6.3 21.6.4 Control register (WWDG_CR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493 Configuration register (WWDG_CFR) . . . . . . . . . . . . . . . . . . . . . . . . . 494 Status register (WWDG_SR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494 WWDG register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49522Advanced encryption standard hardware accelerator (AES) . . . . . . 49622.1 22.2 22.3 22.4 22.5 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496 AES main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496 AES functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497 Encryption and derivation keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498 AES chaining algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49922.5.1 22.5.2 22.5.3 Electronic CodeBook (ECB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499 Cipher block chaining (CBC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500 Counter Mode (CTR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50322.6 22.7Data type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505 Operating modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50722.7.1 22.7.2 22.7.3 22.7.4 Mode 1: encryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507 Mode 2: key derivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507 Mode 3: decryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508 Mode 4: key derivation and decryption . . . . . . . . . . . . . . . . . . . . . . . . 50922.8 22.9AES DMA interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509 Error flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511Doc ID 15965 Rev 617/822 ContentsRM003822.10 Processing time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511 22.11 AES interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511 22.12 AES registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51222.12.1 AES control register (AES_CR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512 22.12.2 AES status register (AES_SR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514 22.12.3 AES data input register (AES_DINR) . . . . . . . . . . . . . . . . . . . . . . . . . 515 22.12.4 AES data output register (AES_DOUTR) . . . . . . . . . . . . . . . . . . . . . . 515 22.12.5 AES key register 0(AES_KEYR0) (LSB: key [31:0]) . . . . . . . . . . . . . . 516 22.12.6 AES key register 1 (AES_KEYR1) (Key[63:32]) . . . . . . . . . . . . . . . . . 516 22.12.7 AES key register 2 (AES_KEYR2) (Key [95:64]) . . . . . . . . . . . . . . . . . 517 22.12.8 AES key register 3 (AES_KEYR3) (MSB: key[127:96]) . . . . . . . . . . . . 517 22.12.9 AES initialization vector register 0 (AES_IVR0) (LSB: IVR[31:0]) . . . . 517 22.12.10 AES initialization vector register 1 (AES_IVR1) (IVR[63:32]) . . . . . . . 518 22.12.11 AES initialization vector register 2 (AES_IVR2) (IVR[95:64]) . . . . . . . 519 22.12.12 AES initialization vector register 3 (AES_IVR3) (MSB: IVR[127:96]) . . 519 22.12.13 AES register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52023Universal serial bus full-speed device interface (USB) . . . . . . . . . . . 52123.1 23.2 23.3 23.4 USB introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 USB main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 USB functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52123.3.1 Description of USB blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523Programming considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52423.4.1 23.4.2 23.4.3 23.4.4 23.4.5 Generic USB device programming . . . . . . . . . . . . . . . . . . . . . . . . . . . 524 System and power-on reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525 Double-buffered endpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530 Isochronous transfers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533 Suspend/Resume events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53423.5USB registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53623.5.1 23.5.2 23.5.3 23.5.4 Common registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536 Endpoint-specific registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543 Buffer descriptor table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547 USB register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55024Flexible static memory controller (FSMC) . . . . . . . . . . . . . . . . . . . . . 55224.1 FSMC main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55218/822Doc ID 15965 Rev 6 RM0038Contents24.2 24.3 24.4 24.5Block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553 AHB interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55324.3.1 Supported memories and transactions . . . . . . . . . . . . . . . . . . . . . . . . 554External device address mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55524.4.1 NOR/PSRAM address mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555NOR Flash/PSRAM controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55624.5.1 24.5.2 24.5.3 24.5.4 24.5.5 24.5.6 24.5.7 External memory interface signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557 Supported memories and transactions . . . . . . . . . . . . . . . . . . . . . . . . 559 General timing rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 560 NOR Flash/PSRAM controller asynchronous transactions . . . . . . . . . 560 Synchronous burst transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576 NOR/PSRAM control registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582 FSMC register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58825Inter-integrated circuit (I2C) interface . . . . . . . . . . . . . . . . . . . . . . . . . 58925.1 25.2 25.3 I2C introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589 I2C main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589 I2C functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59025.3.1 25.3.2 25.3.3 25.3.4 25.3.5 25.3.6 25.3.7 25.3.8 Mode selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590 I2C slave mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592 I2C master mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594 Error conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599 SDA/SCL line control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600 SMBus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600 DMA requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603 Packet error checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60525.4 25.5 25.6I2C interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605 I2C debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607 I2C registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60725.6.1 25.6.2 25.6.3 25.6.4 25.6.5 25.6.6 25.6.7 I2C Control register 1 (I2C_CR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607 I2C Control register 2 (I2C_CR2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609 I2C Own address register 1 (I2C_OAR1) . . . . . . . . . . . . . . . . . . . . . . . 611 I2C Own address register 2 (I2C_OAR2) . . . . . . . . . . . . . . . . . . . . . . . 611 I2C Data register (I2C_DR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612 I2C Status register 1 (I2C_SR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612 I2C Status register 2 (I2C_SR2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616Doc ID 15965 Rev 619/822 Contents 25.6.8 25.6.9RM0038 I2C Clock control register (I2C_CCR) . . . . . . . . . . . . . . . . . . . . . . . . . 617 I2C TRISE register (I2C_TRISE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61825.6.10 I2C register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61926Universal synchronous asynchronous receiver transmitter (USART) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62026.1 26.2 26.3 USART introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 620 USART main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 620 USART functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62126.3.1 26.3.2 26.3.3 26.3.4 26.3.5 26.3.6 26.3.7 26.3.8 26.3.9 USART character description . . . . . . . . . .}

我要回帖

更多关于 换电池 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信