RM0367 Rev 7 93/1043
RM0367 Flash program memory and data EEPROM (FLASH)
122
Mass erase
• Purpose
Remove the read and write protection on the Flash program memory and data
EEPROM.
• Size
Erase only by word.
• Address
To generate a mass erase, it is necessary to write 0x015500AA to the first Option bytes
address (bits 31 to 25 and 15 to 9 are not complemented because they are not used,
and not checked) with Level 1 as the actual level.
• Protocol
Single programming operation.
• Requests
PELOCK = 0, OPTLOCK = 0, Protection Level = 1, the lower nibble of data has to be
0xAA (Level 0), with 0x55 as the third nibble.
• Errors
WRPERR is set to 1 if PELOCK = 1 or OPTLOCK = 1.
WRPERR is set to 1 if the actual protection level is 2 (the Option bytes area cannot be
written in Level 2).
SIZERR is set to 1 if the size is not the word.
• Description
This operation is similar to the write user Option byte operation: the memory interface
changes it in a mass erase when the actual Protection Level is 1 and the requested
Protection Level is 0. The user must write the desired value in the first address of the
Option bytes area with a word size.
A mass erase deletes the content of the Flash program memory and data EEPROM,
changes the protection level to Level 0 and disables PcROP. (WPRMOD = 0). The bits
write protection and BOR_LEVEL remain unchanged.
Unlike all other operations, the software cannot request new writing operations while a
mass erase is ongoing. To be sure that a mass erase has completed, the software can
reset the EOP bit of FLASH_SR register before the write operation and check when
EOP goes to 1 (End Of Program). If this limitation is not respected, a wrong value may
be written in the Flash program memory and data EEPROM when the Protection Level
is written, thus adding unwanted protections (also for mismatch) that could make the
device useless.
• Duration
2 x Tprog (6.4 ms) + Tglob (3.7 ms)
For code example, refer to A.3.12: Mass erase code example.