GD32W51x User Manual
82
When the SPC[7:0] is programmed to the value 0x55 to move from level 1 to level 0.5, a
partial mass erase of Flash main memory is performed. Only non-secure mark areas are
erased. The backup registers and all SRAMs are also erased.
Note:
Only when there are option bytes, security protection level can be modified.
2.4.10.
Write protection
The FMC provides a write protection function to prevent program/erase function on the Flash
memory. The page erase or program will not be accepted by the FMC on protected pages. If
the page erase or program command is sent to the FMC on a protected page, the
WPERR/SECWPERR bit in the FMC_STAT/FMC_SECSTAT register will be set by the FMC.
If the WPERR/SECWPERR bit is set and the ERRIE/SECERRIE bit is also set to 1 to enable
the corresponding interrupt, then the Flash operation error interrupt will be triggered by the
FMC to draw the attention of the CPU. When write protection is set in EFUSE, first 32KB are
write protect, then a system reset is necessary.
When there are option bytes, the write-
protected area defined in the option bytes (FMC_OBR) is also write-protected.
Note:
This fuction is only available in FMC mode.
2.4.11.
Flash privileged and unprivileged mode
The Flash registers can be read and written by privileged and unprivileged accesses
depending on PRIV bit in FMC_PRIVCFG register. When the FMC_PRIV bit is reset, Flash
registers can be read and written by both privileged and unprivileged access. When the
FMC_PRIV bit is set, all Flash registers could be read and written by privileged access only.
Unprivileged access to a privileged registers is RAZ/WI.
2.4.12.
FLASH interrupts
There includes secure interrupts and non-secure interrupts.
Secure interrupts: secure end of operation/secure operation error.
Non-secure interrupts: non-secure end of operation/non-secure operation error.
Table 2-8. Flash interrupt requests (non-secure)
Flag
Description
Clear m ethod
Interrupt
enable bit
ENDF
end of operation
Write 1 to corresponding bit
in FMC_STAT register
ENDIE
WPERR
erase/program on protected pages
ERRIE