Solved
Application not working when RDP=1
Hi,
I am trying to run my application on the STM32L433RTCX which includes the code that enables the RDP to level 1. Even after multiple different attempts (to set it at level 1) the application on the MCU is still not working. Details from my side -
- Program Counter is in flash.
- The following is the function I am using.
- While debugging right after flashing, the debugger loses signal after HAL_FLASH_OB_Launch();
HAL_StatusTypeDef SetRDPLevel1()
{
FLASH_OBProgramInitTypeDef OB;
HAL_FLASHEx_OBGetConfig(&OB);
if (OB.RDPLevel != OB_RDP_LEVEL_1){
HAL_FLASH_Unlock();
HAL_FLASH_OB_Unlock();
OB.OptionType = OPTIONBYTE_RDP;
OB.RDPLevel = OB_RDP_LEVEL_1;
if ( HAL_FLASHEx_OBProgram(&OB) != HAL_OK ){
HAL_FLASH_OB_Lock();
HAL_FLASH_Lock();
return HAL_ERROR;
}
HAL_FLASH_OB_Launch();
/* We should not make it past the Launch, so lock
* flash memory and return an error from function
*/
HAL_FLASH_OB_Lock();
HAL_FLASH_Lock();
return HAL_ERROR;
}
return HAL_OK;
}
