没有合适的资源?快使用搜索试试~ 我知道了~
首页STM32G0x0单片机参考手册.pdf
STM32G0x0单片机参考手册.pdf
需积分: 48 1.5k 浏览量
更新于2023-05-29
评论
收藏 10.62MB PDF 举报
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
资源详情
资源评论
资源推荐

April 2019 RM0454 Rev 2 1/921
1
RM0454
Reference manual
STM32G0x0 advanced Arm
®
-based 32-bit MCUs
Introduction
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
www.st.com

Contents RM0454
2/921 RM0454 Rev 2
Contents
1 Documentation conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
1.1 General information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
1.2 List of abbreviations for registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
1.3 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
1.4 Availability of peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
2 Memory and bus architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.1 System architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.2 Memory organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2.2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2.2.2 Memory map and register boundary addresses . . . . . . . . . . . . . . . . . . 42
2.3 Embedded SRAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
2.4 Flash memory overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
2.5 Boot configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
3 Embedded Flash memory (FLASH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.1 FLASH Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.2 FLASH main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.3 FLASH functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.3.1 FLASH memory organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.3.2 FLASH empty check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
3.3.3 FLASH error code correction (ECC) . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
3.3.4 FLASH read access latency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
3.3.5 FLASH memory acceleration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
3.3.6 FLASH program and erase operations . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.3.7 FLASH Main memory erase sequences . . . . . . . . . . . . . . . . . . . . . . . . 54
3.3.8 FLASH Main memory programming sequences . . . . . . . . . . . . . . . . . . 54
3.4 FLASH option bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.4.1 FLASH option byte description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.4.2 FLASH option byte programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
3.5 FLASH memory protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
3.5.1 FLASH read protection (RDP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
3.5.2 FLASH write protection (WRP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

RM0454 Rev 2 3/921
RM0454 Contents
26
3.6 FLASH interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
3.7 FLASH registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
3.7.1 FLASH access control register (FLASH_ACR) . . . . . . . . . . . . . . . . . . . 68
3.7.2 FLASH key register (FLASH_KEYR) . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
3.7.3 FLASH option key register (FLASH_OPTKEYR) . . . . . . . . . . . . . . . . . . 69
3.7.4 FLASH status register (FLASH_SR) . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
3.7.5 FLASH control register (FLASH_CR) . . . . . . . . . . . . . . . . . . . . . . . . . . 71
3.7.6 FLASH ECC register (FLASH_ECCR) . . . . . . . . . . . . . . . . . . . . . . . . . 73
3.7.7 FLASH option register (FLASH_OPTR) . . . . . . . . . . . . . . . . . . . . . . . . 73
3.7.8 FLASH WRP area A address register (FLASH_WRP1AR) . . . . . . . . . . 75
3.7.9 FLASH WRP area B address register (FLASH_WRP1BR) . . . . . . . . . . 75
3.7.10 FLASH register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
4 Power control (PWR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
4.1 Power supplies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
4.1.1 ADC reference voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
4.1.2 Battery backup of RTC domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
4.1.3 Voltage regulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
4.1.4 Dynamic voltage scaling management . . . . . . . . . . . . . . . . . . . . . . . . . 80
4.2 Power supply supervisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
4.2.1 Power-on reset (POR) / power-down reset (PDR) . . . . . . . . . . . . . . . . . 81
4.3 Low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
4.3.1 Run mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
4.3.2 Low-power run mode (LP run) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
4.3.3 Low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
4.3.4 Sleep mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4.3.5 Low-power sleep mode (LP sleep) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4.3.6 Stop 0 mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
4.3.7 Stop 1 mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
4.3.8 Standby mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
4.3.9 Auto-wakeup from low-power mode . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
4.4 PWR registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
4.4.1 Power control register 1 (PWR_CR1) . . . . . . . . . . . . . . . . . . . . . . . . . . 96
4.4.2 Power control register 3 (PWR_CR3) . . . . . . . . . . . . . . . . . . . . . . . . . . 97
4.4.3 Power control register 4 (PWR_CR4) . . . . . . . . . . . . . . . . . . . . . . . . . . 98
4.4.4 Power status register 1 (PWR_SR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

Contents RM0454
4/921 RM0454 Rev 2
4.4.5 Power status register 2 (PWR_SR2) . . . . . . . . . . . . . . . . . . . . . . . . . . 100
4.4.6 Power status clear register (PWR_SCR) . . . . . . . . . . . . . . . . . . . . . . . 101
4.4.7 Power Port A pull-up control register (PWR_PUCRA) . . . . . . . . . . . . . 102
4.4.8 Power Port A pull-down control register (PWR_PDCRA) . . . . . . . . . . 102
4.4.9 Power Port B pull-up control register (PWR_PUCRB) . . . . . . . . . . . . . 103
4.4.10 Power Port B pull-down control register (PWR_PDCRB) . . . . . . . . . . 103
4.4.11 Power Port C pull-up control register (PWR_PUCRC) . . . . . . . . . . . . 104
4.4.12 Power Port C pull-down control register (PWR_PDCRC) . . . . . . . . . . 104
4.4.13 Power Port D pull-up control register (PWR_PUCRD) . . . . . . . . . . . . 105
4.4.14 Power Port D pull-down control register (PWR_PDCRD) . . . . . . . . . . 105
4.4.15 Power Port F pull-up control register (PWR_PUCRF) . . . . . . . . . . . . . 106
4.4.16 Power Port F pull-down control register (PWR_PDCRF) . . . . . . . . . . 106
4.4.17 PWR register map and reset value table . . . . . . . . . . . . . . . . . . . . . . . 108
5 Reset and clock control (RCC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
5.1 Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110
5.1.1 Power reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
5.1.2 System reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
5.1.3 RTC domain reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
5.2 Clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .112
5.2.1 HSE clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
5.2.2 HSI16 clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
5.2.3 PLL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
5.2.4 LSE clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
5.2.5 LSI clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
5.2.6 System clock (SYSCLK) selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
5.2.7 Clock source frequency versus voltage scaling . . . . . . . . . . . . . . . . . . 119
5.2.8 Clock security system (CSS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
5.2.9 Clock security system for LSE clock (LSECSS) . . . . . . . . . . . . . . . . . 120
5.2.10 ADC clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
5.2.11 RTC clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
5.2.12 Timer clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
5.2.13 Watchdog clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
5.2.14 Clock-out capability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
5.2.15 Internal/external clock measurement with TIM14/TIM16/TIM17 . . . . . 122
5.2.16 Peripheral clock enable registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
5.3 Low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

RM0454 Rev 2 5/921
RM0454 Contents
26
5.4 RCC registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
5.4.1 Clock control register (RCC_CR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
5.4.2 Internal clock sources calibration register (RCC_ICSCR) . . . . . . . . . . 127
5.4.3 Clock configuration register (RCC_CFGR) . . . . . . . . . . . . . . . . . . . . . 128
5.4.4 PLL configuration register (RCC_PLLCFGR) . . . . . . . . . . . . . . . . . . . 130
5.4.5 Clock interrupt enable register (RCC_CIER) . . . . . . . . . . . . . . . . . . . . 132
5.4.6 Clock interrupt flag register (RCC_CIFR) . . . . . . . . . . . . . . . . . . . . . . 133
5.4.7 Clock interrupt clear register (RCC_CICR) . . . . . . . . . . . . . . . . . . . . . 134
5.4.8 I/O port reset register (RCC_IOPRSTR) . . . . . . . . . . . . . . . . . . . . . . . 135
5.4.9 AHB peripheral reset register (RCC_AHBRSTR) . . . . . . . . . . . . . . . . 136
5.4.10 APB peripheral reset register 1 (RCC_APBRSTR1) . . . . . . . . . . . . . . 137
5.4.11 APB peripheral reset register 2 (RCC_APBRSTR2) . . . . . . . . . . . . . . 139
5.4.12 I/O port clock enable register (RCC_IOPENR) . . . . . . . . . . . . . . . . . . 140
5.4.13 AHB peripheral clock enable register (RCC_AHBENR) . . . . . . . . . . . 141
5.4.14 APB peripheral clock enable register 1 (RCC_APBENR1) . . . . . . . . . 142
5.4.15 APB peripheral clock enable register 2(RCC_APBENR2) . . . . . . . . . . 144
5.4.16 I/O port in Sleep mode clock enable register (RCC_IOPSMENR) . . . 145
5.4.17 AHB peripheral clock enable in Sleep/Stop mode register
(RCC_AHBSMENR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
5.4.18 APB peripheral clock enable in Sleep/Stop mode register 1
(RCC_APBSMENR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
5.4.19 APB peripheral clock enable in Sleep/Stop mode register 2
(RCC_APBSMENR2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
5.4.20 Peripherals independent clock configuration register (RCC_CCIPR) . 150
5.4.21 RTC domain control register (RCC_BDCR) . . . . . . . . . . . . . . . . . . . . . 152
5.4.22 Control/status register (RCC_CSR) . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
5.4.23 RCC register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
6 General-purpose I/Os (GPIO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
6.2 GPIO main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
6.3 GPIO functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
6.3.1 General-purpose I/O (GPIO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
6.3.2 I/O pin alternate function multiplexer and mapping . . . . . . . . . . . . . . . 161
6.3.3 I/O port control registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
6.3.4 I/O port data registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
6.3.5 I/O data bitwise handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
6.3.6 GPIO locking mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
剩余920页未读,继续阅读
















安全验证
文档复制为VIP权益,开通VIP直接复制

评论0