RM0454-STM32G0x0
This reference manual complements the datasheets of the STM32G0x0 microcontrollers, providing information required for application and in particular for software development. It pertains to the superset of feature sets available on STM32G0x0 microcontrollers.
For feature set, ordering information, and mechanical and electrical characteristics of a particular STM32G0x0 device, refer to its corresponding datasheet.
For information on the Arm ® Cortex ® -M0+ core, refer to the Cortex ® -M0+ technical reference manual.
Related documents
- • “Cortex ® -M0+ Technical Reference Manual”, available from: http://infocenter.arm.com
- • PM0223 programming manual for Cortex ® -M0+ core (a)
- • STM32G0x0 datasheets (a)
- • AN2606 application note on booting STM32 MCUs (a)
a. Available on STMicroelectronics website www.st.com
Contents
- 1 Documentation conventions . . . . . 39
- 1.1 General information . . . . . 39
- 1.2 List of abbreviations for registers . . . . . 39
- 1.3 Glossary . . . . . 40
- 1.4 Availability of peripherals . . . . . 40
- 2 Memory and bus architecture . . . . . 42
- 2.1 System architecture . . . . . 42
- 2.2 Memory organization . . . . . 44
- 2.2.1 Introduction . . . . . 44
- 2.2.2 Memory map and register boundary addresses . . . . . 45
- 2.3 Embedded SRAM . . . . . 49
- 2.4 Flash memory overview . . . . . 50
- 2.5 Boot configuration . . . . . 51
- 3 Embedded Flash memory (FLASH) . . . . . 53
- 3.1 FLASH Introduction . . . . . 53
- 3.2 FLASH main features . . . . . 53
- 3.3 FLASH functional description . . . . . 53
- 3.3.1 FLASH memory organization . . . . . 53
- 3.3.2 FLASH empty check . . . . . 55
- 3.3.3 FLASH error code correction (ECC) . . . . . 55
- 3.3.4 FLASH read access latency . . . . . 56
- 3.3.5 FLASH memory acceleration . . . . . 57
- 3.3.6 FLASH program and erase operations . . . . . 58
- 3.3.7 FLASH Main memory erase sequences . . . . . 58
- 3.3.8 FLASH Main memory programming sequences . . . . . 59
- 3.3.9 Read-while-write (RWW) function . . . . . 62
- 3.4 FLASH option bytes . . . . . 63
- 3.4.1 FLASH option byte description . . . . . 63
- 3.4.2 FLASH option byte programming . . . . . 68
- 3.5 FLASH memory protection . . . . . 69
- 3.5.1 FLASH read protection (RDP) . . . . . 69
| 3.5.2 | FLASH write protection (WRP) ..... | 72 |
| 3.6 | FLASH interrupts ..... | 73 |
| 3.7 | FLASH registers ..... | 74 |
| 3.7.1 | FLASH access control register (FLASH_ACR) ..... | 74 |
| 3.7.2 | FLASH key register (FLASH_KEYR) ..... | 75 |
| 3.7.3 | FLASH option key register (FLASH_OPTKEYR) ..... | 75 |
| 3.7.4 | FLASH status register (FLASH_SR) ..... | 75 |
| 3.7.5 | FLASH control register (FLASH_CR) ..... | 77 |
| 3.7.6 | FLASH ECC register (FLASH_ECCR) ..... | 79 |
| 3.7.7 | FLASH ECC register 2 (FLASH_ECCR2) ..... | 80 |
| 3.7.8 | FLASH option register (FLASH_OPTR) ..... | 80 |
| 3.7.9 | FLASH WRP area A address register (FLASH_WRP1AR) ..... | 82 |
| 3.7.10 | FLASH WRP area B address register (FLASH_WRP1BR) ..... | 82 |
| 3.7.11 | FLASH WRP2 area A address register (FLASH_WRP2AR) ..... | 83 |
| 3.7.12 | FLASH WRP2 area B address register (FLASH_WRP2BR) ..... | 84 |
| 3.7.13 | FLASH register map ..... | 85 |
| 4 | Power control (PWR) ..... | 86 |
| 4.1 | Power supplies ..... | 86 |
| 4.1.1 | ADC reference voltage ..... | 87 |
| 4.1.2 | Battery backup of RTC domain ..... | 87 |
| 4.1.3 | Voltage regulator ..... | 89 |
| 4.1.4 | Dynamic voltage scaling management ..... | 89 |
| 4.2 | Power supply supervisor ..... | 90 |
| 4.2.1 | Power-on reset (POR) / power-down reset (PDR) ..... | 90 |
| 4.3 | Low-power modes ..... | 91 |
| 4.3.1 | Run mode ..... | 95 |
| 4.3.2 | Low-power run mode (LP run) ..... | 95 |
| 4.3.3 | Low-power modes ..... | 96 |
| 4.3.4 | Sleep mode ..... | 97 |
| 4.3.5 | Low-power sleep mode (LP sleep) ..... | 98 |
| 4.3.6 | Stop 0 mode ..... | 99 |
| 4.3.7 | Stop 1 mode ..... | 101 |
| 4.3.8 | Standby mode ..... | 102 |
| 4.3.9 | Auto-wakeup from low-power mode ..... | 103 |
| 4.4 | PWR registers ..... | 104 |
| 4.4.1 | Power control register 1 (PWR_CR1) . . . . . | 104 |
| 4.4.2 | Power control register 2 (PWR_CR2) . . . . . | 105 |
| 4.4.3 | Power control register 3 (PWR_CR3) . . . . . | 106 |
| 4.4.4 | Power control register 4 (PWR_CR4) . . . . . | 107 |
| 4.4.5 | Power status register 1 (PWR_SR1) . . . . . | 108 |
| 4.4.6 | Power status register 2 (PWR_SR2) . . . . . | 109 |
| 4.4.7 | Power status clear register (PWR_SCR) . . . . . | 110 |
| 4.4.8 | Power Port A pull-up control register (PWR_PUCRA) . . . . . | 111 |
| 4.4.9 | Power Port A pull-down control register (PWR_PDCRA) . . . . . | 111 |
| 4.4.10 | Power Port B pull-up control register (PWR_PUCRB) . . . . . | 112 |
| 4.4.11 | Power Port B pull-down control register (PWR_PDCRB) . . . . . | 112 |
| 4.4.12 | Power Port C pull-up control register (PWR_PUCRC) . . . . . | 113 |
| 4.4.13 | Power Port C pull-down control register (PWR_PDCRC) . . . . . | 113 |
| 4.4.14 | Power Port D pull-up control register (PWR_PUCRD) . . . . . | 114 |
| 4.4.15 | Power Port D pull-down control register (PWR_PDCRD) . . . . . | 114 |
| 4.4.16 | Power Port E pull-up control register (PWR_PUCRE) . . . . . | 115 |
| 4.4.17 | Power Port E pull-down control register (PWR_PDCRE) . . . . . | 115 |
| 4.4.18 | Power Port F pull-up control register (PWR_PUCRF) . . . . . | 115 |
| 4.4.19 | Power Port F pull-down control register (PWR_PDCRF) . . . . . | 116 |
| 4.4.20 | PWR register map . . . . . | 117 |
| 5 | Reset and clock control (RCC) . . . . . | 119 |
| 5.1 | Reset . . . . . | 119 |
| 5.1.1 | Power reset . . . . . | 119 |
| 5.1.2 | System reset . . . . . | 119 |
| 5.1.3 | RTC domain reset . . . . . | 121 |
| 5.2 | Clocks . . . . . | 121 |
| 5.2.1 | HSE clock . . . . . | 125 |
| 5.2.2 | HSI16 clock . . . . . | 126 |
| 5.2.3 | PLL . . . . . | 127 |
| 5.2.4 | LSE clock . . . . . | 127 |
| 5.2.5 | LSI clock . . . . . | 128 |
| 5.2.6 | System clock (SYSCLK) selection . . . . . | 128 |
| 5.2.7 | Clock source frequency versus voltage scaling . . . . . | 128 |
| 5.2.8 | Clock security system (CSS) . . . . . | 129 |
| 5.2.9 | Clock security system for LSE clock (LSECSS) . . . . . | 129 |
| 5.2.10 | ADC clock . . . . . | 130 |
| 5.2.11 | RTC clock . . . . . | 130 |
| 5.2.12 | Timer clock . . . . . | 130 |
| 5.2.13 | Watchdog clock . . . . . | 130 |
| 5.2.14 | Clock-out capability . . . . . | 131 |
| 5.2.15 | Internal/external clock measurement with TIM14/TIM16/TIM17 . . . . . | 131 |
| 5.2.16 | Peripheral clock enable registers . . . . . | 134 |
| 5.3 | Low-power modes . . . . . | 134 |
| 5.4 | RCC registers . . . . . | 135 |
| 5.4.1 | Clock control register (RCC_CR) . . . . . | 135 |
| 5.4.2 | Internal clock source calibration register (RCC_ICSCR) . . . . . | 136 |
| 5.4.3 | Clock configuration register (RCC_CFGR) . . . . . | 137 |
| 5.4.4 | PLL configuration register (RCC_PLLCFGR) . . . . . | 140 |
| 5.4.5 | Clock interrupt enable register (RCC_CIER) . . . . . | 143 |
| 5.4.6 | Clock interrupt flag register (RCC_CIFR) . . . . . | 143 |
| 5.4.7 | Clock interrupt clear register (RCC_CICR) . . . . . | 145 |
| 5.4.8 | I/O port reset register (RCC_IOPRSTR) . . . . . | 146 |
| 5.4.9 | AHB peripheral reset register (RCC_AHBRSTR) . . . . . | 147 |
| 5.4.10 | APB peripheral reset register 1 (RCC_APBSTR1) . . . . . | 148 |
| 5.4.11 | APB peripheral reset register 2 (RCC_APBSTR2) . . . . . | 150 |
| 5.4.12 | I/O port clock enable register (RCC_IOPENR) . . . . . | 151 |
| 5.4.13 | AHB peripheral clock enable register (RCC_AHBENR) . . . . . | 152 |
| 5.4.14 | APB peripheral clock enable register 1 (RCC_APBENR1) . . . . . | 153 |
| 5.4.15 | APB peripheral clock enable register 2(RCC_APBENR2) . . . . . | 155 |
| 5.4.16 | I/O port in Sleep mode clock enable register (RCC_IOPSMENR) . . . . . | 157 |
| 5.4.17 | AHB peripheral clock enable in Sleep/Stop mode register (RCC_AHBSMENR) . . . . . | 158 |
| 5.4.18 | APB peripheral clock enable in Sleep/Stop mode register 1 (RCC_APBSMENR1) . . . . . | 159 |
| 5.4.19 | APB peripheral clock enable in Sleep/Stop mode register 2 (RCC_APBSMENR2) . . . . . | 161 |
| 5.4.20 | Peripherals independent clock configuration register (RCC_CCIPR) . . . . . | 163 |
| 5.4.21 | Peripherals independent clock configuration register 2 (RCC_CCIPR2) . . . . . | 164 |
| 5.4.22 | RTC domain control register (RCC_BDCR) . . . . . | 165 |
| 5.4.23 | Control/status register (RCC_CSR) . . . . . | 167 |
| 5.4.24 | RCC register map . . . . . | 169 |
| 6 | General-purpose I/Os (GPIO) . . . . . | 173 |
| 6.1 | Introduction ..... | 173 |
| 6.2 | GPIO main features ..... | 173 |
| 6.3 | GPIO functional description ..... | 173 |
| 6.3.1 | General-purpose I/O (GPIO) ..... | 175 |
| 6.3.2 | I/O pin alternate function multiplexer and mapping ..... | 175 |
| 6.3.3 | I/O port control registers ..... | 176 |
| 6.3.4 | I/O port data registers ..... | 176 |
| 6.3.5 | I/O data bitwise handling ..... | 177 |
| 6.3.6 | GPIO locking mechanism ..... | 177 |
| 6.3.7 | I/O alternate function input/output ..... | 177 |
| 6.3.8 | External interrupt/wakeup lines ..... | 178 |
| 6.3.9 | Input configuration ..... | 178 |
| 6.3.10 | Output configuration ..... | 179 |
| 6.3.11 | Alternate function configuration ..... | 179 |
| 6.3.12 | Analog configuration ..... | 180 |
| 6.3.13 | Using the HSE or LSE oscillator pins as GPIOs ..... | 181 |
| 6.3.14 | Using the GPIO pins in the RTC domain ..... | 181 |
| 6.4 | GPIO registers ..... | 182 |
| 6.4.1 | GPIO port mode register (GPIOx_MODER) (x =A to F) ..... | 182 |
| 6.4.2 | GPIO port output type register (GPIOx_OTYPER) (x = A to F) ..... | 182 |
| 6.4.3 | GPIO port output speed register (GPIOx_OSPEEDR) (x = A to F) ..... | 183 |
| 6.4.4 | GPIO port pull-up/pull-down register (GPIOx_PUPDR) (x = A to F) ..... | 183 |
| 6.4.5 | GPIO port input data register (GPIOx_IDR) (x = A to F) ..... | 184 |
| 6.4.6 | GPIO port output data register (GPIOx_ODR) (x = A to F) ..... | 184 |
| 6.4.7 | GPIO port bit set/reset register (GPIOx_BSRR) (x = A to F) ..... | 184 |
| 6.4.8 | GPIO port configuration lock register (GPIOx_LCKR) (x = A to F) ..... | 185 |
| 6.4.9 | GPIO alternate function low register (GPIOx_AFRL) (x = A to F) ..... | 186 |
| 6.4.10 | GPIO alternate function high register (GPIOx_AFRH) (x = A to F) ..... | 187 |
| 6.4.11 | GPIO port bit reset register (GPIOx_BRR) (x = A to F) ..... | 187 |
| 6.4.12 | GPIO register map ..... | 188 |
| 7 | System configuration controller (SYSCFG) . . . . . | 189 |
| 7.1 | SYSCFG registers . . . . . | 189 |
| 7.1.1 | SYSCFG configuration register 1 (SYSCFG_CFGR1) . . . . . | 189 |
| 7.1.2 | SYSCFG configuration register 2 (SYSCFG_CFGR2) . . . . . | 192 |
| 7.1.3 | SYSCFG interrupt line 0 status register (SYSCFG_ITLINE0) . . . . . | 194 |
| 7.1.4 | SYSCFG interrupt line 2 status register (SYSCFG_ITLINE2) . . . . . | 194 |
| 7.1.5 | SYSCFG interrupt line 3 status register (SYSCFG_ITLINE3) . . . . . | 195 |
| 7.1.6 | SYSCFG interrupt line 4 status register (SYSCFG_ITLINE4) . . . . . | 195 |
| 7.1.7 | SYSCFG interrupt line 5 status register (SYSCFG_ITLINE5) . . . . . | 196 |
| 7.1.8 | SYSCFG interrupt line 6 status register (SYSCFG_ITLINE6) . . . . . | 196 |
| 7.1.9 | SYSCFG interrupt line 7 status register (SYSCFG_ITLINE7) . . . . . | 196 |
| 7.1.10 | SYSCFG interrupt line 8 status register (SYSCFG_ITLINE8) . . . . . | 197 |
| 7.1.11 | SYSCFG interrupt line 9 status register (SYSCFG_ITLINE9) . . . . . | 197 |
| 7.1.12 | SYSCFG interrupt line 10 status register (SYSCFG_ITLINE10) . . . . . | 198 |
| 7.1.13 | SYSCFG interrupt line 11 status register (SYSCFG_ITLINE11) . . . . . | 198 |
| 7.1.14 | SYSCFG interrupt line 12 status register (SYSCFG_ITLINE12) . . . . . | 199 |
| 7.1.15 | SYSCFG interrupt line 13 status register (SYSCFG_ITLINE13) . . . . . | 199 |
| 7.1.16 | SYSCFG interrupt line 14 status register (SYSCFG_ITLINE14) . . . . . | 199 |
| 7.1.17 | SYSCFG interrupt line 16 status register (SYSCFG_ITLINE16) . . . . . | 200 |
| 7.1.18 | SYSCFG interrupt line 17 status register (SYSCFG_ITLINE17) . . . . . | 200 |
| 7.1.19 | SYSCFG interrupt line 18 status register (SYSCFG_ITLINE18) . . . . . | 200 |
| 7.1.20 | SYSCFG interrupt line 19 status register (SYSCFG_ITLINE19) . . . . . | 201 |
| 7.1.21 | SYSCFG interrupt line 20 status register (SYSCFG_ITLINE20) . . . . . | 201 |
| 7.1.22 | SYSCFG interrupt line 21 status register (SYSCFG_ITLINE21) . . . . . | 201 |
| 7.1.23 | SYSCFG interrupt line 22 status register (SYSCFG_ITLINE22) . . . . . | 202 |
| 7.1.24 | SYSCFG interrupt line 23 status register (SYSCFG_ITLINE23) . . . . . | 202 |
| 7.1.25 | SYSCFG interrupt line 24 status register (SYSCFG_ITLINE24) . . . . . | 202 |
| 7.1.26 | SYSCFG interrupt line 25 status register (SYSCFG_ITLINE25) . . . . . | 203 |
| 7.1.27 | SYSCFG interrupt line 26 status register (SYSCFG_ITLINE26) . . . . . | 203 |
| 7.1.28 | SYSCFG interrupt line 27 status register (SYSCFG_ITLINE27) . . . . . | 204 |
| 7.1.29 | SYSCFG interrupt line 28 status register (SYSCFG_ITLINE28) . . . . . | 204 |
| 7.1.30 | SYSCFG interrupt line 29 status register (SYSCFG_ITLINE29) . . . . . | 204 |
| 7.1.31 | SYSCFG register map . . . . . | 205 |
| 8 | Interconnect matrix . . . . . | 208 |
| 8.1 | Introduction . . . . . | 208 |
| 8.2 | Connection summary . . . . . | 208 |
| 8.3 | Interconnection details . . . . . | 209 |
| 8.3.1 | From TIM1, TIM3, TIM4, TIM15, TIM16, and TIM17, to TIM1, TIM3, TIM4, and TIM15 . . . . . | 209 |
| 8.3.2 | From TIM1, TIM3, TIM4, TIM6, TIM15, and EXTI, to ADC . . . . . | 210 |
| 8.3.3 | From ADC to TIM1 . . . . . | 210 |
| 8.3.4 | From HSE, LSE, LSI, MCO, MCO2, RTC and TAMP, to TIM14, TIM16, and TIM17 . . . . . | 211 |
| 8.3.5 | From internal analog sources to ADC | 211 |
| 8.3.6 | From system errors to TIM1, TIM3, TIM4, TIM15, TIM16, and TIM17 . . . . . | 211 |
| 8.3.7 | From TIM16, TIM17, USART1, and USART4, to IRTIM . . . . . | 212 |
| 8.3.8 | From TIM14 to DMAMUX . . . . . | 212 |
| 9 | Direct memory access controller (DMA) . . . . . | 213 |
| 9.1 | Introduction . . . . . | 213 |
| 9.2 | DMA main features . . . . . | 213 |
| 9.3 | DMA implementation . . . . . | 214 |
| 9.3.1 | DMA . . . . . | 214 |
| 9.3.2 | DMA request mapping . . . . . | 214 |
| 9.4 | DMA functional description . . . . . | 214 |
| 9.4.1 | DMA block diagram . . . . . | 214 |
| 9.4.2 | DMA pins and internal signals . . . . . | 215 |
| 9.4.3 | DMA transfers . . . . . | 215 |
| 9.4.4 | DMA arbitration . . . . . | 216 |
| 9.4.5 | DMA channels . . . . . | 217 |
| 9.4.6 | DMA data width, alignment and endianness . . . . . | 220 |
| 9.4.7 | DMA error management . . . . . | 222 |
| 9.5 | DMA interrupts . . . . . | 222 |
| 9.6 | DMA registers . . . . . | 222 |
| 9.6.1 | DMA interrupt status register (DMA_ISR) . . . . . | 223 |
| 9.6.2 | DMA interrupt flag clear register (DMA_IFCR) . . . . . | 225 |
| 9.6.3 | DMA channel x configuration register (DMA_CCRx) . . . . . | 226 |
| 9.6.4 | DMA channel x number of data to transfer register (DMA_CNDTRx) . . . . . | 229 |
| 9.6.5 | DMA channel x peripheral address register (DMA_CPARx) . . . . . | 230 |
| 9.6.6 | DMA channel x memory address register (DMA_CMARx) . . . . . | 230 |
| 9.6.7 | DMA register map ..... | 231 |
| 10 | DMA request multiplexer (DMAMUX) ..... | 234 |
| 10.1 | Introduction ..... | 234 |
| 10.2 | DMAMUX main features ..... | 235 |
| 10.3 | DMAMUX implementation ..... | 235 |
| 10.3.1 | DMAMUX instantiation ..... | 235 |
| 10.3.2 | DMAMUX mapping ..... | 235 |
| 10.4 | DMAMUX functional description ..... | 238 |
| 10.4.1 | DMAMUX block diagram ..... | 238 |
| 10.4.2 | DMAMUX signals ..... | 239 |
| 10.4.3 | DMAMUX channels ..... | 239 |
| 10.4.4 | DMAMUX request line multiplexer ..... | 239 |
| 10.4.5 | DMAMUX request generator ..... | 242 |
| 10.5 | DMAMUX interrupts ..... | 243 |
| 10.6 | DMAMUX registers ..... | 244 |
| 10.6.1 | DMAMUX request line multiplexer channel x configuration register (DMAMUX_CxCR) ..... | 244 |
| 10.6.2 | DMAMUX request line multiplexer interrupt channel status register (DMAMUX_CSR) ..... | 245 |
| 10.6.3 | DMAMUX request line multiplexer interrupt clear flag register (DMAMUX_CFR) ..... | 245 |
| 10.6.4 | DMAMUX request generator channel x configuration register (DMAMUX_RGxCR) ..... | 246 |
| 10.6.5 | DMAMUX request generator interrupt status register (DMAMUX_RGS) ..... | 247 |
| 10.6.6 | DMAMUX request generator interrupt clear flag register (DMAMUX_RGCFR) ..... | 247 |
| 10.6.7 | DMAMUX register map ..... | 248 |
| 11 | Nested vectored interrupt controller (NVIC) ..... | 250 |
| 11.1 | Main features ..... | 250 |
| 11.2 | SysTick calibration value register ..... | 250 |
| 11.3 | Interrupt and exception vectors ..... | 250 |
| 12 | Extended interrupt and event controller (EXTI) ..... | 253 |
| 12.1 | EXTI main features ..... | 253 |
| 12.2 | EXTI block diagram ..... | 253 |
| 12.2.1 | EXTI connections between peripherals and CPU . . . . . | 255 |
| 12.3 | EXTI functional description . . . . . | 255 |
| 12.3.1 | EXTI configurable event input wakeup . . . . . | 256 |
| 12.3.2 | EXTI direct event input wakeup . . . . . | 256 |
| 12.3.3 | EXTI mux . . . . . | 257 |
| 12.4 | EXTI functional behavior . . . . . | 258 |
| 12.5 | EXTI registers . . . . . | 259 |
| 12.5.1 | EXTI rising trigger selection register (EXTI_RTSR1) . . . . . | 259 |
| 12.5.2 | EXTI falling trigger selection register 1 (EXTI_FTSR1) . . . . . | 260 |
| 12.5.3 | EXTI software interrupt event register 1 (EXTI_SWIER1) . . . . . | 260 |
| 12.5.4 | EXTI rising edge pending register 1 (EXTI_RPR1) . . . . . | 261 |
| 12.5.5 | EXTI falling edge pending register 1 (EXTI_FPR1) . . . . . | 261 |
| 12.5.6 | EXTI external interrupt selection register (EXTI_EXTICRx) . . . . . | 262 |
| 12.5.7 | EXTI CPU wakeup with interrupt mask register (EXTI_IMR1) . . . . . | 263 |
| 12.5.8 | EXTI CPU wakeup with event mask register (EXTI_EMR1) . . . . . | 264 |
| 12.5.9 | EXTI register map . . . . . | 265 |
| 13 | Cyclic redundancy check calculation unit (CRC) . . . . . | 267 |
| 13.1 | Introduction . . . . . | 267 |
| 13.2 | CRC main features . . . . . | 267 |
| 13.3 | CRC functional description . . . . . | 268 |
| 13.3.1 | CRC block diagram . . . . . | 268 |
| 13.3.2 | CRC internal signals . . . . . | 268 |
| 13.3.3 | CRC operation . . . . . | 268 |
| 13.4 | CRC registers . . . . . | 270 |
| 13.4.1 | CRC data register (CRC_DR) . . . . . | 270 |
| 13.4.2 | CRC independent data register (CRC_IDR) . . . . . | 270 |
| 13.4.3 | CRC control register (CRC_CR) . . . . . | 271 |
| 13.4.4 | CRC initial value (CRC_INIT) . . . . . | 272 |
| 13.4.5 | CRC polynomial (CRC_POL) . . . . . | 272 |
| 13.4.6 | CRC register map . . . . . | 273 |
| 14 | Analog-to-digital converter (ADC) . . . . . | 274 |
| 14.1 | Introduction . . . . . | 274 |
| 14.2 | ADC main features . . . . . | 275 |
| 14.3 | ADC functional description . . . . . | 276 |
| 14.3.1 | ADC pins and internal signals . . . . . | 276 |
| 14.3.2 | ADC voltage regulator (ADVREGEN) . . . . . | 277 |
| 14.3.3 | Calibration (ADCAL) . . . . . | 278 |
| 14.3.4 | ADC on-off control (ADEN, ADDIS, ADRDY) . . . . . | 279 |
| 14.3.5 | ADC clock (CKMODE, PRESC[3:0]) . . . . . | 281 |
| 14.3.6 | ADC connectivity . . . . . | 283 |
| 14.3.7 | Configuring the ADC . . . . . | 284 |
| 14.3.8 | Channel selection (CHSEL, SCANDIR, CHSELRMOD) . . . . . | 284 |
| 14.3.9 | Programmable sampling time (SMPx[2:0]) . . . . . | 285 |
| 14.3.10 | Single conversion mode (CONT = 0) . . . . . | 286 |
| 14.3.11 | Continuous conversion mode (CONT = 1) . . . . . | 286 |
| 14.3.12 | Starting conversions (ADSTART) . . . . . | 287 |
| 14.3.13 | Timings . . . . . | 288 |
| 14.3.14 | Stopping an ongoing conversion (ADSTP) . . . . . | 289 |
| 14.4 | Conversion on external trigger and trigger polarity (EXTSEL, EXTEN) . . . . . | 289 |
| 14.4.1 | Discontinuous mode (DISCEN) . . . . . | 290 |
| 14.4.2 | Programmable resolution (RES) - Fast conversion mode . . . . . | 290 |
| 14.4.3 | End of conversion, end of sampling phase (EOC, EOSMP flags) . . . . . | 291 |
| 14.4.4 | End of conversion sequence (EOS flag) . . . . . | 291 |
| 14.4.5 | Example timing diagrams (single/continuous modes hardware/software triggers) . . . . . | 292 |
| 14.4.6 | Low frequency trigger mode . . . . . | 294 |
| 14.5 | Data management . . . . . | 294 |
| 14.5.1 | Data register and data alignment (ADC_DR, ALIGN) . . . . . | 294 |
| 14.5.2 | ADC overrun (OVR, OVRMOD) . . . . . | 294 |
| 14.5.3 | Managing a sequence of data converted without using the DMA . . . . . | 296 |
| 14.5.4 | Managing converted data without using the DMA without overrun . . . . . | 296 |
| 14.5.5 | Managing converted data using the DMA . . . . . | 296 |
| 14.6 | Low-power features . . . . . | 297 |
| 14.6.1 | Wait mode conversion . . . . . | 297 |
| 14.6.2 | Auto-off mode (AUTOFF) . . . . . | 298 |
| 14.7 | Analog window watchdog (AWD1EN, AWD1SGL, AWD1CH, ADC_AWDxCR, ADC_AWDxTR) . . . . . | 300 |
| 14.7.1 | Description of analog watchdog 1 . . . . . | 300 |
| 14.7.2 | Description of analog watchdog 2 and 3 . . . . . | 301 |
| 14.7.3 | ADC_AWDx_OUT output signal generation . . . . . | 301 |
| 14.7.4 | Analog Watchdog threshold control . . . . . | 303 |
| 14.8 | Oversampler . . . . . | 304 |
| 14.8.1 | ADC operating modes supported when oversampling . . . . . | 306 |
| 14.8.2 | Analog watchdog . . . . . | 306 |
| 14.8.3 | Triggered mode . . . . . | 306 |
| 14.9 | Temperature sensor and internal reference voltage . . . . . | 307 |
| 14.10 | Battery voltage monitoring . . . . . | 309 |
| 14.11 | ADC interrupts . . . . . | 310 |
| 14.12 | ADC registers . . . . . | 312 |
| 14.12.1 | ADC interrupt and status register (ADC_ISR) . . . . . | 312 |
| 14.12.2 | ADC interrupt enable register (ADC_IER) . . . . . | 314 |
| 14.12.3 | ADC control register (ADC_CR) . . . . . | 316 |
| 14.12.4 | ADC configuration register 1 (ADC_CFGR1) . . . . . | 318 |
| 14.12.5 | ADC configuration register 2 (ADC_CFGR2) . . . . . | 322 |
| 14.12.6 | ADC sampling time register (ADC_SMPR) . . . . . | 323 |
| 14.12.7 | ADC watchdog threshold register (ADC_AWD1TR) . . . . . | 324 |
| 14.12.8 | ADC watchdog threshold register (ADC_AWD2TR) . . . . . | 325 |
| 14.12.9 | ADC channel selection register [alternate] (ADC_CHSELR) . . . . . | 326 |
| 14.12.10 | ADC channel selection register [alternate] (ADC_CHSELR) . . . . . | 327 |
| 14.12.11 | ADC watchdog threshold register (ADC_AWD3TR) . . . . . | 329 |
| 14.12.12 | ADC data register (ADC_DR) . . . . . | 329 |
| 14.12.13 | ADC Analog Watchdog 2 Configuration register (ADC_AWD2CR) . . . . . | 330 |
| 14.12.14 | ADC Analog Watchdog 3 Configuration register (ADC_AWD3CR) . . . . . | 330 |
| 14.12.15 | ADC Calibration factor (ADC_CALFACT) . . . . . | 331 |
| 14.12.16 | ADC common configuration register (ADC_CCR) . . . . . | 331 |
| 14.13 | ADC register map . . . . . | 333 |
| 15 | Advanced-control timer (TIM1) . . . . . | 335 |
| 15.1 | TIM1 introduction . . . . . | 335 |
| 15.2 | TIM1 main features . . . . . | 336 |
| 15.3 | TIM1 functional description . . . . . | 338 |
| 15.3.1 | Time-base unit . . . . . | 338 |
| 15.3.2 | Counter modes . . . . . | 340 |
| 15.3.3 | Repetition counter . . . . . | 351 |
| 15.3.4 | External trigger input . . . . . | 353 |
| 15.3.5 | Clock selection . . . . . | 354 |
| 15.3.6 | Capture/compare channels . . . . . | 358 |
| 15.3.7 | Input capture mode . . . . . | 360 |
| 15.3.8 | PWM input mode . . . . . | 361 |
| 15.3.9 | Forced output mode . . . . . | 362 |
| 15.3.10 | Output compare mode . . . . . | 363 |
| 15.3.11 | PWM mode . . . . . | 364 |
| 15.3.12 | Asymmetric PWM mode . . . . . | 367 |
| 15.3.13 | Combined PWM mode . . . . . | 368 |
| 15.3.14 | Combined 3-phase PWM mode . . . . . | 369 |
| 15.3.15 | Complementary outputs and dead-time insertion . . . . . | 370 |
| 15.3.16 | Using the break function . . . . . | 372 |
| 15.3.17 | Bidirectional break inputs . . . . . | 378 |
| 15.3.18 | Clearing the OCxREF signal on an external event . . . . . | 380 |
| 15.3.19 | 6-step PWM generation . . . . . | 381 |
| 15.3.20 | One-pulse mode . . . . . | 382 |
| 15.3.21 | Retriggerable one pulse mode . . . . . | 383 |
| 15.3.22 | Encoder interface mode . . . . . | 384 |
| 15.3.23 | UIF bit remapping . . . . . | 386 |
| 15.3.24 | Timer input XOR function . . . . . | 387 |
| 15.3.25 | Interfacing with Hall sensors . . . . . | 387 |
| 15.3.26 | Timer synchronization . . . . . | 390 |
| 15.3.27 | ADC synchronization . . . . . | 394 |
| 15.3.28 | DMA burst mode . . . . . | 394 |
| 15.3.29 | Debug mode . . . . . | 395 |
| 15.4 | TIM1 registers . . . . . | 396 |
| 15.4.1 | TIM1 control register 1 (TIM1_CR1) . . . . . | 396 |
| 15.4.2 | TIM1 control register 2 (TIM1_CR2) . . . . . | 397 |
| 15.4.3 | TIM1 slave mode control register (TIM1_SMCR) . . . . . | 400 |
| 15.4.4 | TIM1 DMA/interrupt enable register (TIM1_DIER) . . . . . | 402 |
| 15.4.5 | TIM1 status register (TIM1_SR) . . . . . | 404 |
| 15.4.6 | TIM1 event generation register (TIM1_EGR) . . . . . | 406 |
| 15.4.7 | TIM1 capture/compare mode register 1 [alternate] (TIM1_CCMR1) . . . . . | 407 |
| 15.4.8 | TIM1 capture/compare mode register 1 [alternate] (TIM1_CCMR1) . . . . . | 408 |
| 15.4.9 | TIM1 capture/compare mode register 2 [alternate] (TIM1_CCMR2) . . . . . | 411 |
| 15.4.10 | TIM1 capture/compare mode register 2 [alternate] (TIM1_CCMR2) . . . . . | 412 |
| 15.4.11 | TIM1 capture/compare enable register (TIM1_CCER) . . . . . | 414 |
| 15.4.12 | TIM1 counter (TIM1_CNT) . . . . . | 417 |
| 15.4.13 | TIM1 prescaler (TIM1_PSC) . . . . . | 417 |
| 15.4.14 | TIM1 auto-reload register (TIM1_ARR) . . . . . | 417 |
| 15.4.15 | TIM1 repetition counter register (TIM1_RCR) . . . . . | 418 |
| 15.4.16 | TIM1 capture/compare register 1 (TIM1_CCR1) . . . . . | 418 |
| 15.4.17 | TIM1 capture/compare register 2 (TIM1_CCR2) . . . . . | 419 |
| 15.4.18 | TIM1 capture/compare register 3 (TIM1_CCR3) . . . . . | 419 |
| 15.4.19 | TIM1 capture/compare register 4 (TIM1_CCR4) . . . . . | 420 |
| 15.4.20 | TIM1 break and dead-time register (TIM1_BDTR) . . . . . | 420 |
| 15.4.21 | TIM1 DMA control register (TIM1_DCR) . . . . . | 424 |
| 15.4.22 | TIM1 DMA address for full transfer (TIM1_DMAR) . . . . . | 425 |
| 15.4.23 | TIM1 capture/compare mode register 3 (TIM1_CCMR3) . . . . . | 426 |
| 15.4.24 | TIM1 capture/compare register 5 (TIM1_CCR5) . . . . . | 427 |
| 15.4.25 | TIM1 capture/compare register 6 (TIM1_CCR6) . . . . . | 428 |
| 15.4.26 | TIM1 alternate function option register 1 (TIM1_AF1) . . . . . | 428 |
| 15.4.27 | TIM1 Alternate function register 2 (TIM1_AF2) . . . . . | 429 |
| 15.4.28 | TIM1 timer input selection register (TIM1_TISEL) . . . . . | 430 |
| 15.4.29 | TIM1 register map . . . . . | 431 |
| 16 | General-purpose timers (TIM3/TIM4) . . . . . | 434 |
| 16.1 | TIM3/TIM4 introduction . . . . . | 434 |
| 16.2 | TIM3/TIM4 main features . . . . . | 434 |
| 16.3 | TIM3/TIM4 functional description . . . . . | 436 |
| 16.3.1 | Time-base unit . . . . . | 436 |
| 16.3.2 | Counter modes . . . . . | 438 |
| 16.3.3 | Clock selection . . . . . | 448 |
| 16.3.4 | Capture/Compare channels . . . . . | 452 |
| 16.3.5 | Input capture mode . . . . . | 454 |
| 16.3.6 | PWM input mode . . . . . | 455 |
| 16.3.7 | Forced output mode . . . . . | 456 |
| 16.3.8 | Output compare mode . . . . . | 456 |
| 16.3.9 | PWM mode . . . . . | 457 |
| 16.3.10 | Asymmetric PWM mode . . . . . | 461 |
| 16.3.11 | Combined PWM mode . . . . . | 461 |
| 16.3.12 | Clearing the OCxREF signal on an external event . . . . . | 462 |
| 16.3.13 | One-pulse mode . . . . . | 464 |
| 16.3.14 | Retriggerable one pulse mode . . . . . | 465 |
| 16.3.15 | Encoder interface mode . . . . . | 466 |
| 16.3.16 | UIF bit remapping . . . . . | 468 |
| 16.3.17 | Timer input XOR function . . . . . | 468 |
| 16.3.18 | Timers and external trigger synchronization . . . . . | 469 |
| 16.3.19 | Timer synchronization . . . . . | 472 |
| 16.3.20 | DMA burst mode . . . . . | 477 |
| 16.3.21 | Debug mode . . . . . | 478 |
| 16.4 | TIM3/TIM4 registers . . . . . | 479 |
| 16.4.1 | TIMx control register 1 (TIMx_CR1)(x = 3 to 4) . . . . . | 479 |
| 16.4.2 | TIMx control register 2 (TIMx_CR2)(x = 3 to 4) . . . . . | 480 |
| 16.4.3 | TIMx slave mode control register (TIMx_SMCR)(x = 3 to 4) . . . . . | 482 |
| 16.4.4 | TIMx DMA/Interrupt enable register (TIMx_DIER)(x = 3 to 4) . . . . . | 485 |
| 16.4.5 | TIMx status register (TIMx_SR)(x = 3 to 4) . . . . . | 486 |
| 16.4.6 | TIMx event generation register (TIMx_EGR)(x = 3 to 4) . . . . . | 488 |
| 16.4.7 | TIMx capture/compare mode register 1 [alternate] (TIMx_CCMR1) (x = 3 to 4) . . . . . | 489 |
| 16.4.8 | TIMx capture/compare mode register 1 [alternate] (TIMx_CCMR1) (x = 3 to 4) . . . . . | 491 |
| 16.4.9 | TIMx capture/compare mode register 2 [alternate] (TIMx_CCMR2) (x = 3 to 4) . . . . . | 493 |
| 16.4.10 | TIMx capture/compare mode register 2 [alternate] (TIMx_CCMR2) (x = 3 to 4) . . . . . | 494 |
| 16.4.11 | TIMx capture/compare enable register (TIMx_CCER)(x = 3 to 4) . . . . . | 495 |
| 16.4.12 | TIMx counter [alternate] (TIMx_CNT)(x = 3 to 4) . . . . . | 496 |
| 16.4.13 | TIMx counter [alternate] (TIMx_CNT)(x = 3 to 4) . . . . . | 497 |
| 16.4.14 | TIMx prescaler (TIMx_PSC)(x = 3 to 4) . . . . . | 497 |
| 16.4.15 | TIMx auto-reload register (TIMx_ARR)(x = 3 to 4) . . . . . | 498 |
| 16.4.16 | TIMx capture/compare register 1 (TIMx_CCR1)(x = 3 to 4) . . . . . | 498 |
| 16.4.17 | TIMx capture/compare register 2 (TIMx_CCR2)(x = 3 to 4) . . . . . | 499 |
| 16.4.18 | TIMx capture/compare register 3 (TIMx_CCR3)(x = 3 to 4) . . . . . | 499 |
| 16.4.19 | TIMx capture/compare register 4 (TIMx_CCR4)(x = 3 to 4) . . . . . | 500 |
| 16.4.20 | TIMx DMA control register (TIMx_DCR)(x = 3 to 4) . . . . . | 501 |
| 16.4.21 | TIMx DMA address for full transfer (TIMx_DMAR)(x = 3 to 4) . . . . . | 501 |
| 16.4.22 | TIM3 alternate function option register 1 (TIM3_AF1) . . . . . | 502 |
| 16.4.23 | TIM4 alternate function option register 1 (TIM4_AF1) . . . . . | 502 |
| 16.4.24 | TIM3 timer input selection register (TIM3_TISEL) . . . . . | 502 |
| 16.4.25 | TIM4 timer input selection register (TIM4_TISEL) . . . . . | 503 |
| 16.4.26 | TIMx register map . . . . . | 505 |
| 17 | Basic timers (TIM6/TIM7) . . . . . | 508 |
| 17.1 | TIM6/TIM7 introduction . . . . . | 508 |
| 17.2 | TIM6/TIM7 main features . . . . . | 508 |
| 17.3 | TIM6/TIM7 functional description . . . . . | 509 |
| 17.3.1 | Time-base unit . . . . . | 509 |
| 17.3.2 | Counting mode . . . . . | 511 |
| 17.3.3 | UIF bit remapping . . . . . | 514 |
| 17.3.4 | Clock source . . . . . | 514 |
| 17.3.5 | Debug mode . . . . . | 515 |
| 17.4 | TIM6/TIM7 registers . . . . . | 515 |
| 17.4.1 | TIMx control register 1 (TIMx_CR1)(x = 6 to 7) . . . . . | 515 |
| 17.4.2 | TIMx control register 2 (TIMx_CR2)(x = 6 to 7) . . . . . | 517 |
| 17.4.3 | TIMx DMA/Interrupt enable register (TIMx_DIER)(x = 6 to 7) . . . . . | 517 |
| 17.4.4 | TIMx status register (TIMx_SR)(x = 6 to 7) . . . . . | 518 |
| 17.4.5 | TIMx event generation register (TIMx_EGR)(x = 6 to 7) . . . . . | 518 |
| 17.4.6 | TIMx counter (TIMx_CNT)(x = 6 to 7) . . . . . | 518 |
| 17.4.7 | TIMx prescaler (TIMx_PSC)(x = 6 to 7) . . . . . | 519 |
| 17.4.8 | TIMx auto-reload register (TIMx_ARR)(x = 6 to 7) . . . . . | 519 |
| 17.4.9 | TIMx register map . . . . . | 520 |
| 18 | General-purpose timers (TIM14) . . . . . | 521 |
| 18.1 | TIM14 introduction . . . . . | 521 |
| 18.2 | TIM14 main features . . . . . | 521 |
| 18.2.1 | TIM14 main features . . . . . | 521 |
| 18.3 | TIM14 functional description . . . . . | 523 |
| 18.3.1 | Time-base unit . . . . . | 523 |
| 18.3.2 | Counter modes . . . . . | 525 |
| 18.3.3 | Clock selection . . . . . | 528 |
| 18.3.4 | Capture/compare channels . . . . . | 529 |
| 18.3.5 | Input capture mode . . . . . | 530 |
| 18.3.6 | Forced output mode . . . . . | 531 |
| 18.3.7 | Output compare mode . . . . . | 532 |
| 18.3.8 | PWM mode . . . . . | 533 |
| 18.3.9 | One-pulse mode . . . . . | 534 |
| 18.3.10 | UIF bit remapping . . . . . | 534 |
| 18.3.11 | Using timer output as trigger for other timers (TIM14) . . . . . | 535 |
| 18.3.12 | Debug mode . . . . . | 535 |
| 18.4 | TIM14 registers . . . . . | 536 |
| 18.4.1 | TIM14 control register 1 (TIM14_CR1) . . . . . | 536 |
| 18.4.2 | TIM14 Interrupt enable register (TIM14_DIER) . . . . . | 537 |
| 18.4.3 | TIM14 status register (TIM14_SR) . . . . . | 537 |
| 18.4.4 | TIM14 event generation register (TIM14_EGR) . . . . . | 538 |
| 18.4.5 | TIM14 capture/compare mode register 1 [alternate] (TIM14_CCMR1) . . . . . | 539 |
| 18.4.6 | TIM14 capture/compare mode register 1 [alternate] (TIM14_CCMR1) . . . . . | 540 |
| 18.4.7 | TIM14 capture/compare enable register (TIM14_CCER) . . . . . | 542 |
| 18.4.8 | TIM14 counter (TIM14_CNT) . . . . . | 543 |
| 18.4.9 | TIM14 prescaler (TIM14_PSC) . . . . . | 544 |
| 18.4.10 | TIM14 auto-reload register (TIM14_ARR) . . . . . | 544 |
| 18.4.11 | TIM14 capture/compare register 1 (TIM14_CCR1) . . . . . | 544 |
| 18.4.12 | TIM14 timer input selection register (TIM14_TISEL) . . . . . | 545 |
| 18.4.13 | TIM14 register map . . . . . | 545 |
| 19 | General-purpose timers (TIM15/TIM16/TIM17) . . . . . | 547 |
| 19.1 | TIM15/TIM16/TIM17 introduction . . . . . | 547 |
| 19.2 | TIM15 main features . . . . . | 547 |
| 19.3 | TIM16/TIM17 main features . . . . . | 548 |
| 19.4 | TIM15/TIM16/TIM17 functional description . . . . . | 551 |
| 19.4.1 | Time-base unit . . . . . | 551 |
| 19.4.2 | Counter modes . . . . . | 553 |
| 19.4.3 | Repetition counter . . . . . | 557 |
| 19.4.4 | Clock selection . . . . . | 558 |
| 19.4.5 | Capture/compare channels . . . . . | 560 |
| 19.4.6 | Input capture mode . . . . . | 562 |
| 19.4.7 | PWM input mode (only for TIM15) . . . . . | 563 |
| 19.4.8 | Forced output mode . . . . . | 564 |
| 19.4.9 | Output compare mode . . . . . | 565 |
| 19.4.10 | PWM mode . . . . . | 566 |
| 19.4.11 | Combined PWM mode (TIM15 only) . . . . . | 567 |
| 19.4.12 | Complementary outputs and dead-time insertion . . . . . | 568 |
| 19.4.13 | Using the break function . . . . . | 570 |
| 19.4.14 | Bidirectional break inputs . . . . . | 575 |
| 19.4.15 | One-pulse mode . . . . . | 577 |
| 19.4.16 | Retriggerable one pulse mode (TIM15 only) . . . . . | 579 |
| 19.4.17 | UIF bit remapping . . . . . | 579 |
| 19.4.18 | Timer input XOR function (TIM15 only) . . . . . | 581 |
| 19.4.19 | External trigger synchronization (TIM15 only) . . . . . | 582 |
| 19.4.20 | Slave mode – combined reset + trigger mode . . . . . | 584 |
| 19.4.21 | DMA burst mode . . . . . | 584 |
| 19.4.22 | Timer synchronization (TIM15) . . . . . | 586 |
| 19.4.23 | Using timer output as trigger for other timers (TIM16/TIM17) . . . . . | 586 |
| 19.4.24 | Debug mode . . . . . | 586 |
| 19.5 | TIM15 registers . . . . . | 587 |
| 19.5.1 | TIM15 control register 1 (TIM15_CR1) . . . . . | 587 |
| 19.5.2 | TIM15 control register 2 (TIM15_CR2) . . . . . | 588 |
| 19.5.3 | TIM15 slave mode control register (TIM15_SMCR) . . . . . | 590 |
| 19.5.4 | TIM15 DMA/interrupt enable register (TIM15_DIER) . . . . . | 591 |
| 19.5.5 | TIM15 status register (TIM15_SR) . . . . . | 592 |
| 19.5.6 | TIM15 event generation register (TIM15_EGR) . . . . . | 594 |
| 19.5.7 | TIM15 capture/compare mode register 1 [alternate] (TIM15_CCMR1) . . . . . | 595 |
| 19.5.8 | TIM15 capture/compare mode register 1 [alternate] (TIM15_CCMR1) . . . . . | 596 |
| 19.5.9 | TIM15 capture/compare enable register (TIM15_CCER) . . . . . | 599 |
| 19.5.10 | TIM15 counter (TIM15_CNT) . . . . . | 602 |
| 19.5.11 | TIM15 prescaler (TIM15_PSC) . . . . . | 602 |
| 19.5.12 | TIM15 auto-reload register (TIM15_ARR) . . . . . | 602 |
| 19.5.13 | TIM15 repetition counter register (TIM15_RCR) . . . . . | 603 |
| 19.5.14 | TIM15 capture/compare register 1 (TIM15_CCR1) . . . . . | 603 |
| 19.5.15 | TIM15 capture/compare register 2 (TIM15_CCR2) . . . . . | 604 |
| 19.5.16 | TIM15 break and dead-time register (TIM15_BDTR) . . . . . | 604 |
| 19.5.17 | TIM15 DMA control register (TIM15_DCR) . . . . . | 607 |
| 19.5.18 | TIM15 DMA address for full transfer (TIM15_DMAR) . . . . . | 607 |
| 19.5.19 | TIM15 alternate register 1 (TIM15_AF1) . . . . . | 608 |
| 19.5.20 | TIM15 input selection register (TIM15_TISEL) . . . . . | 608 |
| 19.5.21 | TIM15 register map ..... | 609 |
| 19.6 | TIM16/TIM17 registers ..... | 612 |
| 19.6.1 | TIMx control register 1 (TIMx_CR1)(x = 16 to 17) ..... | 612 |
| 19.6.2 | TIMx control register 2 (TIMx_CR2)(x = 16 to 17) ..... | 613 |
| 19.6.3 | TIMx DMA/interrupt enable register (TIMx_DIER)(x = 16 to 17) ..... | 614 |
| 19.6.4 | TIMx status register (TIMx_SR)(x = 16 to 17) ..... | 615 |
| 19.6.5 | TIMx event generation register (TIMx_EGR)(x = 16 to 17) ..... | 616 |
| 19.6.6 | TIMx capture/compare mode register 1 [alternate] (TIMx_CCMR1) (x = 16 to 17) ..... | 617 |
| 19.6.7 | TIMx capture/compare mode register 1 [alternate] (TIMx_CCMR1) (x = 16 to 17) ..... | 618 |
| 19.6.8 | TIMx capture/compare enable register (TIMx_CCER)(x = 16 to 17) .. | 620 |
| 19.6.9 | TIMx counter (TIMx_CNT)(x = 16 to 17) ..... | 622 |
| 19.6.10 | TIMx prescaler (TIMx_PSC)(x = 16 to 17) ..... | 623 |
| 19.6.11 | TIMx auto-reload register (TIMx_ARR)(x = 16 to 17) ..... | 623 |
| 19.6.12 | TIMx repetition counter register (TIMx_RCR)(x = 16 to 17) ..... | 624 |
| 19.6.13 | TIMx capture/compare register 1 (TIMx_CCR1)(x = 16 to 17) ..... | 624 |
| 19.6.14 | TIMx break and dead-time register (TIMx_BDTR)(x = 16 to 17) ..... | 625 |
| 19.6.15 | TIMx DMA control register (TIMx_DCR)(x = 16 to 17) ..... | 628 |
| 19.6.16 | TIMx DMA address for full transfer (TIMx_DMAR)(x = 16 to 17) ..... | 628 |
| 19.6.17 | TIM16 alternate function register 1 (TIM16_AF1) ..... | 629 |
| 19.6.18 | TIM16 input selection register (TIM16_TISEL) ..... | 629 |
| 19.6.19 | TIM17 alternate function register 1 (TIM17_AF1) ..... | 630 |
| 19.6.20 | TIM17 input selection register (TIM17_TISEL) ..... | 630 |
| 19.6.21 | TIM16/TIM17 register map ..... | 632 |
| 20 | Infrared interface (IRTIM) ..... | 634 |
| 21 | Independent watchdog (IWDG) ..... | 635 |
| 21.1 | Introduction ..... | 635 |
| 21.2 | IWDG main features ..... | 635 |
| 21.3 | IWDG functional description ..... | 635 |
| 21.3.1 | IWDG block diagram ..... | 635 |
| 21.3.2 | Window option ..... | 636 |
| 21.3.3 | Hardware watchdog ..... | 637 |
| 21.3.4 | Register access protection ..... | 637 |
| 21.3.5 | Debug mode ..... | 637 |
- 21.4 IWDG registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
| 23.3.9 | Reading the calendar . . . . . | 660 |
| 23.3.10 | Resetting the RTC . . . . . | 661 |
| 23.3.11 | RTC synchronization . . . . . | 661 |
| 23.3.12 | RTC reference clock detection . . . . . | 662 |
| 23.3.13 | RTC smooth digital calibration . . . . . | 662 |
| 23.3.14 | Timestamp function . . . . . | 664 |
| 23.3.15 | Calibration clock output . . . . . | 665 |
| 23.3.16 | Tamper and alarm output . . . . . | 665 |
| 23.4 | RTC low-power modes . . . . . | 666 |
| 23.5 | RTC interrupts . . . . . | 666 |
| 23.6 | RTC registers . . . . . | 667 |
| 23.6.1 | RTC time register (RTC_TR) . . . . . | 667 |
| 23.6.2 | RTC date register (RTC_DR) . . . . . | 668 |
| 23.6.3 | RTC sub second register (RTC_SSR) . . . . . | 669 |
| 23.6.4 | RTC initialization control and status register (RTC_ICSR) . . . . . | 669 |
| 23.6.5 | RTC prescaler register (RTC_PRER) . . . . . | 671 |
| 23.6.6 | RTC wakeup timer register (RTC_WUTR) . . . . . | 672 |
| 23.6.7 | RTC control register (RTC_CR) . . . . . | 672 |
| 23.6.8 | RTC write protection register (RTC_WPR) . . . . . | 675 |
| 23.6.9 | RTC calibration register (RTC_CALR) . . . . . | 676 |
| 23.6.10 | RTC shift control register (RTC_SHIFTR) . . . . . | 677 |
| 23.6.11 | RTC timestamp time register (RTC_TSTR) . . . . . | 678 |
| 23.6.12 | RTC timestamp date register (RTC_TSDR) . . . . . | 678 |
| 23.6.13 | RTC timestamp sub second register (RTC_TSSSR) . . . . . | 679 |
| 23.6.14 | RTC alarm A register (RTC_ALRMAR) . . . . . | 680 |
| 23.6.15 | RTC alarm A sub second register (RTC_ALRMASSR) . . . . . | 681 |
| 23.6.16 | RTC alarm B register (RTC_ALRMBR) . . . . . | 682 |
| 23.6.17 | RTC alarm B sub second register (RTC_ALRMBSSR) . . . . . | 683 |
| 23.6.18 | RTC status register (RTC_SR) . . . . . | 683 |
| 23.6.19 | RTC masked interrupt status register (RTC_MISR) . . . . . | 684 |
| 23.6.20 | RTC status clear register (RTC_SCR) . . . . . | 685 |
| 23.6.21 | RTC register map . . . . . | 687 |
| 24 | Tamper and backup registers (TAMP) . . . . . | 689 |
| 24.1 | Introduction . . . . . | 689 |
| 24.2 | TAMP main features . . . . . | 689 |
- 24.3 TAMP functional description . . . . . 690
- 24.3.1 TAMP block diagram . . . . . 690
- 24.3.2 TAMP pins and internal signals . . . . . 691
- 24.3.3 TAMP register write protection . . . . . 691
- 24.3.4 Tamper detection . . . . . 692
- 24.4 TAMP low-power modes . . . . . 694
- 24.5 TAMP interrupts . . . . . 694
- 24.6 TAMP registers . . . . . 694
- 24.6.1 TAMP control register 1 (TAMP_CR1) . . . . . 695
- 24.6.2 TAMP control register 2 (TAMP_CR2) . . . . . 696
- 24.6.3 TAMP filter control register (TAMP_FLTCR) . . . . . 697
- 24.6.4 TAMP interrupt enable register (TAMP_IER) . . . . . 698
- 24.6.5 TAMP status register (TAMP_SR) . . . . . 699
- 24.6.6 TAMP masked interrupt status register (TAMP_MISR) . . . . . 700
- 24.6.7 TAMP status clear register (TAMP_SCR) . . . . . 701
- 24.6.8 TAMP backup x register (TAMP_BKPxR) . . . . . 702
- 24.6.9 TAMP register map . . . . . 703
- 25 Inter-integrated circuit (I2C) interface . . . . . 704
- 25.1 Introduction . . . . . 704
- 25.2 I2C main features . . . . . 704
- 25.3 I2C implementation . . . . . 705
- 25.4 I2C functional description . . . . . 705
- 25.4.1 I2C1 block diagram . . . . . 706
- 25.4.2 I2C2 block diagram . . . . . 707
- 25.4.3 I2C pins and internal signals . . . . . 708
- 25.4.4 I2C clock requirements . . . . . 708
- 25.4.5 Mode selection . . . . . 708
- 25.4.6 I2C initialization . . . . . 709
- 25.4.7 Software reset . . . . . 714
- 25.4.8 Data transfer . . . . . 715
- 25.4.9 I2C slave mode . . . . . 717
- 25.4.10 I2C master mode . . . . . 726
- 25.4.11 I2C_TIMINGR register configuration examples . . . . . 738
- 25.4.12 SMBus specific features . . . . . 739
- 25.4.13 SMBus initialization . . . . . 742
| 25.4.14 | SMBus: I2C_TIMEOUTR register configuration examples . . . . . | 744 |
| 25.4.15 | SMBus slave mode . . . . . | 745 |
| 25.4.16 | Wakeup from Stop mode on address match . . . . . | 753 |
| 25.4.17 | Error conditions . . . . . | 753 |
| 25.4.18 | DMA requests . . . . . | 755 |
| 25.4.19 | Debug mode . . . . . | 756 |
| 25.5 | I2C low-power modes . . . . . | 756 |
| 25.6 | I2C interrupts . . . . . | 757 |
| 25.7 | I2C registers . . . . . | 758 |
| 25.7.1 | I2C control register 1 (I2C_CR1) . . . . . | 758 |
| 25.7.2 | I2C control register 2 (I2C_CR2) . . . . . | 761 |
| 25.7.3 | I2C own address 1 register (I2C_OAR1) . . . . . | 764 |
| 25.7.4 | I2C own address 2 register (I2C_OAR2) . . . . . | 765 |
| 25.7.5 | I2C timing register (I2C_TIMINGR) . . . . . | 766 |
| 25.7.6 | I2C timeout register (I2C_TIMEOUTR) . . . . . | 767 |
| 25.7.7 | I2C interrupt and status register (I2C_ISR) . . . . . | 768 |
| 25.7.8 | I2C interrupt clear register (I2C_ICR) . . . . . | 770 |
| 25.7.9 | I2C PEC register (I2C_PECR) . . . . . | 771 |
| 25.7.10 | I2C receive data register (I2C_RXDR) . . . . . | 772 |
| 25.7.11 | I2C transmit data register (I2C_TXDR) . . . . . | 772 |
| 25.7.12 | I2C register map . . . . . | 773 |
| 26 | Universal synchronous receiver transmitter (USART) . . . . . | 775 |
| 26.1 | USART introduction . . . . . | 775 |
| 26.2 | USART main features . . . . . | 776 |
| 26.3 | USART extended features . . . . . | 777 |
| 26.4 | USART implementation . . . . . | 777 |
| 26.5 | USART functional description . . . . . | 779 |
| 26.5.1 | USART block diagram . . . . . | 779 |
| 26.5.2 | USART signals . . . . . | 780 |
| 26.5.3 | USART character description . . . . . | 781 |
| 26.5.4 | USART FIFOs and thresholds . . . . . | 783 |
| 26.5.5 | USART transmitter . . . . . | 783 |
| 26.5.6 | USART receiver . . . . . | 787 |
| 26.5.7 | USART baud rate generation . . . . . | 794 |
| 26.5.8 | Tolerance of the USART receiver to clock deviation . . . . . | 795 |
| 26.5.9 | USART Auto baud rate detection . . . . . | 797 |
| 26.5.10 | USART multiprocessor communication . . . . . | 799 |
| 26.5.11 | USART Modbus communication . . . . . | 801 |
| 26.5.12 | USART parity control . . . . . | 802 |
| 26.5.13 | USART LIN (local interconnection network) mode . . . . . | 803 |
| 26.5.14 | USART synchronous mode . . . . . | 805 |
| 26.5.15 | USART single-wire Half-duplex communication . . . . . | 809 |
| 26.5.16 | USART receiver timeout . . . . . | 809 |
| 26.5.17 | USART Smartcard mode . . . . . | 810 |
| 26.5.18 | USART IrDA SIR ENDEC block . . . . . | 814 |
| 26.5.19 | Continuous communication using USART and DMA . . . . . | 817 |
| 26.5.20 | RS232 Hardware flow control and RS485 Driver Enable . . . . . | 819 |
| 26.5.21 | USART low-power management . . . . . | 822 |
| 26.6 | USART in low-power modes . . . . . | 825 |
| 26.7 | USART interrupts . . . . . | 826 |
| 26.8 | USART registers . . . . . | 827 |
| 26.8.1 | USART control register 1 [alternate] (USART_CR1) . . . . . | 827 |
| 26.8.2 | USART control register 1 [alternate] (USART_CR1) . . . . . | 831 |
| 26.8.3 | USART control register 2 (USART_CR2) . . . . . | 834 |
| 26.8.4 | USART control register 3 (USART_CR3) . . . . . | 838 |
| 26.8.5 | USART baud rate register (USART_BRR) . . . . . | 843 |
| 26.8.6 | USART guard time and prescaler register (USART_GTPR) . . . . . | 843 |
| 26.8.7 | USART receiver timeout register (USART_RTOR) . . . . . | 844 |
| 26.8.8 | USART request register (USART_RQR) . . . . . | 845 |
| 26.8.9 | USART interrupt and status register [alternate] (USART_ISR) . . . . . | 846 |
| 26.8.10 | USART interrupt and status register [alternate] (USART_ISR) . . . . . | 852 |
| 26.8.11 | USART interrupt flag clear register (USART_ICR) . . . . . | 857 |
| 26.8.12 | USART receive data register (USART_RDR) . . . . . | 859 |
| 26.8.13 | USART transmit data register (USART_TDR) . . . . . | 859 |
| 26.8.14 | USART prescaler register (USART_PRESC) . . . . . | 860 |
| 26.8.15 | USART register map . . . . . | 861 |
| 27 | Serial peripheral interface / integrated interchip sound (SPI/I2S) . . . | 863 |
| 27.1 | Introduction . . . . . | 863 |
| 27.2 | SPI main features . . . . . | 863 |
| 27.3 | I2S main features . . . . . | 864 |
| 27.4 | SPI/I2S implementation . . . . . | 864 |
| 27.5 | SPI functional description . . . . . | 865 |
| 27.5.1 | General description . . . . . | 865 |
| 27.5.2 | Communications between one master and one slave . . . . . | 866 |
| 27.5.3 | Standard multi-slave communication . . . . . | 868 |
| 27.5.4 | Multi-master communication . . . . . | 869 |
| 27.5.5 | Slave select (NSS) pin management . . . . . | 870 |
| 27.5.6 | Communication formats . . . . . | 871 |
| 27.5.7 | Configuration of SPI . . . . . | 873 |
| 27.5.8 | Procedure for enabling SPI . . . . . | 874 |
| 27.5.9 | Data transmission and reception procedures . . . . . | 874 |
| 27.5.10 | SPI status flags . . . . . | 884 |
| 27.5.11 | SPI error flags . . . . . | 885 |
| 27.5.12 | NSS pulse mode . . . . . | 886 |
| 27.5.13 | TI mode . . . . . | 886 |
| 27.5.14 | CRC calculation . . . . . | 887 |
| 27.6 | SPI interrupts . . . . . | 889 |
| 27.7 | I2S functional description . . . . . | 890 |
| 27.7.1 | I2S general description . . . . . | 890 |
| 27.7.2 | Supported audio protocols . . . . . | 891 |
| 27.7.3 | Start-up description . . . . . | 898 |
| 27.7.4 | Clock generator . . . . . | 900 |
| 27.7.5 | I 2 S master mode . . . . . | 903 |
| 27.7.6 | I 2 S slave mode . . . . . | 904 |
| 27.7.7 | I2S status flags . . . . . | 906 |
| 27.7.8 | I2S error flags . . . . . | 907 |
| 27.7.9 | DMA features . . . . . | 908 |
| 27.8 | I2S interrupts . . . . . | 908 |
| 27.9 | SPI and I2S registers . . . . . | 909 |
| 27.9.1 | SPI control register 1 (SPIx_CR1) . . . . . | 909 |
| 27.9.2 | SPI control register 2 (SPIx_CR2) . . . . . | 911 |
| 27.9.3 | SPI status register (SPIx_SR) . . . . . | 913 |
| 27.9.4 | SPI data register (SPIx_DR) . . . . . | 914 |
| 27.9.5 | SPI CRC polynomial register (SPIx_CRCPR) . . . . . | 915 |
| 27.9.6 | SPI Rx CRC register (SPIx_RXCRCR) . . . . . | 915 |
| 27.9.7 | SPI Tx CRC register (SPIx_TXCRCR) . . . . . | 915 |
| 27.9.8 | SPIx_I2S configuration register (SPIx_I2SCFGR) . . . . . | 916 |
| 27.9.9 | SPIx_I2S prescaler register (SPIx_I2SPR) . . . . . | 918 |
| 27.9.10 | SPI/I2S register map . . . . . | 919 |
| 28 | Universal serial bus full-speed host/device interface (USB) . . . . . | 920 |
| 28.1 | Introduction . . . . . | 920 |
| 28.2 | USB main features . . . . . | 920 |
| 28.3 | USB implementation . . . . . | 920 |
| 28.4 | USB functional description . . . . . | 921 |
| 28.4.1 | Description of USB blocks used in both Device and Host modes . . . . . | 923 |
| 28.4.2 | Description of host frame scheduler (HFS) specific to Host mode . . . . . | 924 |
| 28.5 | Programming considerations for Device and Host modes . . . . . | 925 |
| 28.5.1 | Generic USB Device programming . . . . . | 925 |
| 28.5.2 | System and power-on reset . . . . . | 925 |
| 28.5.3 | Double-buffered endpoints and usage in Device mode . . . . . | 932 |
| 28.5.4 | Double buffered channels: usage in Host mode . . . . . | 934 |
| 28.5.5 | Isochronous transfers in Device mode . . . . . | 935 |
| 28.5.6 | Isochronous transfers in Host mode . . . . . | 937 |
| 28.5.7 | Suspend/resume events . . . . . | 937 |
| 28.6 | USB and USB SRAM registers . . . . . | 941 |
| 28.6.1 | Common registers . . . . . | 941 |
| 28.6.2 | Buffer descriptor table . . . . . | 960 |
| 28.6.3 | USB register map . . . . . | 964 |
| 29 | Debug support (DBG) . . . . . | 966 |
| 29.1 | Overview . . . . . | 966 |
| 29.2 | Reference Arm documentation . . . . . | 967 |
| 29.3 | Pinout and debug port pins . . . . . | 967 |
| 29.3.1 | SWD port pins . . . . . | 967 |
| 29.3.2 | SW-DP pin assignment . . . . . | 967 |
| 29.3.3 | Internal pull-up & pull-down on SWD pins . . . . . | 968 |
| 29.4 | ID codes and locking mechanism . . . . . | 968 |
| 29.5 | SWD port . . . . . | 968 |
| 29.5.1 | SWD protocol introduction . . . . . | 968 |
| 29.5.2 | SWD protocol sequence . . . . . | 968 |
| 29.5.3 | SW-DP state machine (reset, idle states, ID code) . . . . . | 969 |
| 29.5.4 | DP and AP read/write accesses . . . . . | 970 |
| 29.5.5 | SW-DP registers . . . . . | 970 |
| 29.5.6 | SW-AP registers . . . . . | 971 |
| 29.6 | Core debug . . . . . | 972 |
| 29.7 | BPU (Break Point Unit) . . . . . | 972 |
| 29.7.1 | BPU functionality . . . . . | 973 |
| 29.8 | DWT (Data Watchpoint) . . . . . | 973 |
| 29.8.1 | DWT functionality . . . . . | 973 |
| 29.8.2 | DWT Program Counter Sample Register . . . . . | 973 |
| 29.9 | MCU debug component (DBG) . . . . . | 973 |
| 29.9.1 | Debug support for low-power modes . . . . . | 973 |
| 29.9.2 | Debug support for timers, watchdog and I 2 C . . . . . | 974 |
| 29.10 | DBG registers . . . . . | 974 |
| 29.10.1 | DBG device ID code register (DBG_IDCODE) . . . . . | 974 |
| 29.10.2 | DBG configuration register (DBG_CR) . . . . . | 975 |
| 29.10.3 | DBG APB freeze register 1 (DBG_APB_FZ1) . . . . . | 975 |
| 29.10.4 | DBG APB freeze register 2 (DBG_APB_FZ2) . . . . . | 977 |
| 29.10.5 | DBG register map . . . . . | 978 |
| 30 | Device electronic signature . . . . . | 980 |
| 30.1 | Flash memory size data register . . . . . | 980 |
| 30.2 | Package data register . . . . . | 980 |
| 31 | Revision history . . . . . | 982 |
List of tables
Table 1. Peripherals versus products . . . . . 40
Table 2. STM32G0B0xx memory boundary addresses . . . . . 46
Table 3. STM32G070xx memory boundary addresses . . . . . 46
Table 4. STM32G030xx and STM32G050xx memory boundary addresses . . . . . 47
Table 5. STM32G0x0 peripheral register boundary addresses . . . . . 47
Table 6. SRAM size . . . . . 49
Table 7. Boot modes . . . . . 51
Table 8. Flash memory organization for single-bank devices . . . . . 54
Table 9. Flash memory organization for 512 Kbytes dual-bank devices . . . . . 55
Table 10. Number of wait states according to Flash memory clock (HCLK) frequency . . . . . 56
Table 11. Option byte format . . . . . 64
Table 12. Organization of option bytes . . . . . 64
Table 13. Flash memory read protection status . . . . . 70
Table 14. Access status versus protection level and execution modes . . . . . 71
Table 16. FLASH interrupt requests . . . . . 73
Table 17. FLASH register map and reset values . . . . . 85
Table 18. Low-power mode summary . . . . . 93
Table 19. Functionalities depending on the working mode . . . . . 93
Table 20. Low-power run . . . . . 96
Table 21. Sleep mode summary . . . . . 98
Table 22. Low-power sleep mode summary . . . . . 99
Table 23. Stop 0 mode summary . . . . . 100
Table 24. Stop 1 mode summary . . . . . 101
Table 25. Standby mode summary . . . . . 103
Table 26. PWR register map and reset values . . . . . 117
Table 27. Clock source frequency . . . . . 128
Table 28. RCC register map and reset values . . . . . 169
Table 29. Port bit configuration table . . . . . 174
Table 30. GPIO register map and reset values . . . . . 188
Table 31. SYSCFG register map and reset values . . . . . 205
Table 32. Interconnect matrix . . . . . 208
Table 33. DMA implementation . . . . . 214
Table 34. DMA internal input/output signals . . . . . 215
Table 35. Programmable data width and endian behavior (when PINC = MINC = 1) . . . . . 221
Table 36. DMA interrupt requests . . . . . 222
Table 37. DMA register map and reset values . . . . . 231
Table 38. DMAMUX instantiation . . . . . 235
Table 39. DMAMUX: assignment of multiplexer inputs to resources . . . . . 236
Table 40. DMAMUX: assignment of trigger inputs to resources . . . . . 236
Table 41. DMAMUX: assignment of synchronization inputs to resources . . . . . 237
Table 42. DMAMUX signals . . . . . 239
Table 43. DMAMUX interrupts . . . . . 243
Table 44. DMAMUX register map and reset values . . . . . 248
Table 45. Vector table . . . . . 250
Table 46. EXTI signal overview . . . . . 254
Table 47. EVG pin overview . . . . . 254
Table 48. EXTI event input configurations and register control . . . . . 255
| Table 49. | EXTI line connections . . . . . | 258 |
| Table 50. | Masking functionality . . . . . | 258 |
| Table 51. | EXTI register map sections. . . . . | 259 |
| Table 52. | EXTI controller register map and reset values . . . . . | 265 |
| Table 53. | CRC internal input/output signals . . . . . | 268 |
| Table 54. | CRC register map and reset values . . . . . | 273 |
| Table 55. | ADC input/output pins . . . . . | 276 |
| Table 56. | ADC internal input/output signals . . . . . | 277 |
| Table 57. | External triggers . . . . . | 277 |
| Table 58. | Latency between trigger and start of conversion . . . . . | 282 |
| Table 59. | Configuring the trigger polarity . . . . . | 289 |
| Table 60. | tSAR timings depending on resolution . . . . . | 291 |
| Table 61. | Analog watchdog comparison. . . . . | 300 |
| Table 62. | Analog watchdog 1 channel selection . . . . . | 301 |
| Table 63. | Maximum output results vs N and M. Grayed values indicates truncation . . . . . | 305 |
| Table 64. | ADC interrupts . . . . . | 310 |
| Table 65. | ADC register map and reset values . . . . . | 333 |
| Table 66. | Behavior of timer outputs versus BRK/BRK2 inputs. . . . . | 377 |
| Table 67. | Break protection disarming conditions . . . . . | 379 |
| Table 68. | Counting direction versus encoder signals. . . . . | 385 |
| Table 69. | TIM1 internal trigger connection . . . . . | 402 |
| Table 70. | Output control bits for complementary OCx and OCxN channels with break feature. . . . . | 416 |
| Table 71. | TIM1 register map and reset values . . . . . | 431 |
| Table 72. | Counting direction versus encoder signals. . . . . | 467 |
| Table 73. | TIM3 internal trigger connection . . . . . | 485 |
| Table 74. | Output control bit for standard OCx channels. . . . . | 496 |
| Table 75. | TIM3/TIM4 register map and reset values . . . . . | 505 |
| Table 76. | TIMx register map and reset values . . . . . | 520 |
| Table 77. | Output control bit for standard OCx channels. . . . . | 543 |
| Table 78. | TIM14 register map and reset values . . . . . | 545 |
| Table 79. | Break protection disarming conditions . . . . . | 575 |
| Table 80. | TIMx Internal trigger connection . . . . . | 591 |
| Table 81. | Output control bits for complementary OCx and OCxN channels with break feature (TIM15). . . . . | 601 |
| Table 82. | TIM15 register map and reset values . . . . . | 609 |
| Table 83. | Output control bits for complementary OCx and OCxN channels with break feature (TIM16/17) . . . . . | 622 |
| Table 84. | TIM16/TIM17 register map and reset values . . . . . | 632 |
| Table 85. | IWDG register map and reset values . . . . . | 643 |
| Table 86. | WWDG register map and reset values . . . . . | 649 |
| Table 87. | RTC input/output pins . . . . . | 652 |
| Table 88. | RTC internal input/output signals . . . . . | 652 |
| Table 89. | RTC interconnection. . . . . | 653 |
| Table 90. | PC13 configuration . . . . . | 653 |
| Table 91. | RTC_OUT mapping . . . . . | 655 |
| Table 92. | Effect of low-power modes on RTC . . . . . | 666 |
| Table 93. | RTC pins functionality over modes. . . . . | 666 |
| Table 94. | Interrupt requests . . . . . | 667 |
| Table 95. | RTC register map and reset values . . . . . | 687 |
| Table 96. | TAMP input/output pins . . . . . | 691 |
| Table 97. | TAMP internal input/output signals. . . . . | 691 |
| Table 98. | TAMP interconnection . . . . . | 691 |
| Table 99. | Effect of low-power modes on TAMP . . . . . | 694 |
| Table 100. | Interrupt requests . . . . . | 694 |
| Table 101. | TAMP register map and reset values . . . . . | 703 |
| Table 102. | STM32G0x0 I2C implementation . . . . . | 705 |
| Table 103. | I2C input/output pins . . . . . | 708 |
| Table 104. | I2C internal input/output signals . . . . . | 708 |
| Table 105. | Comparison of analog vs. digital filters . . . . . | 710 |
| Table 106. | I2C-SMBus specification data setup and hold times . . . . . | 713 |
| Table 107. | I2C configuration . . . . . | 717 |
| Table 108. | I2C-SMBus specification clock timings . . . . . | 728 |
| Table 109. | Examples of timing settings for f I2CCLK = 8 MHz . . . . . | 738 |
| Table 110. | Examples of timings settings for f I2CCLK = 16 MHz . . . . . | 738 |
| Table 111. | Examples of timings settings for f I2CCLK = 48 MHz . . . . . | 739 |
| Table 112. | SMBus timeout specifications . . . . . | 741 |
| Table 113. | SMBus with PEC configuration . . . . . | 743 |
| Table 114. | Examples of TIMEOUTA settings for various I2CCLK frequencies (max t TIMEOUT = 25 ms) . . . . . | 744 |
| Table 115. | Examples of TIMEOUTB settings for various I2CCLK frequencies . . . . . | 744 |
| Table 116. | Examples of TIMEOUTA settings for various I2CCLK frequencies (max t IDLE = 50 µs) . . . . . | 745 |
| Table 117. | Effect of low-power modes on the I2C . . . . . | 756 |
| Table 118. | I2C Interrupt requests . . . . . | 757 |
| Table 119. | I2C register map and reset values . . . . . | 773 |
| Table 120. | STM32G0x0 features . . . . . | 777 |
| Table 121. | USART features . . . . . | 778 |
| Table 122. | Noise detection from sampled data . . . . . | 793 |
| Table 123. | Tolerance of the USART receiver when BRR [3:0] = 0000 . . . . . | 796 |
| Table 124. | Tolerance of the USART receiver when BRR[3:0] is different from 0000 . . . . . | 797 |
| Table 125. | USART frame formats . . . . . | 802 |
| Table 126. | Effect of low-power modes on the USART . . . . . | 825 |
| Table 127. | USART interrupt requests . . . . . | 826 |
| Table 128. | USART register map and reset values . . . . . | 861 |
| Table 129. | STM32G0x0 SPI and SPI/I2S implementation . . . . . | 864 |
| Table 130. | SPI interrupt requests . . . . . | 889 |
| Table 131. | Audio-frequency precision using standard 8 MHz HSE . . . . . | 902 |
| Table 132. | I2S interrupt requests . . . . . | 908 |
| Table 133. | SPI/I2S register map and reset values . . . . . | 919 |
| Table 134. | STM32G0x0 USB implementation . . . . . | 920 |
| Table 135. | Double-buffering buffer flag definition . . . . . | 933 |
| Table 136. | Bulk double-buffering memory buffers usage (Device mode) . . . . . | 933 |
| Table 137. | Bulk double-buffering memory buffers usage (Host mode) . . . . . | 935 |
| Table 138. | Isochronous memory buffers usage . . . . . | 936 |
| Table 139. | Isochronous memory buffers usage . . . . . | 937 |
| Table 140. | Resume event detection . . . . . | 939 |
| Table 141. | Resume event detection for host . . . . . | 940 |
| Table 142. | Reception status encoding . . . . . | 958 |
| Table 143. | Endpoint/channel type encoding . . . . . | 958 |
| Table 144. | Endpoint/channel kind meaning . . . . . | 958 |
| Table 145. | Transmission status encoding . . . . . | 958 |
| Table 146. | Definition of allocated buffer memory . . . . . | 961 |
| Table 147. | USB register map and reset values . . . . . | 964 |
| Table 148. | SW debug port pins . . . . . | 967 |
| Table 149. | Packet request (8-bits) . . . . . | 969 |
| Table 150. | ACK response (3 bits). . . . . | 969 |
| Table 151. | DATA transfer (33 bits). . . . . | 969 |
| Table 152. | SW-DP registers. . . . . | 970 |
| Table 153. | 32-bit debug port registers addressed through the shifted value A[3:2] . . . . . | 971 |
| Table 154. | Core debug registers . . . . . | 972 |
| Table 155. | DEV_ID and REV_ID field values. . . . . | 974 |
| Table 156. | DBG register map and reset values . . . . . | 978 |
| Table 157. | Document revision history . . . . . | 982 |
List of figures
| Figure 1. | System architecture . . . . . | 42 |
| Figure 2. | Memory map . . . . . | 45 |
| Figure 3. | Changing read protection (RDP) level . . . . . | 71 |
| Figure 4. | Power supply overview . . . . . | 87 |
| Figure 5. | POR, PDR thresholds . . . . . | 90 |
| Figure 6. | Low-power modes state diagram . . . . . | 92 |
| Figure 7. | Simplified diagram of the reset circuit . . . . . | 120 |
| Figure 8. | Clock tree . . . . . | 124 |
| Figure 9. | HSE/ LSE clock sources . . . . . | 125 |
| Figure 10. | Frequency measurement with TIM14 in capture mode . . . . . | 132 |
| Figure 11. | Frequency measurement with TIM16 in capture mode . . . . . | 132 |
| Figure 12. | Frequency measurement with TIM17 in capture mode . . . . . | 133 |
| Figure 13. | Basic structure of an I/O port bit . . . . . | 174 |
| Figure 14. | Input floating/pull up/pull down configurations . . . . . | 178 |
| Figure 15. | Output configuration . . . . . | 179 |
| Figure 16. | Alternate function configuration- . . . . . | 180 |
| Figure 17. | High impedance-analog configuration . . . . . | 180 |
| Figure 18. | DMA block diagram . . . . . | 215 |
| Figure 19. | DMAMUX block diagram . . . . . | 238 |
| Figure 20. | Synchronization mode of the DMAMUX request line multiplexer channel . . . . . | 241 |
| Figure 21. | Event generation of the DMA request line multiplexer channel . . . . . | 241 |
| Figure 22. | EXTI block diagram . . . . . | 254 |
| Figure 23. | Configurable event trigger logic CPU wakeup . . . . . | 256 |
| Figure 24. | Direct event trigger logic CPU wakeup . . . . . | 257 |
| Figure 25. | EXTI GPIO mux . . . . . | 257 |
| Figure 26. | CRC calculation unit block diagram . . . . . | 268 |
| Figure 27. | ADC block diagram . . . . . | 276 |
| Figure 28. | ADC calibration . . . . . | 279 |
| Figure 29. | Calibration factor forcing . . . . . | 279 |
| Figure 30. | Enabling/disabling the ADC . . . . . | 280 |
| Figure 31. | ADC clock scheme . . . . . | 281 |
| Figure 32. | ADC connectivity . . . . . | 283 |
| Figure 33. | Analog to digital conversion time . . . . . | 288 |
| Figure 34. | ADC conversion timings . . . . . | 288 |
| Figure 35. | Stopping an ongoing conversion . . . . . | 289 |
| Figure 36. | Single conversions of a sequence, software trigger . . . . . | 292 |
| Figure 37. | Continuous conversion of a sequence, software trigger . . . . . | 292 |
| Figure 38. | Single conversions of a sequence, hardware trigger . . . . . | 293 |
| Figure 39. | Continuous conversions of a sequence, hardware trigger . . . . . | 293 |
| Figure 40. | Data alignment and resolution (oversampling disabled: OVSE = 0) . . . . . | 294 |
| Figure 41. | Example of overrun (OVR) . . . . . | 295 |
| Figure 42. | Wait mode conversion (continuous mode, software trigger) . . . . . | 298 |
| Figure 43. | Behavior with WAIT = 0, AUTOFF = 1 . . . . . | 299 |
| Figure 44. | Behavior with WAIT = 1, AUTOFF = 1 . . . . . | 299 |
| Figure 45. | Analog watchdog guarded area . . . . . | 300 |
| Figure 46. | ADC_AWDx_OUT signal generation . . . . . | 302 |
| Figure 47. | ADC_AWDx_OUT signal generation (AWDx flag not cleared by software) . . . . . | 302 |
| Figure 48. | ADC_AWDx_OUT signal generation (on a single channel) . . . . . | 303 |
| Figure 49. | Analog watchdog threshold update . . . . . | 303 |
| Figure 50. | 20-bit to 16-bit result truncation . . . . . | 304 |
| Figure 51. | Numerical example with 5-bits shift and rounding . . . . . | 305 |
| Figure 52. | Triggered oversampling mode (TOVS bit = 1) . . . . . | 307 |
| Figure 53. | Temperature sensor and VREFINT channel block diagram . . . . . | 308 |
| Figure 54. | VBAT channel block diagram . . . . . | 310 |
| Figure 55. | Advanced-control timer block diagram . . . . . | 337 |
| Figure 56. | Counter timing diagram with prescaler division change from 1 to 2 . . . . . | 339 |
| Figure 57. | Counter timing diagram with prescaler division change from 1 to 4 . . . . . | 339 |
| Figure 58. | Counter timing diagram, internal clock divided by 1 . . . . . | 341 |
| Figure 59. | Counter timing diagram, internal clock divided by 2 . . . . . | 341 |
| Figure 60. | Counter timing diagram, internal clock divided by 4 . . . . . | 342 |
| Figure 61. | Counter timing diagram, internal clock divided by N . . . . . | 342 |
| Figure 62. | Counter timing diagram, update event when ARPE=0 (TIMx_ARR not preloaded) . . . . . | 343 |
| Figure 63. | Counter timing diagram, update event when ARPE=1 (TIMx_ARR preloaded) . . . . . | 343 |
| Figure 64. | Counter timing diagram, internal clock divided by 1 . . . . . | 345 |
| Figure 65. | Counter timing diagram, internal clock divided by 2 . . . . . | 345 |
| Figure 66. | Counter timing diagram, internal clock divided by 4 . . . . . | 346 |
| Figure 67. | Counter timing diagram, internal clock divided by N . . . . . | 346 |
| Figure 68. | Counter timing diagram, update event when repetition counter is not used . . . . . | 347 |
| Figure 69. | Counter timing diagram, internal clock divided by 1, TIMx_ARR = 0x6 . . . . . | 348 |
| Figure 70. | Counter timing diagram, internal clock divided by 2 . . . . . | 349 |
| Figure 71. | Counter timing diagram, internal clock divided by 4, TIMx_ARR=0x36 . . . . . | 349 |
| Figure 72. | Counter timing diagram, internal clock divided by N . . . . . | 350 |
| Figure 73. | Counter timing diagram, update event with ARPE=1 (counter underflow) . . . . . | 350 |
| Figure 74. | Counter timing diagram, Update event with ARPE=1 (counter overflow) . . . . . | 351 |
| Figure 75. | Update rate examples depending on mode and TIMx_RCR register settings . . . . . | 352 |
| Figure 76. | External trigger input block . . . . . | 353 |
| Figure 77. | TIM1 ETR input circuitry . . . . . | 353 |
| Figure 78. | Control circuit in normal mode, internal clock divided by 1 . . . . . | 354 |
| Figure 79. | TI2 external clock connection example . . . . . | 355 |
| Figure 80. | Control circuit in external clock mode 1 . . . . . | 356 |
| Figure 81. | External trigger input block . . . . . | 356 |
| Figure 82. | Control circuit in external clock mode 2 . . . . . | 357 |
| Figure 83. | Capture/compare channel (example: channel 1 input stage) . . . . . | 358 |
| Figure 84. | Capture/compare channel 1 main circuit . . . . . | 358 |
| Figure 85. | Output stage of capture/compare channel (channel 1, idem ch. 2 and 3) . . . . . | 359 |
| Figure 86. | Output stage of capture/compare channel (channel 4) . . . . . | 359 |
| Figure 87. | Output stage of capture/compare channel (channel 5, idem ch. 6) . . . . . | 360 |
| Figure 88. | PWM input mode timing . . . . . | 362 |
| Figure 89. | Output compare mode, toggle on OC1 . . . . . | 364 |
| Figure 90. | Edge-aligned PWM waveforms (ARR=8) . . . . . | 365 |
| Figure 91. | Center-aligned PWM waveforms (ARR=8) . . . . . | 366 |
| Figure 92. | Generation of 2 phase-shifted PWM signals with 50% duty cycle . . . . . | 368 |
| Figure 93. | Combined PWM mode on channel 1 and 3 . . . . . | 369 |
| Figure 94. | 3-phase combined PWM signals with multiple trigger pulses per period . . . . . | 370 |
| Figure 95. | Complementary output with dead-time insertion . . . . . | 371 |
| Figure 96. | Dead-time waveforms with delay greater than the negative pulse . . . . . | 371 |
| Figure 97. | Dead-time waveforms with delay greater than the positive pulse . . . . . | 372 |
| Figure 98. | Break and Break2 circuitry overview . . . . . | 374 |
| Figure 99. | Various output behavior in response to a break event on BRK (OSSI = 1) . . . . . | 376 |
| Figure 100. | PWM output state following BRK and BRK2 pins assertion (OSSI=1) . . . . . | 377 |
| Figure 101. PWM output state following BRK assertion (OSSI=0) . . . . . | 378 |
| Figure 102. Output redirection (BRK2 request not represented) . . . . . | 379 |
| Figure 103. Clearing TIMx OCxREF . . . . . | 380 |
| Figure 104. 6-step generation, COM example (OSSR=1) . . . . . | 381 |
| Figure 105. Example of one pulse mode. . . . . | 382 |
| Figure 106. Retriggerable one pulse mode . . . . . | 384 |
| Figure 107. Example of counter operation in encoder interface mode. . . . . | 385 |
| Figure 108. Example of encoder interface mode with TI1FP1 polarity inverted. . . . . | 386 |
| Figure 109. Measuring time interval between edges on 3 signals . . . . . | 387 |
| Figure 110. Example of Hall sensor interface . . . . . | 389 |
| Figure 111. Control circuit in reset mode . . . . . | 390 |
| Figure 112. Control circuit in Gated mode . . . . . | 391 |
| Figure 113. Control circuit in trigger mode . . . . . | 392 |
| Figure 114. Control circuit in external clock mode 2 + trigger mode . . . . . | 393 |
| Figure 115. General-purpose timer block diagram . . . . . | 435 |
| Figure 116. Counter timing diagram with prescaler division change from 1 to 2 . . . . . | 437 |
| Figure 117. Counter timing diagram with prescaler division change from 1 to 4 . . . . . | 437 |
| Figure 118. Counter timing diagram, internal clock divided by 1 . . . . . | 438 |
| Figure 119. Counter timing diagram, internal clock divided by 2 . . . . . | 439 |
| Figure 120. Counter timing diagram, internal clock divided by 4 . . . . . | 439 |
| Figure 121. Counter timing diagram, internal clock divided by N . . . . . | 440 |
| Figure 122. Counter timing diagram, Update event when ARPE=0 (TIMx_ARR not preloaded). . . . . | 440 |
| Figure 123. Counter timing diagram, Update event when ARPE=1 (TIMx_ARR preloaded). . . . . | 441 |
| Figure 124. Counter timing diagram, internal clock divided by 1 . . . . . | 442 |
| Figure 125. Counter timing diagram, internal clock divided by 2 . . . . . | 442 |
| Figure 126. Counter timing diagram, internal clock divided by 4 . . . . . | 443 |
| Figure 127. Counter timing diagram, internal clock divided by N . . . . . | 443 |
| Figure 128. Counter timing diagram, Update event when repetition counter is not used . . . . . | 444 |
| Figure 129. Counter timing diagram, internal clock divided by 1, TIMx_ARR=0x6 . . . . . | 445 |
| Figure 130. Counter timing diagram, internal clock divided by 2 . . . . . | 446 |
| Figure 131. Counter timing diagram, internal clock divided by 4, TIMx_ARR=0x36 . . . . . | 446 |
| Figure 132. Counter timing diagram, internal clock divided by N . . . . . | 447 |
| Figure 133. Counter timing diagram, Update event with ARPE=1 (counter underflow). . . . . | 447 |
| Figure 134. Counter timing diagram, Update event with ARPE=1 (counter overflow). . . . . | 448 |
| Figure 135. Control circuit in normal mode, internal clock divided by 1 . . . . . | 449 |
| Figure 136. TI2 external clock connection example. . . . . | 449 |
| Figure 137. Control circuit in external clock mode 1 . . . . . | 450 |
| Figure 138. External trigger input block . . . . . | 451 |
| Figure 139. Control circuit in external clock mode 2 . . . . . | 452 |
| Figure 140. Capture/Compare channel (example: channel 1 input stage) . . . . . | 452 |
| Figure 141. Capture/Compare channel 1 main circuit . . . . . | 453 |
| Figure 142. Output stage of Capture/Compare channel (channel 1). . . . . | 453 |
| Figure 143. PWM input mode timing . . . . . | 455 |
| Figure 144. Output compare mode, toggle on OC1 . . . . . | 457 |
| Figure 145. Edge-aligned PWM waveforms (ARR=8) . . . . . | 458 |
| Figure 146. Center-aligned PWM waveforms (ARR=8). . . . . | 460 |
| Figure 147. Generation of 2 phase-shifted PWM signals with 50% duty cycle . . . . . | 461 |
| Figure 148. Combined PWM mode on channels 1 and 3 . . . . . | 462 |
| Figure 149. Clearing TIMx OCxREF . . . . . | 463 |
| Figure 150. Example of one-pulse mode. . . . . | 464 |
| Figure 151. Retriggerable one-pulse mode. . . . . | 466 |
| Figure 152. Example of counter operation in encoder interface mode . . . . . | 467 |
| Figure 153. Example of encoder interface mode with TI1FP1 polarity inverted . . . . . | 468 |
| Figure 154. Control circuit in reset mode . . . . . | 469 |
| Figure 155. Control circuit in gated mode . . . . . | 470 |
| Figure 156. Control circuit in trigger mode . . . . . | 471 |
| Figure 157. Control circuit in external clock mode 2 + trigger mode . . . . . | 472 |
| Figure 158. Master/Slave timer example . . . . . | 472 |
| Figure 159. Master/slave connection example with 1 channel only timers . . . . . | 473 |
| Figure 160. Gating TIMz with OC1REF of TIMy . . . . . | 474 |
| Figure 161. Gating TIMz with Enable of TIMy . . . . . | 475 |
| Figure 162. Triggering TIMz with update of TIMy . . . . . | 475 |
| Figure 163. Triggering TIMz with Enable of TIMy . . . . . | 476 |
| Figure 164. Triggering TIMy and TIMz with TIMy TI1 input . . . . . | 477 |
| Figure 165. Basic timer block diagram . . . . . | 508 |
| Figure 166. Counter timing diagram with prescaler division change from 1 to 2 . . . . . | 510 |
| Figure 167. Counter timing diagram with prescaler division change from 1 to 4 . . . . . | 510 |
| Figure 168. Counter timing diagram, internal clock divided by 1 . . . . . | 511 |
| Figure 169. Counter timing diagram, internal clock divided by 2 . . . . . | 512 |
| Figure 170. Counter timing diagram, internal clock divided by 4 . . . . . | 512 |
| Figure 171. Counter timing diagram, internal clock divided by N . . . . . | 513 |
| Figure 172. Counter timing diagram, update event when ARPE = 0 (TIMx_ARR not preloaded). . . . . | 513 |
| Figure 173. Counter timing diagram, update event when ARPE=1 (TIMx_ARR preloaded). . . . . | 514 |
| Figure 174. Control circuit in normal mode, internal clock divided by 1 . . . . . | 515 |
| Figure 175. General-purpose timer block diagram (TIM14). . . . . | 522 |
| Figure 176. Counter timing diagram with prescaler division change from 1 to 2 . . . . . | 524 |
| Figure 177. Counter timing diagram with prescaler division change from 1 to 4 . . . . . | 524 |
| Figure 178. Counter timing diagram, internal clock divided by 1 . . . . . | 525 |
| Figure 179. Counter timing diagram, internal clock divided by 2 . . . . . | 526 |
| Figure 180. Counter timing diagram, internal clock divided by 4 . . . . . | 526 |
| Figure 181. Counter timing diagram, internal clock divided by N . . . . . | 527 |
| Figure 182. Counter timing diagram, update event when ARPE=0 (TIMx_ARR not preloaded). . . . . | 527 |
| Figure 183. Counter timing diagram, update event when ARPE=1 (TIMx_ARR preloaded). . . . . | 528 |
| Figure 184. Control circuit in normal mode, internal clock divided by 1 . . . . . | 529 |
| Figure 185. Capture/compare channel (example: channel 1 input stage). . . . . | 529 |
| Figure 186. Capture/compare channel 1 main circuit . . . . . | 530 |
| Figure 187. Output stage of capture/compare channel (channel 1). . . . . | 530 |
| Figure 188. Output compare mode, toggle on OC1. . . . . | 533 |
| Figure 189. Edge-aligned PWM waveforms (ARR=8). . . . . | 534 |
| Figure 190. TIM15 block diagram . . . . . | 549 |
| Figure 191. TIM16/TIM17 block diagram . . . . . | 550 |
| Figure 192. Counter timing diagram with prescaler division change from 1 to 2 . . . . . | 552 |
| Figure 193. Counter timing diagram with prescaler division change from 1 to 4 . . . . . | 552 |
| Figure 194. Counter timing diagram, internal clock divided by 1 . . . . . | 554 |
| Figure 195. Counter timing diagram, internal clock divided by 2 . . . . . | 554 |
| Figure 196. Counter timing diagram, internal clock divided by 4 . . . . . | 555 |
| Figure 197. Counter timing diagram, internal clock divided by N . . . . . | 555 |
| Figure 198. Counter timing diagram, update event when ARPE=0 (TIMx_ARR not preloaded). . . . . | 556 |
| Figure 199. Counter timing diagram, update event when ARPE=1 (TIMx_ARR preloaded). . . . . | 556 |
| Figure 200. Update rate examples depending on mode and TIMx_RCR register settings . . . . . | 558 |
| Figure 201. Control circuit in normal mode, internal clock divided by 1 . . . . . | 559 |
| Figure 202. TI2 external clock connection example. . . . . | 559 |
| Figure 203. Control circuit in external clock mode 1 . . . . . | 560 |
| Figure 204. Capture/compare channel (example: channel 1 input stage) . . . . . | 561 |
| Figure 205. Capture/compare channel 1 main circuit . . . . . | 561 |
| Figure 206. Output stage of capture/compare channel (channel 1). . . . . | 562 |
| Figure 207. Output stage of capture/compare channel (channel 2 for TIM15) . . . . . | 562 |
| Figure 208. PWM input mode timing . . . . . | 564 |
| Figure 209. Output compare mode, toggle on OC1 . . . . . | 566 |
| Figure 210. Edge-aligned PWM waveforms (ARR=8) . . . . . | 567 |
| Figure 211. Combined PWM mode on channel 1 and 2 . . . . . | 568 |
| Figure 212. Complementary output with dead-time insertion. . . . . | 569 |
| Figure 213. Dead-time waveforms with delay greater than the negative pulse. . . . . | 569 |
| Figure 214. Dead-time waveforms with delay greater than the positive pulse. . . . . | 570 |
| Figure 215. Break circuitry overview . . . . . | 572 |
| Figure 216. Output behavior in response to a break . . . . . | 574 |
| Figure 217. Output redirection . . . . . | 576 |
| Figure 218. Example of one pulse mode . . . . . | 578 |
| Figure 219. Retriggerable one pulse mode . . . . . | 579 |
| Figure 220. Measuring time interval between edges on 2 signals . . . . . | 581 |
| Figure 221. Control circuit in reset mode . . . . . | 582 |
| Figure 222. Control circuit in gated mode . . . . . | 583 |
| Figure 223. Control circuit in trigger mode . . . . . | 584 |
| Figure 224. IRTIM internal hardware connections . . . . . | 634 |
| Figure 225. Independent watchdog block diagram . . . . . | 635 |
| Figure 226. Watchdog block diagram . . . . . | 645 |
| Figure 227. Window watchdog timing diagram . . . . . | 646 |
| Figure 228. RTC block diagram . . . . . | 651 |
| Figure 229. TAMP block diagram . . . . . | 690 |
| Figure 230. I2C1 block diagram . . . . . | 706 |
| Figure 231. I2C2 block diagram . . . . . | 707 |
| Figure 232. I2C bus protocol . . . . . | 709 |
| Figure 233. Setup and hold timings . . . . . | 711 |
| Figure 234. I2C initialization flowchart . . . . . | 714 |
| Figure 235. Data reception . . . . . | 715 |
| Figure 236. Data transmission . . . . . | 716 |
| Figure 237. Slave initialization flowchart . . . . . | 719 |
| Figure 238. Transfer sequence flowchart for I2C slave transmitter, NOSTRETCH= 0 . . . . . | 721 |
| Figure 239. Transfer sequence flowchart for I2C slave transmitter, NOSTRETCH= 1 . . . . . | 722 |
| Figure 240. Transfer bus diagrams for I2C slave transmitter. . . . . | 723 |
| Figure 241. Transfer sequence flowchart for slave receiver with NOSTRETCH=0 . . . . . | 724 |
| Figure 242. Transfer sequence flowchart for slave receiver with NOSTRETCH=1 . . . . . | 725 |
| Figure 243. Transfer bus diagrams for I2C slave receiver . . . . . | 725 |
| Figure 244. Master clock generation . . . . . | 727 |
| Figure 245. Master initialization flowchart . . . . . | 729 |
| Figure 246. 10-bit address read access with HEAD10R=0 . . . . . | 729 |
| Figure 247. 10-bit address read access with HEAD10R=1 . . . . . | 730 |
| Figure 248. Transfer sequence flowchart for I2C master transmitter for \( N \leq 255 \) bytes . . . . . | 731 |
| Figure 249. Transfer sequence flowchart for I2C master transmitter for \( N > 255 \) bytes . . . . . | 732 |
| Figure 250. Transfer bus diagrams for I2C master transmitter . . . . . | 733 |
| Figure 251. Transfer sequence flowchart for I2C master receiver for \( N \leq 255 \) bytes . . . . . | 735 |
| Figure 252. Transfer sequence flowchart for I2C master receiver for \( N > 255 \) bytes . . . . . | 736 |
| Figure 253. Transfer bus diagrams for I2C master receiver . . . . . | 737 |
| Figure 254. Timeout intervals for \( t_{LOW:SEXT} \) , \( t_{LOW:MEXT} \) . . . . . | 742 |
| Figure 255. Transfer sequence flowchart for SMBus slave transmitter N bytes + PEC. . . . . | 746 |
| Figure 256. Transfer bus diagrams for SMBus slave transmitter (SBC=1) . . . . . | 746 |
| Figure 257. Transfer sequence flowchart for SMBus slave receiver N Bytes + PEC . . . . . | 748 |
| Figure 258. Bus transfer diagrams for SMBus slave receiver (SBC=1). . . . . | 749 |
| Figure 259. Bus transfer diagrams for SMBus master transmitter . . . . . | 750 |
| Figure 260. Bus transfer diagrams for SMBus master receiver . . . . . | 752 |
| Figure 261. USART block diagram . . . . . | 779 |
| Figure 262. Word length programming . . . . . | 782 |
| Figure 263. Configurable stop bits . . . . . | 784 |
| Figure 264. TC/TXE behavior when transmitting . . . . . | 787 |
| Figure 265. Start bit detection when oversampling by 16 or 8. . . . . | 788 |
| Figure 266. usart_ker_ck clock divider block diagram . . . . . | 791 |
| Figure 267. Data sampling when oversampling by 16 . . . . . | 792 |
| Figure 268. Data sampling when oversampling by 8 . . . . . | 793 |
| Figure 269. Mute mode using Idle line detection . . . . . | 800 |
| Figure 270. Mute mode using address mark detection . . . . . | 801 |
| Figure 271. Break detection in LIN mode (11-bit break length - LBDL bit is set). . . . . | 804 |
| Figure 272. Break detection in LIN mode vs. Framing error detection. . . . . | 805 |
| Figure 273. USART example of synchronous master transmission. . . . . | 806 |
| Figure 274. USART data clock timing diagram in synchronous master mode (M bits = 00) . . . . . | 806 |
| Figure 275. USART data clock timing diagram in synchronous master mode (M bits = 01) . . . . . | 807 |
| Figure 276. USART data clock timing diagram in synchronous slave mode (M bits = 00) . . . . . | 808 |
| Figure 277. ISO 7816-3 asynchronous protocol . . . . . | 810 |
| Figure 278. Parity error detection using the 1.5 stop bits . . . . . | 812 |
| Figure 279. IrDA SIR ENDEC block diagram. . . . . | 816 |
| Figure 280. IrDA data modulation (3/16) - Normal mode. . . . . | 816 |
| Figure 281. Transmission using DMA . . . . . | 818 |
| Figure 282. Reception using DMA . . . . . | 819 |
| Figure 283. Hardware flow control between 2 USARTs . . . . . | 819 |
| Figure 284. RS232 RTS flow control . . . . . | 820 |
| Figure 285. RS232 CTS flow control . . . . . | 821 |
| Figure 286. Wakeup event verified (wakeup event = address match, FIFO disabled) . . . . . | 824 |
| Figure 287. Wakeup event not verified (wakeup event = address match, FIFO disabled) . . . . . | 824 |
| Figure 288. SPI block diagram. . . . . | 865 |
| Figure 289. Full-duplex single master/ single slave application. . . . . | 866 |
| Figure 290. Half-duplex single master/ single slave application . . . . . | 867 |
| Figure 291. Simplex single master/single slave application (master in transmit-only/ slave in receive-only mode) . . . . . | 868 |
| Figure 292. Master and three independent slaves. . . . . | 869 |
| Figure 293. Multi-master application . . . . . | 870 |
| Figure 294. Hardware/software slave select management . . . . . | 871 |
| Figure 295. Data clock timing diagram . . . . . | 872 |
| Figure 296. Data alignment when data length is not equal to 8-bit or 16-bit . . . . . | 873 |
| Figure 297. Packing data in FIFO for transmission and reception . . . . . | 877 |
| Figure 298. Master full-duplex communication . . . . . | 880 |
| Figure 299. Slave full-duplex communication . . . . . | 881 |
| Figure 300. Master full-duplex communication with CRC . . . . . | 882 |
| Figure 301. Master full-duplex communication in packed mode . . . . . | 883 |
| Figure 302. NSSP pulse generation in Motorola SPI master mode . . . . . | 886 |
| Figure 303. TI mode transfer . . . . . | 887 |
| Figure 304. I2S block diagram . . . . . | 890 |
| Figure 305. I 2 S Philips protocol waveforms (16/32-bit full accuracy). . . . . | 892 |
| Figure 306. I 2 S Philips standard waveforms (24-bit frame) . . . . . | 892 |
| Figure 307. Transmitting 0x8EAA33 . . . . . | 893 |
| Figure 308. Receiving 0x8EAA33 . . . . . | 893 |
| Figure 309. I 2 S Philips standard (16-bit extended to 32-bit packet frame) . . . . . | 893 |
| Figure 310. Example of 16-bit data frame extended to 32-bit channel frame . . . . . | 893 |
| Figure 311. MSB Justified 16-bit or 32-bit full-accuracy length . . . . . | 894 |
| Figure 312. MSB justified 24-bit frame length . . . . . | 894 |
| Figure 313. MSB justified 16-bit extended to 32-bit packet frame . . . . . | 895 |
| Figure 314. LSB justified 16-bit or 32-bit full-accuracy . . . . . | 895 |
| Figure 315. LSB justified 24-bit frame length . . . . . | 895 |
| Figure 316. Operations required to transmit 0x3478AE. . . . . | 896 |
| Figure 317. Operations required to receive 0x3478AE . . . . . | 896 |
| Figure 318. LSB justified 16-bit extended to 32-bit packet frame . . . . . | 896 |
| Figure 319. Example of 16-bit data frame extended to 32-bit channel frame . . . . . | 897 |
| Figure 320. PCM standard waveforms (16-bit) . . . . . | 897 |
| Figure 321. PCM standard waveforms (16-bit extended to 32-bit packet frame). . . . . | 898 |
| Figure 322. Start sequence in master mode . . . . . | 899 |
| Figure 323. Audio sampling frequency definition . . . . . | 900 |
| Figure 324. I 2 S clock generator architecture . . . . . | 900 |
| Figure 325. USB peripheral block diagram . . . . . | 921 |
| Figure 326. Packet buffer areas with examples of buffer description table locations . . . . . | 927 |
| Figure 327. Block diagram of STM32G0x0 MCU and Cortex ® -M0+-level debug support . . . . . | 966 |
Chapters
- 1. Documentation conventions
- 2. Memory and bus architecture
- 3. Embedded Flash memory (FLASH)
- 4. Power control (PWR)
- 5. Reset and clock control (RCC)
- 6. General-purpose I/Os (GPIO)
- 7. System configuration controller (SYSCFG)
- 8. Interconnect matrix
- 9. Direct memory access controller (DMA)
- 10. DMA request multiplexer (DMAMUX)
- 11. Nested vectored interrupt controller (NVIC)
- 12. Extended interrupt and event controller (EXTI)
- 13. Cyclic redundancy check calculation unit (CRC)
- 14. Analog-to-digital converter (ADC)
- 15. Advanced-control timer (TIM1)
- 16. General-purpose timers (TIM3/TIM4)
- 17. Basic timers (TIM6/TIM7)
- 18. General-purpose timers (TIM14)
- 19. General-purpose timers (TIM15/TIM16/TIM17)
- 20. Infrared interface (IRTIM)
- 21. Independent watchdog (IWDG)
- 22. System window watchdog (WWDG)
- 23. Real-time clock (RTC)
- 24. Tamper and backup registers (TAMP)
- 25. Inter-integrated circuit (I2C) interface
- 26. Universal synchronous receiver transmitter (USART)
- 27. Serial peripheral interface / integrated interchip sound (SPI/I2S)
- 28. Universal serial bus full-speed host/device interface (USB)
- 29. Debug support (DBG)
- 30. Device electronic signature
- 31. Revision history
- Index