
CH32V003
Reference Manual
V1.3
167
Chapter 16 Flash Memory and User Option Bytes
16.1 Flash memory organization
The internal flash memory of the chip is organized as follows.
Table 16-1 Flash Memory Organization
Block
Name
Address Range
Size(byte)
Main
memory
Page 0
0x0800 0000
–
0x0800 003F
64
Page 1
0x0800 0040
–
0x0800 007F
64
Page 2
0x0800 0080
–
0x0800 00BF
64
Page 3
0x0800 00C0
–
0x0800 00FF
64
…
…
…
Page 256
0x0800 3FC0
–
0x0800 3FFF
64
Information
block
Launcher code
0x1FFF F000
–
0x1FFF F77F
2K-128
User option bytes
0x1FFF F800
–
0x1FFF F83F
64
Notes: The above main memory area is used for user's application storage and is write-protected in 1K byte
(16 pages) units; except for the "vendor configuration word" area which is factory locked and inaccessible to
the user, the other areas are user-operable under certain conditions.
16.2 Flash memory programming and security
16.2.1 Two programming/erasing methods
l
Standard programming: This mode is the default programming mode (compatible mode). In this mode,
the CPU performs programming in single 2-byte mode and performs erase and whole erase operation in
single 1K byte.
l
Fast programming: This method uses the page operation method (recommended). After a specific
sequence of unlocking, a single 64-byte programming and 64-byte erasure, 1Kbyte erasure and whole-
piece erasure are performed.
16.2.2 Security - prevent illegal access (read, write, erase)
l
Page write protection
l
Read protection
When the chip is in the read-protected state.
1)
Main memory pages 0-32 (2K bytes) are automatically write-protected state, not controlled by
FLASH_WPR register; unread-protected state, all main memory pages are controlled by FLASH_WPR
register.
2)
The system boot code area, SDI mode, and RAM area are not erasable or programmable for main memory,
except for whole chip erasure. User-selected word areas can be erased or programmed. If an attempt is
made to unprotect the read (program the user word), the chip will automatically erase the entire user area.
Note: The internal RC oscillator (HSI) must be turned on when performing a program/erase operation of the
flash memory.
16.3 Register description
Table 16-2 FLASH-related registers list
Name
Access
address
Description
Reset value
R32_FLASH_ACTLR
0x40022000 Control register
0x00000000