GD32W51x User Manual
73
BUSY/SECBUSY bit in the FMC_STAT/FMC_SECSTAT register.
Read and verify the Flash memory using a DBUS access if required.
When the operation is executed successfully, the ENDF/SECENDF bit in the
FMC_STAT/FMC_SECSTAT register is set, and an interrupt will be triggered by FMC if the
ENDIE bit in the FMC_CTL/FMC_SECCTL register is set. Since all Flash data will be modified
to a value of 0xFFFF_FFFF, the mass erase operation can be implemented using a program
that runs in SRAM or using the debugging tool that accesses the FMC registers directly.
Additionally, the mass erase operation will be ignored if any page is erase/program protected.
In this condition, a Flash operation error interrupt will be triggered by the FMC if the
ERRIE/SECERRIE bit in the FMC_CTL/FMC_SECCTL register is set. The software can
check the WPERR/SECWPERR bit in the FMC_STAT/FMC_SECSTAT register to detect this
condition in the interrupt handler.
The following figure
Figure 2-3. Process of mass erase operation
indicates the mass erase
operation flow.
Figure 2-3. Process of mass erase operation
Set the MER/SECMER
bit
Is the LK/SECLK
bit is 0
Send the command to
FMC by set
START/SECSART bit
Start
Yes
No
Unlock the
FMC_CTL/FMC_SECC
TL
Is the BUSY/
SECBUSY bit is 0
Yes
No
Is the BUSY/
SECBUSY bit is 0
Yes
No
Finish