Read protection is commonly referred to as “encryption”, which acts on the entire Flash storage area. If once the Flash read protection is set, the Flash storage area built into the MCU can only be read out through the normal execution of the program.
The following is operation function
uint8_t state;
void enable_read_protection(void)
{
if(FMC_GetReadProtectionStatus()!=SET)
{
FMC_Unlock();
FMC_ConfigReadOutProtection(FMC_RDP_LEVEL_1);
FMC_Lock();
}
}
void disable_read_protection(void)
{
FMC_Unlock();
FMC_ConfigReadOutProtection(FMC_RDP_LEVEL_0);
FMC_Lock();
}