RM0367 Rev 7 101/1043
RM0367 Flash program memory and data EEPROM (FLASH)
122
3.4.4 Write/erase protection management
Here is a summary of the rules to change all previous protections:
• When the protection Level is 2, no protection change can be done.
• When in Level 0 or 1, it is always possible to move to Level 2, writing xx33xxCC (the x
are the hexadecimal digits that can have any value) in the first Option byte word.
• When in Level 0, it is possible to move to Level 1, writing any value in the first Option
byte word that is not xx33xxCC (Level 2) or xx55xxAA (Level 0).
• when in Level 1, the protection can be reduced to Level 0, writing xx55xxAA in the first
Option byte word. This generates a mass erase and deletes the PcROP field too.
• It is always possible to enable PcROP (except in Level 2), writing x0xxx1xx in the first
Option byte word. If there is a mismatch during an Option byte loading on this flag,
PcROP is enabled.
• PcROP can be removed on requesting a mass erase (move from Level 1 to Level 0).
• When PcROP is disabled, a write protection can be added on sectors (writing 1) or
removed (writing 0) in the third word of the Option bytes. A mismatch concerns all
write-protected sectors (if PcROP is disabled).
• When PcROP is enabled, protected sectors can be added (writing 0) but cannot be
removed. A mismatch concerns all read- and write-protected sectors (if PcROP is
enabled).
• A mass erase does not delete the third word of the Option bytes: the user must write it
correctly.
Flash program memory
in PCROP pages
Fetch Fetch Fetch
Protected
(no access)
NA
(1)
Data EEPROM
(FLASH_PELOCK = 1)
RRR
Protected
(no access)
NA
(1)
Data EEPROM
(FLASH_PELOCK = 0)
R / W R / W R / W
Protected
(no access)
NA
(1)
Option bytes
(FLASH_OPTLOCK = 1)
RRRRNA
(1)
Option bytes
(FLASH_OPTLOCK = 0)
R / W R R / W R / W NA
(1)
1. NA stands for “not applicable”.
Table 21. Memory access vs mode, protection and Flash program memory sectors (continued)
Flash program memory
sectors
Mode
User
(including In Application
Programming)
no Debug, or
no Boot in RAM, or
no Boot in System memory
User
in Debug, or
with Boot in RAM, or
with Boot in System memory
RDP
Level 1
Level 0
Level 2 Level 0 Level 1 Level 2