cancel
Showing results for 
Search instead for 
Did you mean: 

EEPROM Write Problem at Power-down

Sam Zeng1
Associate II
Posted on January 23, 2018 at 21:58

Hi,

I am using the STEVAL-IHM041V1 demo board to develop my own application. The mcu

is STM8S103F3P6. I checked the EEPROM locations to verify that the EEPROM read/write

are fine when the +5V is stable. But I have problem trying to save the last data

settings to EEPROM after the power has been removed. The EEPROM write is happening

before the +5V drops below 3V(BOR voltage). But it didn't work and I didn't get the

last saved data from EEPROM read once the board is powered up again. Why? Does anyone

experience similar problem?
2 REPLIES 2
Sebastien B.
Associate II
Posted on January 24, 2018 at 10:03

Hello,

When the EEPROM is used, the MCU need time to realize the write.

Can you test, with the same test, but adding 50 ms before you cut the power supply ?

Add capacitor to help the MCU to realize the operation.

Also, use the redundancy by write your data + checksum + timestamp in a section.

For example : For 10 bytes data, I use 2 bytes for checksum and 4 bytes for timestamp. So I need 16 bytes for each save. I use 64 bytes section of EEPROM and I have than 4 locations that I used in circular mode. I never lost all my data.

Posted on February 01, 2018 at 17:27

Sebastien B,

Thanks for your reply! I found the cause of my EEPROM Read/Write problem. It takes a lot longer than I think to write the EEPROM so my Watchdog resets the cpu. The datasheet says it takes 6mS to write 4 bytes but my tests showed it

takes 20mS at 1MHz CPU clock. Anyway, it is working now. Thanks!

Sam