Table 14. Mass Erase Overview - STMicroelectronics STM32WL5 Series Reference Manual

Advanced arm-based 32-bit mcus with sub-ghz radio solution
Table of Contents

Advertisement

RM0453
3.
Check and clear all error programming flags due to a previous programming. If not,
PGSERR is set.
4.
Set PER and select the page to erase (PNB[6:0]) in FLASH_CR or FLASH_C2CR.
5.
Set STRT in FLASH_CR or FLASH_C2CR.
6.
Wait for BSY to be cleared in FLASH_SR or FLASH_C2SR.
Note:
The internal oscillator HSI16 (16 MHz) is enabled automatically when the STRT bit is set,
and disabled automatically when the STRT bit is cleared, except if the HSI16 is previously
enabled with HSION in the RCC_CR register.
Flash mass erase
A user flash memory mass erase requested by the CPU1 is only performed when the
system is non-secure (ESE = 0). When the system is secure (ESE = 1), a flash memory
mass erase by the CPU1 is ignored and an illegal access event is generated.
When PCROP or WRP is enabled, any flash memory mass erase is aborted and no erase
started.
Hide protection area and hide protection area disable provide no protection for mass erase.
PCROP
PCROP WRP
_RDP
No
No
No
Yes
0
Yes
No
Yes
Yes
No
No
1
No
Yes
Yes
No
Yes
Yes
1. When MER requested by the non-secure CPU1.
2. When requested by a secure bus master. When requested by a non-secure bus master, no WRPERR is generated and an
illegal access event is generated instead.
To perform a mass erase, follow the steps detailed below:
1.
Check that no flash memory operation is ongoing by checking BSY in FLASH_SR or
FLASH_C2SR.
2.
Check and clear all error programming flags due to a previous programming. If not,
PGSERR is set.

Table 14. Mass erase overview

Comment
Memory is erased
Erase aborted (no erase started)
Requested by secure CPU2.
x
The flash memory is mass erased.
Requested by CPU1. Mass erase
aborted (no erase started)
Erase aborted (no erase started)
WRPERR
Yes
RM0453 Rev 5
Embedded flash memory (FLASH)
CPU1
CPU2
bus error
bus error
No
No
Yes
N/A
No
No
N/A
(2)
No
Illegal
access
event
No
No
No
(1)
Yes
No
107/1450
154

Advertisement

Table of Contents
loading
Need help?

Need help?

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

This manual is also suitable for:

Stm32wl55 seriesStm32wl54 series

Table of Contents