cancel
Showing results for 
Search instead for 
Did you mean: 

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

PGoud
Associate III

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) 

2 REPLIES 2
Christophe MARIN
Associate II

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
Associate III

No I did not succeded until now.

I'm still wishing an answer ...