
GD32L23x User Manual
56
page, the WPERR bit in the FMC_STAT register will be set by the FMC. If the WPERR bit is
set and the ERRIE 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. The
page protection function can be individually enabled by configuring the WP [31:0] bit field to
0 in the option bytes. If a page erase operation is executed on the option bytes block, all the
flash Memory page protection functions will be disabled. When WP in the option bytes is
modified, then a system reset is necessary.
2.3.13.
Security protection
The FMC provides a security protection function to prevent illegal code/data access to the
flash memory. This function is useful for protecting the software/firmware from illegal users.
No protection: when setting SPC byte and its complement value to 0x5AA5, no protection
performed. The main flash and option bytes block are accessible by all operations.
Protection level low: when setting SPC byte value to any value except 0xA5 or 0xCC, the low
security protection is performed. Note that a power reset should be followed instead of a
system reset if the SPC modification has been performed while the debug module is still
connected to JTAG/SWD device. Under the low security protection, the main flash can only
be accessed by user code. In debug mode, boot from SRAM or boot loader mode, all
operations to main flash is forbidden. If a read operation to main flash in debug mode, boot
from SRAM or boot loader mode, a bus error will be generated. If a program/erase operation
to main flash in debug mode, boot from SRAM or boot from boot loader mode, the WPERR
bit in the FMC_STAT register will be set. Option bytes block are accessible by all operations,
which can be used to disable the security protection. Back to no protection level by setting
SPC byte and its complement value to 0x5AA5, then a mass erase for main flash will be
performed.
Protection level high: when setting SPC byte to 0xCC, protection level high performed. When
this level is programmed, debug mode, boot from SRAM or boot from boot loader mode are
disabled. The main flash block is accessible by all operations from user code. The SPC byte
cannot be reprogrammed. So, if protection level high is programmed, it cannot move back to
protection level low or no protection level.
2.3.14.
LVE sequence
If want to change VDD from 1.1V to 0.9V. First set LVE to 1, and use Read_LV timing (set
the corresponding wait state when LDO is 0.9V) to read. Then actually change VDD 1.1V to
0.9V (reset LDOVS bit in PMU).
If want to change VDD from 0.9V to 1.1V. First actually change VDD 0.9V to 1.1V (set LDOVS
bit in PMU). Then set LVE to 0, and use Read_HV timing (set the corresponding wait state
when LDO is 1.1V) to read.