AnsweredAssumed Answered

F401 Enabling ROP?

Question asked by MWP on May 14, 2018
Latest reply on May 15, 2018 by MWP

Hi all,

 

I'm trying to get ROP enabled by my bootloader.

 

This function is run first up by main().

I'm finding that it get stuck in a loop, as ROP never seems to become enabled (always reads back as being set at level 0).

Any ideas what im doing wrong here?

 

Thanks.

 


void BL_ROPL1()
{
FLASH_OBProgramInitTypeDef OBInit;

//check ROP status
HAL_FLASHEx_OBGetConfig(&OBInit);
if (OBInit.RDPLevel == OB_RDP_LEVEL_0)
{
  //no read out protection is active, enable it
  OBInit.OptionType = OPTIONBYTE_RDP;
  OBInit.RDPLevel = OB_RDP_LEVEL_1;

  HAL_FLASH_Unlock();
  HAL_FLASH_OB_Unlock();
  HAL_FLASHEx_OBProgram(&OBInit);
  HAL_FLASH_OB_Lock();
  HAL_FLASH_OB_Launch();
  NVIC_SystemReset(); //shouldnt get to here
}
}

 

Outcomes