Question
STM32L0 - reset after setting RDP
Dear,
I am setting RDP to level 1 in my application, After setting it I call System reset HAL_NVIC_SystemReset();
After reset I am expecting the MCU is locked, but it seems I read in code the MCU is still in level 0 so the procedure of setting RDP to level 1 is repeating. Only power disconnect locks the processor to level 1.
Any solution?
Best regards, Jan.
HAL_FLASHEx_OBGetConfig(&flashTemp);
if(OB_RDP_LEVEL_0 == flashTemp.RDPLevel)
{
HAL_FLASH_OB_Unlock();
HAL_FLASHEx_OBGetConfig(&pOBInit);
pOBInit.RDPLevel = 0xBB;
pOBInit.WRPState = OB_WRPSTATE_ENABLE;
HAL_FLASHEx_OBProgram(&pOBInit);
HAL_FLASH_OB_Lock();
HAL_NVIC_SystemReset();
}