![ARTERY AT32F435 Series Reference Manual Download Page 102](http://html1.mh-extra.com/html/artery/at32f435-series/at32f435-series_reference-manual_2977592102.webp)
AT32F435/437
Series Reference Manual
2022.11.11
Page 102
Rev 2.03
Figure 5-3
Flash memory mass erase process
Start
No
Check the OBF bit in FLASH_STSx
OBF = 0?
Yes
Set BANKERS = 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
End
5.2.3
Programming operation
The Flash memory can be programmed with 32 bits, 16 bits or 8 bits at a time.
The following process is recommended:
Check the OBF bit in the FLASH_STSx register to confirm that there is no other programming
operation in progress;
Set the FPRGM bit in the FLASH_CTRLx register, so that the Flash memory programming
instructions can be received;
Write the data (word/half-word/byte) to be programmed to the designated address;
Wait until the OBF bit in the FLASH_STSx register becomes “0”, read the EPPERR, PRGMERR
and ODF bit to verify the programming result.
Note: 1. When the address to be written is not erased in advance, the programming operation is
not executed unless the data to be written is all 0. In this case, a programming error is
reported by the PRGMERR bit in the FLASH_STSx register.
2. Read operation to the Flash memory during programming will halt CPU until the completion
of programming.