Flash Page Erase; Flash Whole Chip Erase - WCH CH32V003 Series Reference Manual

Table of Contents

Advertisement

CH32V003 Reference Manual
1)
Check the LOCK bit of FLASH_CTLR register, if it is 1, you need to execute the "Unlock Flash"
operation.
2)
Set the PER bit of FLASH_CTLR register to '1' to enable the standard page erase mode.
3)
Write the page header address of the selected erase to FLASH_ADDR register.
4)
Set the STAT bit of FLASH_CTLR register to '1' to initiate an erase action.
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 the data of the erased page for verification.
7)
Continue the standard page erase can repeat steps 3-5 and end the erase to clear the PEG bit to 0.
1)
Check the LOCK bit of FLASH_CTLR register, if it is 1, you need to execute the "Unlock Flash"
operation.
V1.3
Figure 16-2 FLASH Page Erase
Read the LOCK bit of
FLASH_CTRL
YES
LOCK bit=1?
NO
Set FLASH_CTLR的PER bit=1
Write the erased page header
address in FLASH_ADDR register
(erase 8 pages at a time)
Set FLASH_CTLR STRT bit=1
BSY bit=1?
NO
Read out erase page data
verification
Continue
erasing?
NO
Over,PEG bit=0
Figure 16-3 FLASH whole chip erase
Read the LOCK bit of
FLASH_CTRL
YES
LOCK bit=1?
NO
Set FLASH_CTLR MER bit=1
Set FLASH_CTLR STRT bit=1
YES
BSY bit=1?
NO
Read out all pages of data to
verify
Over,MEG
bit=0
174
Perform "Unlock Flash
Memory" operation
YES
YES
Perform "Unlock Flash
Memory" operation
http://wch.cn

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents