AnsweredAssumed Answered

the IWDG_STOP bit in the FLASH_OPTR register

Question asked by Lynn Linse on Dec 15, 2016
Latest reply on Dec 16, 2016 by ST Renegade

I have a STM32L152 device which spends most of its time in STOP mode, waking perhaps once an hour. I'd like to add IWDG support, but need to 'freeze' the IWDG during STOP mode, which per STM docs can be done.

I have not found an example, but it looks like I need to:

1) unlock the flash options (HAL_FLASH_OB_Unlock)

2) set my bits (HAL_FLASHEx_OBProgram)

3) load in the bits (HAL_FLASH_OB_Launch)

4) re-lock the flash options (HAL_FLASH_OB_Lock)

 

It seems easy enough, but I believe the "launch" step resets the CPU, so one cannot just re-write IWDG_STOP every time I boot - is there any way to READ first to see if this bit needs to be written (there doesn't seem to be a HAL function to read the option bytes)? Any one worked with this action before & have suggestions - things to watch out for?

Outcomes