
CH32V003
Reference Manual
V1.3
172
Each bit represents 1K bytes (16 pages) of
storage write protection status.
Note: WPR is loaded from the user-selected word area after a system reset.
16.3.9 Extended key register (FLASH_MODEKEYR)
Offset address: 0x24
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
MODEKEYR[31:16]
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
MODEKEYR[15:0]
Bit
Name
Access
Description
Reset value
[31:0]
MODEKEYR
WO
Enter the following sequence to unlock the
fast programming/erase mode.
KEY1 = 0x45670123.
KEY2 = 0xCDEF89AB.
X
16.3.10 BOOT key register (FLASH_BOOT_MODEKEYP)
Offset address: 0x28
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
MODEKEYR[31:16]
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
MODEKEYR[15:0]
Bit
Name
Access
Description
Reset value
[31:0]
MODEKEYR
WO
Enter the following sequence to unlock the
BOOT area
KEY1 = 0x45670123.
KEY2 = 0xCDEF89AB.
X
16.4 Flash memory operation flow
16.4.1 Read operations
With direct addressing in the general address space, any read operation of 8/16/32-bit data can access the
contents of the flash module and get the corresponding data.
16.4.2 Unlocking the flash memory
After a system reset, the flash controller (FPEC) and FLASH_CTLR registers are locked and inaccessible. The
flash controller module can be unlocked by writing a sequence to the FLASH_KEYR register.
Unlock sequence.
1)
Write KEY1 = 0x45670123 to the FLASH_KEYR register (step 1 must be KEY1).
2)
Write KEY2 = 0xCDEF89AB to FLASH_KEYR register (step 2 must be KEY2).
The above operations must be executed sequentially and consecutively, otherwise they are error operations
and will lock the FPEC module and FLASH_CTLR registers and generate bus errors until the next system
reset.
The flash memory controller (FPEC) and FLASH_CTLR registers can be locked again by setting the "LOCK"
bit of the FLASH_CTLR register to 1.