N32G030 系列
32 位 ARM® Cortex®-M0 微控制器
用户手册
I
目录
1 文中的缩写 .......................................................................................................................................................... 1
寄存器描述表中使用的缩写列表 ...................................................................................................................... 1
可用的外设 .......................................................................................................................................................... 1
2 存储器和总线架构 ............................................................................................................................................... 2
系统架构 .............................................................................................................................................................. 2
总线架构
..................................................................................................................................................... 2
总线地址映射
............................................................................................................................................. 4
存储系统(MEMORY SYSTEM) ............................................................................................................................. 7
FLASH
规格
...................................................................................................................................................... 7
SRAM .............................................................................................................................................................. 17
FLASH
寄存器描述
........................................................................................................................................ 18
3 电源控制(PWR) .............................................................................................................................................. 25
电源系统简介 .................................................................................................................................................... 25
电源
........................................................................................................................................................... 25
上电复位(
POR
)和下电复位(
PDR
)
.................................................................................................. 26
可编程电压监测器(
PVD
)
..................................................................................................................... 27
电源管理 ............................................................................................................................................................ 27
低功耗模式 ........................................................................................................................................................ 28
LPRUN
模式
................................................................................................................................................... 29
SLEEP
模式
..................................................................................................................................................... 29
STOP
模式
...................................................................................................................................................... 30
PD
模式
.......................................................................................................................................................... 31
Debug
模式
.................................................................................................................................................... 31
PWR 寄存器 ....................................................................................................................................................... 32
PWR
寄存器映射图
....................................................................................................................................... 32
电源控制寄存器(
PWR_CTRL
)
.............................................................................................................. 33
电源控制状态寄存器(
PWR_CTRLSTS
)
................................................................................................ 34
电源控制寄存器
2
(
PWR_CTRL2
)
......................................................................................................... 35
电源控制寄存器
3
(
PWR_CTRL3
)
......................................................................................................... 35
电源控制寄存器
4
(
PWR_CTRL4
)
......................................................................................................... 36
电源控制寄存器
5
(
PWR_CTRL5
)
......................................................................................................... 37
电源控制寄存器
6
(
PWR_CTRL6
)
......................................................................................................... 37
调试控制寄存器(
DBG_CTRL
)
.............................................................................................................. 38
4 复位和时钟控制(RCC) .................................................................................................................................... 40
复位控制单元 .................................................................................................................................................... 40
电源复位
................................................................................................................................................... 40
系统复位
................................................................................................................................................... 40
II
时钟控制单元 .................................................................................................................................................... 41
HSE
时钟
........................................................................................................................................................ 43
HSI
时钟
......................................................................................................................................................... 44
PLL .................................................................................................................................................................. 45
LSE
时钟
......................................................................................................................................................... 45
LSI
时钟
.......................................................................................................................................................... 45
LSI
校准
.......................................................................................................................................................... 45
系统时钟(
SYSCLK
)选择
........................................................................................................................ 46
时钟安全系统(
CLKSS
)
.......................................................................................................................... 46
RTC
时钟
........................................................................................................................................................ 46
LPUART
时钟
.............................................................................................................................................. 46
LPTIME
时钟
.............................................................................................................................................. 47
时钟输出
................................................................................................................................................... 47
RCC 寄存器 ........................................................................................................................................................ 47
RCC
寄存器地址映像
.................................................................................................................................... 47
时钟控制寄存器(
RCC_CTRL
)
............................................................................................................... 48
时钟配置寄存器(
RCC_CFG
)
................................................................................................................. 50
时钟中断寄存器(
RCC_CLKINT
)
............................................................................................................ 52
APB2
外设复位寄存器(
RCC_APB2PRST
)
................................................................................................. 55
APB1
外设复位寄存器(
RCC_APB1PRST
)
................................................................................................. 56
AHB
外设时钟使能寄存器(
RCC_AHBPCLKEN
)
........................................................................................ 58
APB2
外设时钟使能寄存器(
RCC_APB2PCLKEN
)
..................................................................................... 59
APB1
外设时钟使能寄存器(
RCC_APB1PCLKEN
)
..................................................................................... 60
低速时钟控制寄存器(
RCC_LSCTRL
)
.................................................................................................... 62
控制
/
状态寄存器(
RCC_CTRLSTS
)
........................................................................................................ 63
AHB
外设复位寄存器(
RCC_AHBPRST
)
................................................................................................ 65
时钟配置寄存器
2
(
RCC_CFG2
)
............................................................................................................ 65
EMC
控制寄存器(
RCC_EMCCTRL
)
....................................................................................................... 67
5 GPIO 和 AFIO ....................................................................................................................................................... 71
概述 ................................................................................................................................................................... 71
IO 功能描述 ....................................................................................................................................................... 72
IO
模式配置
................................................................................................................................................... 72
复位后状态
............................................................................................................................................... 77
单独的位设置和位清除
........................................................................................................................... 77
外部中断
/
唤醒线
...................................................................................................................................... 78
复用功能
................................................................................................................................................... 78
外设的
IO
配置
.......................................................................................................................................... 88
GPIO
锁定机制
.............................................................................................................................................. 90
GPIO 寄存器 ...................................................................................................................................................... 90
GPIO
寄存器地址映像
.................................................................................................................................. 90
GPIO
端口模式寄存器(
GPIOx_PMODE
)
.................................................................................................. 92
GPIO
端口输出类型寄存器(
GPIOx_POTYPE
)
.......................................................................................... 92
III
GPIO
翻转率配置寄存器(
GPIOx_SR
)
....................................................................................................... 93
GPIO
端口上下拉寄存器(
GPIOx_PUPD
)
................................................................................................. 93
GPIO
端口输入数据寄存器(
GPIOx_PID
)
................................................................................................. 94
GPIO
端口输出数据寄存器(
GPIOx_POD
)
................................................................................................ 94
GPIO
端口位设置
/
清除寄存器(
GPIOx_PBSC
)
......................................................................................... 95
GPIO
端口锁定置寄存器(
GPIOx_PLOCK
)
................................................................................................ 95
GPIO
复用功能低配置寄存器(
GPIOx_AFL
)
......................................................................................... 96
GPIO
复用功能高配置寄存器(
GPIOx_AFH
)
........................................................................................ 97
GPIO
端口位清除寄存器(
GPIOx_PBC
)
................................................................................................ 98
GPIO
驱动能力配置寄存器(
GPIOx_DS
)
.............................................................................................. 98
AFIO 寄存器 ....................................................................................................................................................... 99
AFIO
寄存器地址映像
................................................................................................................................... 99
AFIO
配置寄存器(
AFIO_ CFG
)
.................................................................................................................. 99
AFIO
外部中断配置寄存器
1
(
AFIO_EXTI_CFG1
)
................................................................................... 100
AFIO
外部中断配置寄存器
2
(
AFIO_EXTI_CFG2
)
................................................................................... 101
AFIO
外部中断配置寄存器
3
(
AFIO_EXTI_CFG3
)
................................................................................... 101
AFIO
外部中断配置寄存器
4
(
AFIO_EXTI_CFG4
)
................................................................................... 102
6 中断和事件 ....................................................................................................................................................... 103
嵌套向量中断寄存器 ...................................................................................................................................... 103
系统嘀嗒(
SysTick
)校准值寄存器
...................................................................................................... 103
中断和异常向量
..................................................................................................................................... 103
外部中断/事件控制器(EXTI) ..................................................................................................................... 105
EXTI
简介
..................................................................................................................................................... 105
EXTI
主要特性
............................................................................................................................................. 105
功能描述
................................................................................................................................................. 106
EXTI
线路映像
............................................................................................................................................. 107
EXTI 寄存器 ...................................................................................................................................................... 108
EXTI
寄存器地址映像
.................................................................................................................................. 108
EXTI
中断屏蔽寄存器(
EXTI_IMASK
)
...................................................................................................... 108
EXTI
事件屏蔽寄存器(
EXTI_EMASK
)
..................................................................................................... 109
EXTI
上升沿触发配置寄存器(
EXTI_RT_CFG
)
........................................................................................ 109
EXTI
下降沿触发配置寄存器(
EXTI_FT_CFG
)
......................................................................................... 109
EXTI
软件中断事件寄存器(
EXTI_SWIE
)
................................................................................................. 110
EXTI
挂起寄存器(
EXTI_PEND
)
................................................................................................................ 110
EXTI
时间戳触发源选择寄存器(
EXTI_TS_SEL
)
...................................................................................... 111
7 DMA 控制器 ...................................................................................................................................................... 112
DMA 简介 ........................................................................................................................................................ 112
DMA 主要特性 ................................................................................................................................................ 112
功能框图 .......................................................................................................................................................... 113
功能描述 .......................................................................................................................................................... 113
DMA
处理
.................................................................................................................................................... 113
IV
仲裁器
..................................................................................................................................................... 114
DMA
通道
.................................................................................................................................................... 114
可编程的数据传输宽度、对齐方式和数据大小端
.............................................................................. 115
错误管理
................................................................................................................................................. 117
中断
......................................................................................................................................................... 117
DMA
请求映像
............................................................................................................................................ 117
DMA 寄存器 .................................................................................................................................................... 118
DMA
寄存器地址映像
................................................................................................................................ 118
DMA
中断状态寄存器(
DMA_INTSTS
)
................................................................................................... 119
DMA
中断标志清除寄存器(
DMA_INTCLR
)
.......................................................................................... 120
DMA
通道
x
配置寄存器(
DMA_CHCFGx
)
............................................................................................ 121
DMA
通道
x
传输数量寄存器(
DMA_TXNUMx
)
.................................................................................. 122
通道
x
外设基地址寄存器(
DMA_PADDRx
)
....................................................................................... 123
通道
x
存储器基地址寄存器(
DMA_MADDRx
)
................................................................................. 123
DMA
通道
x
请求选择寄存器(
DMA_CHSELx
)
....................................................................................... 124
8 循环冗余校验(CRC) ...................................................................................................................................... 125
CRC 简介 .......................................................................................................................................................... 125
CRC 主要特性 .................................................................................................................................................. 125
CRC32 ........................................................................................................................................................... 125
CRC16 ........................................................................................................................................................... 125
CRC 功能描述 .................................................................................................................................................. 126
CRC32 ........................................................................................................................................................... 126
CRC16 ........................................................................................................................................................... 126
CRC 寄存器 ...................................................................................................................................................... 126
CRC
寄存器映像
.......................................................................................................................................... 126
CRC32
数据寄存器(
CRC_CRC32DAT
)
..................................................................................................... 127
CRC32
独立数据寄存器(
CRC_CRC32IDAT
)
............................................................................................ 127
CRC32
控制寄存器(
CRC_CRC32CTRL
)
.................................................................................................... 127
CRC16
控制寄存器(
CRC_CRC16CTRL
)
.................................................................................................... 128
CRC16
待校验数据寄存器(
CRC_CRC16DAT
)
......................................................................................... 128
CRC
循环冗余校验码寄存器(
CRC_CRC16D
)
......................................................................................... 129
LRC
校验值寄存器(
CRC_LRC
)
................................................................................................................. 129
9
高级控制定时器(
TIM1
和
TIM8
)
..................................................................................................................... 131
TIM1
和
TIM8
简介
............................................................................................................................................ 131
TIM1
和
TIM8
主要特性
.................................................................................................................................... 131
TIM1
和
TIM8
功能描述
.................................................................................................................................... 133
时基单元
.................................................................................................................................................. 133
计数器模式
.............................................................................................................................................. 134
重复计数器
.............................................................................................................................................. 143
时钟选择
.................................................................................................................................................. 144
捕获
/
比较通道
......................................................................................................................................... 147