cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L0 RDP

zvit
Associate
Posted on April 10, 2016 at 09:13

Hi all

I'm setting the read out protection to level 1 , in the beginning of my main() fxn

After setting RDP I generate system reset using HAL_NVIC_SystemReset() fxn

After the reset I'd expect the RDP to be set to level 1 but it's not

only a hard reset enables the RDP.

FLASH_OBProgramInitTypeDef pOBInit;

HAL_FLASH_OB_Unlock();

HAL_FLASHEx_OBGetConfig(&pOBInit);

if (pOBInit.RDPLevel != OB_RDP_LEVEL_1)

{

     pOBInit.RDPLevel = OB_RDP_LEVEL_1;

     HAL_FLASHEx_OBProgram(&pOBInit);

     HAL_FLASH_OB_Lock();

     Delay1ms(10000);

     HAL_NVIC_SystemReset();

}

 

#stm32l0 #rdp
3 REPLIES 3
slimen
Senior
Posted on April 12, 2016 at 18:28

Hello Wizz, 

Did you used the ST-Link to check the protection level? 

I think that you have to add unlocking/locking of the Flash in order to enable/disable the flash control register access with: HAL_FLASH_Unlock() / HAL_FLASH_Lock() 

-ForumSTM32-

Posted on April 12, 2016 at 19:08

I'd agree the flash needs to be unlocked, before options. It has been my general experience that RDP needs a power-cycle.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
zvit
Associate
Posted on April 13, 2016 at 15:05

Hi,

I've added the HAL_FLASH_Unlock & Lock still only power off/on cycle enforces RDP