Disabling readout protection level 1 in stm32F051xx microcontroller
Hi,
I'm trying to protect my code from being able to read by others.So I chose readout protection level-1,I could make it read protected and I'm not able disable it by using readout protection level-0,I have to disable it using ST link utility.But I want to disable readout protection using code itself.Please can someone correct me where I went wrong?
Thank you.
Enable readout protection level 1:
FLASH_Unlock() ;
if(!(FLASH_OB_GetRDP())
{
FLASH_OB_Unlock() ;
state = FLASH_OB_RDPConfig(OB_RDP_Level_1) ;
if(state == FLASH_COMPLETE)
FLASH_OB_Launch();
FLASH_OB_Lock() ;
}
FLASH_Lock() ;
Disable readout protection level 1:
FLASH_Unlock() ;
if((FLASH_OB_GetRDP())
{
FLASH_OB_Unlock() ;
state = FLASH_OB_RDPConfig(OB_RDP_Level_0) ;
if(state == FLASH_COMPLETE)
FLASH_OB_Launch();
FLASH_OB_Lock() ;
}
FLASH_Lock() ;
