Flash program memory and data EEPROM (FLASH) RM0367
96/1043 RM0367 Rev 7
To reset this flag, the software need to write it to 1.
SIZERR
This flag is set by hardware and reset by software. It informs when a size error happened. It
is raised when:
• A write by byte and half-word occurs in the Flash program memory and Option bytes.
• An erase (with bit ERASE = 1 in FLASH_PECR register) by byte or half-word occurs in
all areas.
A size error aborts the write/erase operation and an interrupt can be generated (if
ERRIE = 1 in the FLASH_PECR register). The content of the NVM is not changed.
To reset this flag, the software needs to write it to 1.
NOTZEROERR
This flag is set by hardware and reset by software. It indicates that the application software
is attempting to write to one or more NVM addresses that contain a non-zero value.
Except for category 3 devices, the modify operation is always aborted when this condition is
met. For category 3 devices, a not-zero error does not abort the write/erase operation but
the value might be corrupted.
In a write by half-page, all 16 words are checked between the first address/value and the
second one, and the flag is only set when all words are checked. If the flag is set, it means
that at least one word has an actual value not at zero.
In a write by word, only the targeted word is checked and the flag is immediately set if the
content is not zero.
An interrupt is generated if ERRIE = 1 in FLASH_PECR register. To reset this flag, the
application software needs to program it to 1.
Note: Notification of a not-zero error condition (i.e. NOTZEROERR flag and the associated
interrupt) can be disabled by the application software via the NZDISABLE bit in
FLASH_PECR register. However, for all device except category 3 devices, the condition is
still checked internally and modify operation is anyway blocked
3.4 Memory protection
The user can protect part of the NVM (Flash program memory, data EEPROM and Option
bytes areas) from unwanted write and against code hacking (unwanted read).
The read protection is activated by setting the RDP option byte and then applying a system
reset to reload the new RDP option byte.
Note: If the read protection is set while the debugger has been active (through SWD) after last
POR (power-on reset), apply a POR (power-on reset) or wakeup from Standby mode
instead of a system reset (the option bytes loading is not sufficient).