cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L452RE Read Out Protection at random time

AColino
Associate

Hi,

we have a problem with low power application developed on STM32L452RE with BLE BlueNRG-M2SA module to read environmental sensors (STTS751, HTS221 and LPS25)

The application is developed on the STM32CubeIDE (1.5.1)

At the start of main code the IWDG_Freeze_STOP() function is called to disable Indipendent Wathchdog in the sleeping time.

void IWDG_Freeze_STOP(void)
{
  FLASH_OBProgramInitTypeDef pOBInit;
  HAL_FLASH_Unlock();
 
  __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPTVERR); // Clear the FLASH's pending flags.
  
  HAL_FLASH_OB_Unlock();
  HAL_FLASHEx_OBGetConfig(&pOBInit); // Get the Option bytes configuration.
 
  pOBInit.OptionType = OPTIONBYTE_USER;
  pOBInit.USERType = OB_USER_IWDG_STOP;
  pOBInit.USERConfig = OB_IWDG_STOP_FREEZE;
  HAL_FLASHEx_OBProgram(&pOBInit);
 
  HAL_FLASH_OB_Lock();
  HAL_FLASH_Lock();  
}

First question: it ok to make the disable option byte every system power up or make it only one time?

Now, the system memory goes into level 1 protection casually and the code don't run...

To unlock the uP it is necessary to connect the STlink Utility, open Option Byte window and set Read Out Protection to Level 0, then apply .

After flashing again the firmware and the sistem run normally.

Second question: this problem appears when the system is powered up or down frequently, may be that it's make from IWDG_STOP flag?

1 REPLY 1
Uwe Bonnes
Principal III

Flashing is always critical and when power hickup happen during programming, things may go wrongin many ways.