
CH32V003
Reference Manual
V1.3
176
2)
Check the FLASH_CTLR register FLOCK bit, if it is 1, you need to execute the "fast programming mode
unlock" operation.
3)
Check the BSY bit of the FLASH_STATR register to confirm that there are no other programming
operations in progress.
4)
Set the PAGE_ER bit of FLASH_CTLR register to '1' to enable the fast page erase (64 bytes) mode
function.
5)
Write the first address of the fast erase page to the FLASH_ADDR register.
6)
Set the STAT bit of FLASH_CTLR register to '1' to initiate a fast page erase (64 bytes) action.
7)
Wait for the BSY bit to become '0' or the EOP bit of FLASH_STATR register to be '1' to indicate the end
of erase, and clear the EOP bit to 0.
8)
Query FLASH_STATR register to see if there is an error, or read the erase page address data checksum.
9)
Continue fast page erase can repeat steps 5-8, end erase will PAGE_ER bit clear 0.
16.5 User-selected words
The user-selected word is solidified in FLASH and will be reloaded into the corresponding register after system
reset, and can be erased and programmed by the user at will. The user select word information block has a
total of 8 bytes (4 bytes for write protection, 1 byte for read protection, 1 byte for configuration options, and
2 bytes for storing user data), and each bit has its inverse code bit for checksum during loading. The following
describes the structure and meaning of the select word information.
Table 16-3 32-bit selection word format division
[31:24]
[23:16]
[15:8]
[7:0]
Select word byte 1
inverse code
Select word byte 1
Select word byte 0
inverse code
Select word byte 0
Table 16-4 User selection word information structure
Address
Bit
[31:24]
[23:16]
[15:8]
[7:0]
0x1FFFF800
nUSER
USER
nRDPR
RDPR
0x1FFFF804
nData1
Data1
nData0
Data0
0x1FFFF808
nWRPR1
WRPR1
nWRPR0
WRPR0
0x1FFFF80C
nWRPR3
WRPR3
nWRPR2
WRPR2
Name/Byte
Description
Reset value
RDPR
Read protection control bit to configure whether the code
in the flash memory can be read out.
0xA5: if this byte is 0xA5 (nRDP must be 0x5A), it
means that the current code is in a non-read protected
state and can be read out.
Other values: indicates code read protection status, not
readable, pages 0-31 (4K) will be automatically write
protected and not controlled by WRPR0.
0x01
USER
[4:3]
RST_MOD
E
PD7 multiplexed as external pin reset.
00: Ignoring pin states within 128us after turning on the
multiplexing function.
01: Ignoring pin states within 1ms after turning on the
multiplexing function.
10: Ignoring pin states within 12ms after turning on the
multiplexing function.
11: Multiplexing function off, PD7 for I/O function.
11