![ARTERY AT32WB415 Series Скачать руководство пользователя страница 64](http://html1.mh-extra.com/html/artery/at32wb415-series/at32wb415-series_reference-manual_2977599064.webp)
AT32WB415
Series Reference Manual
2022.04.13
Page 64
Ver 2.00
5.2.2
Erase operation
Erase operation must be done before programming. Flash memory erase includes page erase and mass
erase.
Page erase
Any page in the Flash memory and its extension area can be erased with page erase function
independently. Below should be followed during page erase:
Check the OBF bit in the FLASH_STS register to confirm that there is no other programming
operation in progress;
Write the page to be erased in the FLASH_ADDR register
Set the SECERS and ERSTR bit in the FLASH_CTRL register to enable page 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: When the boot loader code area is configured as the Flash memory extension area, performing
page-erase operation erases the entire Flash memory extension area.
Figure 5-1
Flash memory page erase process
Start
Write the erased sector address to
FLASH_ADDR
Set SECERS = 1 and ERSTR =1
in FLASH_CTRL
OBF = 0 ?
Check the OBF bit in FLASH_STS
Read EPPERR bit and ODF bit in
FLASH_STS
No
Yes
OBF = 0 ?
Check the OBF bit in FLASH_STS
No
Yes
End