Embedded flash memory (FLASH)
Apart from the RDP and WRP, the flash memory can also be protected against read and
write from third parties (PCROP). The PCROP granularity is 1 Kbyte.
3.5.1
Readout protection (RDP)
The readout protection is activated by setting the RDP option byte and performing an option
byte programming with OPTSTRT followed by a OBL_LAUNCH, POR or wakeup from
Standby or Shutdown mode. The readout protection protects the main flash memory, the
option bytes, the backup registers (TAMP_BKPxR in TAMP) and SRAM2.
There is no exception while the debugger is connected.
There are three levels of readout protection from no protection (level 0) to maximum
protection or no debug (level 2).
The flash memory is protected when the RDP option byte and its complement contain the
pair of values shown in the table below.
RDP byte value
0xAA
Any value except 0xAA or 0xCC
0xCC
The system memory area is read accessible whatever the protection level. It is never
accessible for program/erase operation.
Level 0: no protection
Read, program and erase operations into the main flash memory area are possible. The
option bytes, SRAM2 and backup registers are also accessible by all operations.
Level 1: readout protection
This is the default protection level when the RDP option byte is erased. It is defined as well
when the RDP value is at any value different from 0xAA and 0xCC, or even if the
complement is not correct.
•
User mode
The code executing in user mode (Boot flash) can access the main flash memory,
option bytes, SRAM2 and backup registers with all operations.
•
Debug, boot RAM and bootloader and SFI/RSS modes
In debug mode or when the code is running from boot RAM or bootloader or SFI/RSS,
the main flash memory, backup registers (RTC_BKPxR in the RTC) and SRAM2 are
totally inaccessible. In these modes, a read or write access to the flash memory
generates a bus error and a hard fault interrupt.
Caution:
In case the level 1 is configured and no PCROP areas are defined, it is mandatory to set
PCROP_RDP bit to 1 (full mass erase when the RDP level is decreased from level 1 to
level 0). In case the level 1 is configured and a PCROP area is defined, if the user code
needs to be protected by RDP but not by PCROP, it must not be placed in a page containing
a PCROP area.
86/1306
Table 11. Flash memory readout protection status
RDP complement value
0x55
Any value (not necessarily
complementary), except 0x55 and 0x33
0x33
RM0461 Rev 5
RM0461
RDP level
Level 0
Level 1 (default)
Level 2
Need help?
Do you have a question about the STM32WLEx and is the answer not in the manual?