
CH32V003
Reference Manual
V1.3
177
2
STANDBY
_RST
Low-power management reset configuration for standby
mode.
1: Enabling low-power management reset for Standby
mode.
0: Disable low-power management reset for Standby
mode.
1
1
Reserved Reserved
1
0
IWDG_SW
Independent Watchdog (IWDG) hardware enable
configuration.
1: IWDG is enabled by software and disabled from being
enabled by hardware.
0: IWDG is turned on by hardware itself (since the clock
for IWDG is provided by LSI, it is automatically turned
on by LSI).
Note: The core stops in debug mode and the
watchdog
hardware enable will be disabled.
1
Data0
–
Data1
Store 2 bytes of user data.
FFFFh
WRPR0 - WRPR3
Write-protect control bits. Each bit is used to control the
write-protect status of 1 sector (1K bytes/sector) in main
memory.
1: Turn off write protection.
0: Write protection is enabled.
4 bytes are used to protect a total of 16K bytes of main
memory.
WRPO: sector 0-3 storage write protection control.
WRP1: sector 4-7 storage write protection control.
WRP2: Sector 8-11 storage write protection control.
WRP3: Write protection for sectors 12-15.
FFFFFFFFh
16.5.1 User-selected word unlocking
The user select word operation can be unlocked by writing a sequence to the FLASH_OBKEYR register. After
unlocking, the OBWRE bit of FLASH_CTLR register will be set to 1, indicating that the user select word can
be erased and programmed. It can be locked again by clearing the "OBWRE" bit of FLASH_CTLR register to
0 by software.
Unlock sequence.
1)
Write KEY1 = 0x45670123 to FLASH_OBKEYR register.
2)
Write KEY2 = 0xCDEF89AB to FLASH_OBKEYR register.
Note: User-selected word operation requires unlocking the "LOCK" and "OBWRE" layers.
16.5.2 User-selected word programming
Only the standard programming method is supported, writing half-words (2 bytes) at a time. In practice, when
programming the user-selected word, FPEC uses only the low byte in the half-word and automatically
calculates the high byte (the high byte is the inverse of the low byte) and then starts the programming operation,
which will ensure that the byte in the user-selected word and its inverse code are always correct.
1)
Check the LOCK bit of FLASH_CTLR register, if it is 1, you need to execute the "Unlock Flash"
operation.
2)
Check the BSY bit of the FLASH_STATR register to confirm that there are no other programming
operations in progress.
3)
Set the OBPG bit of FLASH_CTLR register to '1', after that set the STAT bit of FLASH_CTLR register
to '1' to turn on the user select word programming.
4)
Set the OBPG bit of FLASH_CTLR register to '1', after that set the STAT bit of FLASH_CTLR register
to '1' to turn on the user select word programming.
5)
Write the half word (2 bytes) to be programmed to the specified address.
6)
Wait for the BYS bit to become '0' or the EOP bit of FLASH_STATR register to be '1' to indicate the end