User-Selected Word Erasure; Unprotecting Reads - WCH CH32V003 Series Reference Manual

Table of Contents

Advertisement

CH32V003 Reference Manual
of programming, and clear the EOP bit to 0.
7)
Read the programmed address data checksum.
8)
Continue programming you can repeat steps 5-7 and end programming to clear the OBPG bit to 0.
Note: When "Read Protected" in the modified selection word becomes "Unprotected", a whole-slice erase of
the main memory will be performed automatically. If the selection other than "read protected" is modified, the
whole erase operation will not occur.

16.5.3 User-selected word erasure

Directly erase the entire 64-byte user-selected word area.
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 is no programming operation in
progress.
3)
Check the OBWRE bit of FLASH_CTLR register, if it is 0, it is necessary to execute the operation of
"user select word unlock".
4)
Set the OBER bit of FLASH_CTLR register to '1', after that set the STAT bit of FLASH_CTLR register
to '1' to enable the user select word erase.
5)
Wait for the BYS 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
6)
Read and erase the address data checksum.
7)
End to clear the OBER bit to 0.

16.5.4 Unprotecting reads

Whether the flash memory is read protected or not is determined by the user-selected word. Read the
FLASH_OBR register, when the RDPRT bit is '1' indicates that the flash memory is currently in the read-
protected state, and the flash memory is operationally protected by a series of security guards for the read-
protected state. The process of unprotecting the read protection is as follows.
1)
Erase the entire user-selected word area, at which point the read protection field RDPR, at which point
the read protection remains in effect.
2)
User-selected word programming and writes the correct RDPR code 0xA5 to unprotect the flash memory
from reads. (This step will first cause the system to automatically perform an entire erase operation on
the flash memory)
3)
Perform a power-on reset to reload the selection byte (including the new RDPR code), at which point the
read protection is removed.
V1.3
178
http://wch.cn

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents