Skip to main content
PGoud
Associate III
December 11, 2018
Question

Trying to write STM32L462CE options Byte. Modification is never set in flash after LAUNCH or POwer cycle.

  • December 11, 2018
  • 2 replies
  • 800 views

Here is what my code looks like:

FLASH_OBProgramInitTypeDef pOBInit;

pOBInit.USERConfig = FLASH_OB_GetUser();

HAL_FLASH_Unlock();

HAL_FLASH_OB_Unlock();

pOBInit.OptionType = OPTIONBYTE_USER;

pOBInit.USERType  = OB_USER_IWDG_STOP;

pOBInit.USERConfig &= ~(FLASH_OPTR_IWDG_STOP);  // FREEZE during STOP

//pOBInit.USERConfig |=  OB_USER_IWDG_STOP; // RUN during STOP

HAL_FLASHEx_OBProgram(&pOBInit);

HAL_FLASH_OB_Launch(); // Should reset MCU(Cf RM0351 p 114) 

This topic has been closed for replies.

2 replies

Christophe MARIN
Associate III
February 11, 2019

Did you find a way to program the option bytes? If yes, could you let me know how, I'm somehow stuck at same point, the only difference is I'm trying to set/reset the BFB2 bit with no success so far. I'm using same code, on an STM32L476...

PGoud
PGoudAuthor
Associate III
February 12, 2019

No I did not succeded until now.

I'm still wishing an answer ...