AT32F425
Series Reference Manual
2022.03.30
Page 68
Ver 2.01
Figure 5-1
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 all the 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:
1)
When the boot loader code area is configured as the Flash memory extension area,
performing mass-erase operation erases automatically the entire the entire Flash memory and
its extension area.
2)
Read access during erase operation halts the CPU and waits until the completion of erase.
3)
Internal HICK must be enabled prior to erase operation.