AT32F425
Series Reference Manual
2022.03.30
Page 74
Ver 2.01
Low-level access protection
When the contents in the nFAP and FAP bytes are different from 0x5A and 0xA5, and 0x33 and 0xCC,
the low-level Flash memory access protection is enabled after a system reset.
When the Flash access is protected, the user can re-erase the system data area, and unlock Flash
access protection (switching from protected to unprotected state will trigger mass erase on the Flash
memory automatically) by wrting 0xA5 to FAP byte, and then perform a system reset. Subsequently, the
system data loader will be reloaded with system data and updated with Flash memory access protection
disable state (FAP byte)
High-level access protection
When the content in the nFAP is different from 0x33 , and the content in the FAP byte is not equal to
0xCC, the high-level Flash memory access protection is enabled after a system reset.
Once enabled, it cannot be unlocked, and it is not permissible for users to re-erase and write the system
data area.
Note:
1) The main memory extension area can also be protected.
2) If the access protection bit is set in debug mode, then the debug mode has to be cleared
by POR instead of system re set in order to resume access to Flash memory data
3) The SWD is disabled as soon as the high -level access protection is enabled. .
Table 5-4 shows Flash memory access limits when Flash access protection is enabled.
Table 5-4 Flash memory access limit
Block
Protection level
Access limits
In debug mode or boot from SRAM and
boot loader code area
Boot from main Flash memory
Read
Write
Erase
Read
Write
Erase
Main Flash
memory
Low-level
protection
Not allowed
Not allowed
(1) (2)
Accessible
High-level
protection
Not allowed
Accessible
User system data
area
Low-level
protection
Not allowed Accessible
Accessible
High-level
protection
Not allowed
Not allowed
(1)Main Flash memory is cleared automatically by hardware only when the access protection is disabled;
(2)Only page erase is forbidden, and mass erase is not affected.
5.5.2
Erase/program protection
For 64 KB and less Flash memory, erase/program protection is performed on the basis of 4 pages.
This is used to protect the contents in the Flash memory against inadvertent operation when the program
crash occurs.
Erase/program operation is not permitted under one of the following events, and the EPPERR bit is set
accordingly when
Erasing/programming the pages (in Flash memory and its extension area) where erase/program
protection is enabled
Performing mass erase on the sectors where erase/program protection enabled
When the Flash access protection is enabled, the page 0~3 in the main Flash memory will
be protected against erase/program automatically
When the Flash access protection is enabled, the main Flash memory is protected against
erase/program when it is in debug mode or when it is started from non-main Flash memory.