Download Print this page

ST STM32L4+ Series Reference Manual page 144

Hide thumbs Also See for STM32L4+ Series:

Advertisement

Embedded Flash memory (FLASH)
Level 1: Read protection
This is the default protection level when RDP option byte is erased. It is defined as well
when RDP value is at any value different from 0xAA and 0xCC, or even if the complement is
not correct.
User mode: Code executing in user mode (Boot Flash) can access Flash main
memory, option bytes, SRAM2 and backup registers with all operations.
Debug, boot RAM and bootloader modes: In debug mode or when code is running
from boot RAM or bootloader, the Flash main memory, the backup registers
(RTC_BKPxR in the RTC) and the SRAM2 are totally inaccessible. In these modes, a
read or write access to the Flash generates a bus error and a Hard Fault interrupt.
Caution:
In case the Level 1 is configured and no PCROP area is 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 user code needs
to be protected by RDP but not by PCROP, it must not be placed in a page containing a
PCROP area.
Level 2: No debug
In this level, the protection level 1 is guaranteed. In addition, the Cortex
boot from RAM (boot RAM mode) and the boot from System memory (bootloader mode) are
no more available. In user execution mode (boot FLASH mode), all operations are allowed
on the Flash Main memory. On the contrary, only read operations can be performed on the
option bytes.
Option bytes cannot be programmed nor erased. Thus, the level 2 cannot be removed at all:
it is an irreversible operation. When attempting to modify the options bytes, the protection
error flag WRPERR is set in the Flash_SR register and an interrupt can be generated.
Note:
The debug feature is also disabled under reset.
STMicroelectronics is not able to perform analysis on defective parts on which the level 2
protection has been set.
Changing the Read protection level
It is easy to move from level 0 to level 1 by changing the value of the RDP byte to any value
(except 0xCC). By programming the 0xCC value in the RDP byte, it is possible to go to level
2 either directly from level 0 or from level 1. Once in level 2, it is no more possible to modify
the Read protection level.
When the RDP is reprogrammed to the value 0xAA to move from Level 1 to Level 0, a mass
erase of the Flash main memory is performed if PCROP_RDP is set in the
End address register
RTC) and the SRAM2 are also erased. The user options except PCROP protection are set
to their previous values copied from FLASH_OPTR, FLASH_WRPxyR (x=1, 2 and y =A or
B). PCROP is disable. The OTP area is not affected by mass erase and remains
unchanged.
If the bit PCROP_RDP is cleared in the FLASH_PCROP1ER, the full mass erase is
replaced by a partial mass erase that is successive page erases in the bank where PCROP
is active, except for the pages protected by PCROP. This is done in order to keep the
PCROP code. If PCROP is active for both banks, both banks are erased by page erases.
Only when both banks are erased, options are re-programmed with their previous values.
This is also true for FLASH_PCROPxSR and FLASH_PCROPxER registers (x=1,2).
144/2301
(FLASH_PCROP1ER). The backup registers (RTC_BKPxR in the
RM0432 Rev 6
RM0432
®
-M4 debug port, the
Flash PCROP1

Advertisement

loading
Need help?

Need help?

Do you have a question about the STM32L4+ Series and is the answer not in the manual?

Subscribe to Our Youtube Channel