GD32VF103 User Manual
34
if the target erase page is being used to fetch codes or to access data. The FMC will not
provide any notification when this occurs. Additionally, the page erase operation will be
ignored on erase/program protected pages. In this condition, a flash operation error interrupt
will be triggered by the FMC if the ERRIE bit in the FMC_CTL registers is set. The software
can check the WPERR bit in the FMC_STAT registers to detect this condition in the interrupt
handler.
Figure 2-1. Process of page erase operation
shows the page erase operation flow.
Figure 2-1. Process of page erase operation
Set the PER bit,
Write
FMC_ADDR
Is the LK bit is 0
Send the command
to FMC by setting
START bit
Start
Yes
No
Unlock the
FMC_CTL
Is the BUSY bit is 0
Yes
No
Is the BUSY bit is 0
Yes
No
Finish
2.3.5.
Mass erase
The FMC provides a complete erase function which is used to initialize the main flash block
contents. This erase can affect by setting MER bit to 1 in the FMC_CTL register. The following
steps show the mass erase register access sequence.
Unlock the FMC_CTL registers if necessary.
Check the BUSY bit in FMC_STAT registers to confirm that no flash memory operation
is in progress (BUSY equals to 0). Otherwise, wait until the operation has finished.
Set MER bit in FMC_CTL register
Send the mass erase command to the FMC by setting the START bit in FMC_CTL