Sign In
Upload
Download
Table of Contents
Contents
Add to my manuals
Delete from my manuals
Share
URL of this page:
HTML Link:
Bookmark this page
Add
Manual will be automatically added to "My Manuals"
×
Bookmark added
×
Added to my manuals
Manuals
Brands
WCH Manuals
Microcontrollers
CH32V003 Series
Reference manual
Table Of Contents - WCH CH32V003 Series Reference Manual
Hide thumbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
Table Of Contents
182
page
of
182
Go
/
182
Contents
Table of Contents
Bookmarks
Table of Contents
Advertisement
Table of Contents
Overview
1
Memory And Bus Architecture
2
Memory Image
4
Memory Allocation
5
Power Control (Pwr)
6
Power Management
6
Power-On Reset And Power-Down Reset
6
Programmable Voltage Detector
6
Low-Power Modes
7
Low-Power Configuration Options
8
Sleep Mode
8
Standby Mode
8
Auto-Wakeup (Awu)
8
Register Description
9
Power Control Register (Pwr_Ctlr)
9
Power Control/Status Register (Pwr_Csr)
9
Auto-Wakeup Control/Status Register (Pwr_Awucsr)
10
Auto-Wakeup Window Comparison Value Register (Pwr_ Awuwr)
10
Reset And Clock Control (Rcc)
12
Power Reset
12
System Reset
12
System Clock Structure
14
High-Speed Clock (Hsi/Hse)
15
Low-Speed Clock (Lsi)
16
Pll Clock
16
Bus/Peripheral Clock
16
Independent Watchdog Clock
16
Clock Security System
17
Clock Control Register (Rcc_Ctlr)
17
Microcontroller Clock Output (Mco)
17
Rcc-Related Registers List
17
Clock Configuration Register0 (Rcc_Cfgr0)
19
Clock Interrupt Register (Rcc_Intr)
20
Apb2 Peripheral Reset Register (Rcc_Apb2Prstr)
21
Apb1 Peripheral Reset Register
22
Ahb Peripheral Clock Enable Register
22
Apb2 Peripheral Clock Enable Register
23
Apb1 Peripheral Clock Enable Register
24
Control/Status Register
24
Independent Watchdog (Iwdg)
26
Enable Independent Watchdog
26
Watchdog Configuration
26
Control Register (Iwdg_Ctlr)
27
Debug Mode
27
Prescaler Register
27
Reload Register
28
Status Register
28
Window Watchdog (Wwdg)
29
Enable Window Watchdog
29
Watchdog Reset
30
Wake Up In Advance
30
Wwdg-Related Registers List
31
Control Register (Wwdg_Ctlr)
31
Configuration Register (Wwdg_Cfgr)
31
Status Register (Wwdg_Statr)
32
Interrupt And Events (Pfic)
33
Pfic Controller
33
System Timer
33
Vector Table Of Interrupts And Exceptions
33
External Interrupt And Event Controller (Exti)
34
Wake-Up Event
34
External Interrupt (Exti) Interface Block Diagram
34
External Event Mapping
35
Exti Registers
35
Exti Interrupt Mapping
35
Interrupt Enable Register (Exti_Intenr)
36
Event Enable Register (Exti_Evenr)
36
Rising Edge Trigger Enable Register (Exti_Rtenr)
36
Falling Edge Trigger Enable Register (Exti_Ftenr)
36
Pfic Registers
37
Software Interrupt Event Register (Exti_Swievr)
37
Interrupt Flag Register (Exti_Intfr)
37
Pfic Interrupt Enable Status Register 1
38
Pfic Interrupt Enable Status Register 2
39
Pfic Interrupt Pending Status Register 1
39
Pfic Interrupt Pending Status Register 2
40
Pfic Interrupt Priority Threshold Configuration Register
40
Pfic Interrupt Configuration Register (Pfic_Cfgr)
40
Pfic Interrupt Global Status Register (Pfic_Gisr)
41
Pfic Vtf Interrupt Id Configuration Register (Pfic_Vtfidr)
41
Pfic Vtf Interrupt 0 Address Register (Pfic_Vtfaddrr0)
41
Pfic Vtf Interrupt 1 Address Register (Pfic_Vtfaddrr1)
42
Pfic Interrupt Enable Setting Register 1 (Pfic_Ienr1)
42
Pfic Interrupt Enable Setting Register 2 (Pfic_Ienr2)
42
Pfic Interrupt Enable Clear Register 1 (Pfic_Irer1)
43
Pfic Interrupt Enable Clear Register 2 (Pfic_Irer2)
43
Pfic Interrupt Pending Setup Register 1 (Pfic_Ipsr1)
43
Pfic Interrupt Pending Setup Register 2 (Pfic_Ipsr2)
44
Pfic Interrupt Pending Clear Register 1 (Pfic_Ipsr1)
44
Pfic Interrupt Pending Clear Register 2 (Pfic_Ipsr2)
45
Pfic Interrupt Activation Status Register 1 (Pfic_Iactr1)
45
Pfic Interrupt Activation Status Register 2 (Pfic_Iactr2)
46
Pfic Interrupt Priority Configuration Register (Pfic_Ipriorx)
46
Pfic System Control Register (Pfic_Sctlr)
46
Dedicated Csr Registers
47
Interrupt System Control Register (Intsyscr)
47
Exception Entry Base Address Register (Mtvec)
48
Stk Register Description
48
System Count Control Register (Stk_Ctlr)
48
System Count Status Register (Stk_Sr)
49
System Counter Register (Stk_Cntl)
49
Counting Comparison Register (Stk_Cmplr)
50
Gpio And Alternate Function (Gpio/Afio)
51
Gpio Module Basic Structure Block Diagram
51
Gpio Initialization Function
52
External Interrupts
52
Multiplexing Functions
52
Gpio Module Input Configuration Structure Block Diagram
52
Gpio Module Output Configuration Structure Block Diagram
53
Multiplexing Function Configuration
53
Analog Input Configuration
54
Gpio Settings For Peripherals
54
Gpio Register Description
55
Port Configuration Register Low (Gpiox_Cfglr)
56
Port Input Register (Gpiox_Indr)
56
Port Output Register (Gpiox_Outdr) (X=A/C/D)
57
Port Reset/Set Register (Gpiox_Bshr) (X=A/C/D)
57
Port Reset Register (Gpiox_Bcr) (X=A/C/D)
57
Afio Register Description
58
Port Configuration Lock Register (Gpiox_Lckr) (X=A/C/D)
58
Remap Register 1 (Afio_Pcfr1)
58
External Interrupt Configuration Register 1 (Afio_Exticr)
60
Direct Memory Access Control (Dma)
62
Dma Channel Processing
62
Arbitration Priority
62
Dma Configuration
62
Programmable Total Data Transfer Size/Data Bit Width/Alignment
63
Circular Mode
63
Dma Processing Status
63
Dma Request Mapping
64
Dma-Related Registers List
65
Dma1 Request Image
65
Dma1 Peripheral Mapping Table For Each Channel
65
Dma Interrupt Status Register (Dma_Intfr)
66
Dma Interrupt Flag Clear Register (Dma_Intfcr)
66
Dma Channel X Configuration Register (Dma_Cfgrx)
67
Dma Channel X Number Of Data Register (Dma_Cntrx)
68
Dma Channel X Peripheral Address Register (Dma_Paddrx)
69
Dma Channel X Memory Address Register (Dma_Maddrx)
69
Analog-To-Digital Converter (Adc)
70
Adc Module Block Diagram
71
Adc Configuration
71
Module Power-Up
71
Sampling Clock
71
Channel Configuration
72
Calibration
72
Programmable Sampling Time
72
Data Alignment
72
External Trigger Source
73
Conversion Mode
73
Single Single-Channel Conversion Mode
74
Single Scan Mode Conversion
74
Single Intermittent Mode Conversion
75
Trigger Injection
75
Auto-Injection
75
Simulating A Watchdog
76
Continuous Conversion
76
Analog Watchdog Threshold Area
76
Analog Watchdog Channel Selection
76
Adc-Related Registers List
77
Adc Status Register (Adc_Statr)
77
Adc Control Register 1 (Adc_Ctlr1)
78
Adc Control Register 2 (Adc_Ctlr2)
79
Adc Sample Time Configuration Register 1 (Adc_Samptr1)
81
Adc Sample Time Configuration Register 2 (Adc_Samptr2)
81
Adc Injected Channel Data Offset Register X (Adc_Iofrx)
81
Adc Watchdog High Threshold Register (Adc_Wdhtr)
82
Adc Watchdog Low Threshold Register (Adc_Wdhtr)
82
Adc Regular Sequence Register 1(Adc_Rsqr1)
82
Adc Regular Sequence Register 2(Adc_Rsqr2)
83
Adc Regular Sequence Register 3(Adc_Rsqr3)
83
Adc Injected Sequence Register (Adc_Isqr)
84
Adc Injected Data Register (Adc_Idatarx)
84
Adc Regular Data Register (Adc_Rdatar)
84
Adc Delayed Data Register (Adc_Dlyr)
85
Advanced-Control Timer (Adtm)
86
Block Diagram Of Advanced-Control Timer Structure
87
Clock Input
88
Internal Clock Source (Ck_Int)
88
External Clock Source Mode1/2
88
Block Diagram Of Ck_Psc Source For Advanced-Control Timer
88
Counters And Peripherals
89
Comparing Capture Channels And Perimeters
89
Encoder Mode
89
Block Diagram Of The Structure Of The Comparison Capture Channel
90
Functionality And Implementation
91
Input Capture Mode
91
Compare Output Modes
91
Forced Output Mode
92
Pwm Input Mode
92
Pwm Output Mode
92
Complementary Outputs And Dead Zones
92
Brake Signal
93
Single Pulse Mode
93
Complementary Outputs And Deadband
93
Generation Of Single Pulse
94
Tim1-Related Registers List
95
Timer Synchronization Mode
95
Control Register 1 (Tim1_Ctlr1)
95
Control Register 2 (Tim1_Ctlr2)
97
Slave Mode Control Register (Tim1_Smcfgr)
98
Dma/Interrupt Enable Register (Tim1_Dmaintenr)
100
Interrupt Status Register (Tim1_Intfr)
101
Event Generation Register (Tim1_Swevgr)
102
Compare/Capture Control Register 1 (Tim1_Chctlr1)
104
Compare/Capture Control Register 2 (Tim1_Chctlr2)
106
Compare/Capture Enable Register 2 (Tim1_Ccer)
107
Counter For Advanced-Control Timer (Tim1_Cnt)
108
Counting Clock Prescaler (Tim1_Psc)
108
Auto-Reload Value Register (Tim1_Atrlr)
108
Repeat Count Value Register (Tim1_Rptcr)
108
Compare/Capture Register
109
Brake And Deadband Register
109
Dma Control Register (Tim1_Dmacfgr)
110
General-Purpose Timer (Gptm)
112
Difference Between General-Purpose Timer And Advanced-Control Timer
113
General Timer Ck_Psc Source Block Diagram
113
Comparing Capture Channels
114
Compare Output Mode
116
Tim2-Related Registers List
119
Control Register 1 (Tim2_Ctlr1)
119
Control Register 2 (Tim2_Ctlr2)
121
Slave Mode Control Register (Tim2_Smcfgr)
122
Interrupt Status Register (Tim2_Intfr)
125
Compare/Capture Control Register 1 (Tim2_Chctlr1)
126
Compare/Capture Control Register 2 (Tim2_Chctlr2)
129
Compare/Capture Enable Register (Tim2_Ccer)
130
Counter For General-Purpose Timer (Tim2_Cnt)
130
Counting Clock Prescaler (Tim2_Psc)
131
Auto-Reload Value Register (Tim2_Atrlr)
131
Compare/Capture Registers
131
Dma Control Register (Tim2_Dmacfgr)
132
Dma Address Register For Continuous Mode (Tim2_Dmaadr)
132
Universal Synchronous Asynchronous Receiver Transmitter (Usart)
133
Baud Rate Generator
134
Synchronous Mode
134
Single-Wire Half-Duplex Mode
135
Smart Card
135
Irda
136
Dma
136
Interruptions
136
(Un)Occurrence Of Parity Error Diagram
136
Usart-Related Registers List
137
Usart Status Register (Usart_Statr)
137
Usart Data Register (Usart_Datar)
139
Usart Control Register 1 (Usart_Ctlr1)
140
Usart Control Register 2 (Usart_Ctlr2)
141
Usart Control Register 3 (Usart_Ctlr3)
142
Usart Guard Time And Prescaler Register (Usart_Gpr)
143
Inter-Integrated Circuit (I2C) Interface
144
I2C Timing Diagram
144
Master Mode
145
Slave Mode
146
Error Conditions
147
Bus Error (Berr)/Acknowledge Failure (Af)
147
Arbitration Lost (Arlo)
147
Overrun/Underrun Error (Ovr)
147
Clock Extension
148
Smbus
148
Transmission Using Dma
149
Reception Using Dma
149
Packet Error Checking
150
I2C-Related Registers List
150
I2C Control Register
150
I2C Own Address Register
152
I2C Data Register (I2C_Datar)
153
I2C Status Register
153
I2C Clock Register (I2C1_Ckcfgr)
156
Serial Peripheral Interface (Spi)
157
Spi Structure Block Diagram
157
Spi Mode
158
Simplex Mode
159
Crc
159
Errors
160
Spi-Related Registers List
160
Master Mode Fault (Modf)
160
Spi Control Register 2 (Spi1_Ctlr2)
161
Spi Status Register (Spi1_Statr)
162
Spi Status Register (Spi1_Datar)
163
Spi1 Polynomial Register (Spi1_Rcrcr)
163
Spi1 Receive Crc Register (Spi1_Tcrcr)
163
Spi1 Transmit Crc Register (Spi1_Tcrcr)
164
Spi High-Speed Control Register (Spi1_Hscr)
164
Electronic Signature (Esig)
165
Esig-Related Registers List
165
Flash Capacity Register (Esig_Flacap)
165
Uid Register
165
Flash Memory And User Option Bytes
167
Flash Memory Organization
167
Flash Memory Programming And Security
167
Security - Prevent Illegal Access (Read, Write, Erase)
167
Control Register (Flash_Actlr)
168
Fpec Key Register (Flash_Keyr)
168
Obkey Register (Flash_Obtkeyr)
168
Configuration Register (Flash_ Ctlr)
169
Address Register (Flash_ Addr)
170
Select Word Register (Flash_Obr)
171
Write Protect Register (Flash_Wpr)
171
Flash Memory Operation Flow
172
Unlocking The Flash Memory
172
Extended Key Register (Flash_Modekeyr)
172
Boot Key Register (Flash_Boot_Modekeyp)
172
Main Memory Standard Programming
173
Main Memory Standard Erase
173
Flash Page Erase
174
Flash Whole Chip Erase
174
Fast Programming Mode Unlocking
175
Main Memory Fast Programming
175
Main Memory Fast Erase
175
User-Selected Words
176
User-Selected Word Unlocking
177
User-Selected Word Programming
177
User-Selected Word Erasure
178
Unprotecting Reads
178
Extended Configuration
179
Configuring The Extended Control Register (Extend_Ctr)
179
Debug Support (Dbg)
181
Debug Mcu Configuration Register (Dbgmcu_Cr)
181
Previous
Page
1
...
181
182
Show Quick Links
Quick Links:
Overview
Hide quick links:
Permanently
Temporary
Cancel
Advertisement
Table of Contents
Table of Contents
Print
Rename the bookmark
Delete bookmark?
Delete from my manuals?
Login
Sign In
OR
Sign in with Facebook
Sign in with Google
Upload manual
Upload from disk
Upload from URL