
AT32F413
Series Reference Manual
2022.06.27
Page 68
Rev 2.00
in the FLASH_STS register to verify the erased pages.
Figure 5-3
Flash memory page erase process
Start
Write the erased sector address to
FLASH_ADDRx
Set SECERS = 1 and ERSTR =1
in FLASH_CTRLx
OBF = 0 ?
Check the OBF bit in FLASH_STSx
Read EPPERR bit and ODF bit in
FLASH_STSx
No
Yes
OBF = 0 ?
Check the OBF bit in FLASH_STSx
No
Yes
End
Mass erase
Mass erase function can erase the whole Flash memory.
The following process is recommended:
Check the OBF bit in the FLASH_STS register to confirm that there is no other programming
operation in progress;
Set the BANKERS and ERSTR bit in the FLASH_CTRL register to enable mass erase;
Wait until the OBF bit becomes “0” in the FLASH_STS register. Read the EPPERR bit and ODF bit
in the FLASH_STS register to verify the erased pages.
Note: Read operation to the Flash memory during erase will halt CPU until the completion of
erase.