cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L1 not writing to EEPROM after exiting STOP

brunoeagle
Associate II
Posted on March 29, 2014 at 02:21

Hi,

I'm entering in STOP mode with the command:

PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);

But, when it resume from STOP, I cannot write to EEPROM anymore. I'm unlocking EEPROM with the command:

DATA_EEPROM_Unlock();

And writing to EEPROM:

DATA_EEPROM_ProgramByte(address++, *s);

If I remove only the line to enter in STOP mode, it works as well. Am I missing something? Thank you.
1 REPLY 1
brunoeagle
Associate II
Posted on March 30, 2014 at 18:25

solved, I was forgetting to clear the flags:

FLASH_ClearFlag(FLASH_FLAG_EOP|FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_SIZERR | FLASH_FLAG_OPTVERR | FLASH_FLAG_OPTVERRUSR);

In normal Run mode it doesn't matter...