Skip to main content
brunoeagle
Associate II
March 29, 2014
Question

STM32L1 not writing to EEPROM after exiting STOP

  • March 29, 2014
  • 1 reply
  • 537 views
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.
    This topic has been closed for replies.

    1 reply

    brunoeagle
    Associate II
    March 30, 2014
    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...