Flash Memory Operation Flow; Unlocking The Flash Memory; Extended Key Register (Flash_Modekeyr); Boot Key Register (Flash_Boot_Modekeyp) - WCH CH32V003 Series Reference Manual

Table of Contents

Advertisement

CH32V003 Reference Manual
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
15
14
13
12
Bit
Name
[31:0]
MODEKEYR

16.3.10 BOOT key register (FLASH_BOOT_MODEKEYP)

Offset address: 0x28
31
30
29
28
15
14
13
12
Bit
Name
[31:0]
MODEKEYR

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.
V1.3
Each bit represents 1K bytes (16 pages) of
storage write protection status.
27
26
25
24
MODEKEYR[31:16]
11
10
9
8
MODEKEYR[15:0]
Access
Enter the following sequence to unlock the
fast programming/erase mode.
WO
KEY1 = 0x45670123.
KEY2 = 0xCDEF89AB.
27
26
25
24
MODEKEYR[31:16]
11
10
9
8
MODEKEYR[15:0]
Access
Enter the following sequence to unlock the
BOOT area
WO
KEY1 = 0x45670123.
KEY2 = 0xCDEF89AB.
23
22
21
7
6
5
Description
23
22
21
7
6
5
Description
172
http://wch.cn
20
19
18
17
4
3
2
1
Reset value
X
20
19
18
17
4
3
2
1
Reset value
X
16
0
16
0

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents