emEEPROM data lost on power on/off

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ShSh_291626
Level 3
Level 3

 Dear All,

   

I have a trouble, I use emEEPROM to save program variable,

   

but found that repeated power on / off process emEEPROM data may be lost.

   

My program will read the first address emEEPROM in a boot time, check data if it is 0 for handler 1, otherwise for handler 2.

   

This problem is not always in the ON / OFF power will appear, how do I debug?

   

In most cases, the data can be normal, but occasionally there will be data loss problems emEEPROM in ON/OFF power process.

0 Likes
9 Replies
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

When are changes written to the EEPROM? Is there a chance that writes overlap with poweroffs? In that case, invalid data might be the result...

0 Likes
ShSh_291626
Level 3
Level 3

 I had a similar program and save a cumulative value of the function of the numerical calculations, the function will be stored in the numerical changes, but changes in the value of time is not fixed (like a cumulative value).

   

 

   

If the power is lost in the process is written in, whether it is possible to caused by whole page of data flash disappear?

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Writing to EEProm usually first clears a "Row" and then re-programs the row again. This process is maintained by the EEProm-device itself. When power goes off in between the erasure and the re-programming a whole row of data is lost. To circumvent this some precautions have to be taken:

   

An early power-loss detection has to be implemented and when seen, writing to the eeprom must stop.

   

Supply-voltage for EEProm should be buffered with a gold-cap to give the device time enough to finish any actual work.

   

 

   

Bob

0 Likes
ShSh_291626
Level 3
Level 3

This means that I have to make sure that the operating voltage safety before writing, and allows cpu time to complete the work necessary to increase the power off it? My English is poor, sorry

0 Likes
lock attach
Attachments are accessible only for community members.
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Simple calculations to hold up power long enough to

   

complete falsh/eeprom write operations. Attached.

   

 

   

Lastly do not forget C is a strong f(Applied Volatge, for certain

   

C technologies), so factor that into your calculations

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Correcting some horrible spelling -

   

 

   

Simple calculations to hold up power long enough to

   

complete flash/eeprom write operations. Attached.

   

 

   

Lastly do not forget C is a strong f(Applied Voltage, for certain

   

C technologies), so factor that into your calculations.

   

 

   

So detect Vdd value first before EEPROM and/or flash operations,

   

and if high enough, do operations, and calced value of C will hold

   

up supply long enough (if there was an imemadiate loss of power

   

when operations were started) to complete operations.

   

 

   

Regards, Dana.

0 Likes
ShSh_291626
Level 3
Level 3

 I will to review the power supply, Thanks provide these messages

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I recently saw a power-supply that monitored the incoming sine-wave with an opto-coupler and so was able to detect a power loss VERY early. Could even be done with some additional internal logic of the PSoC.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Some possibilities -

   

 

   

    

   

          http://www.edn.com/design/power-management/4408530/Low-component-count-zero-crossing-detector-is-low...

   

 

   

Some considerations -               http://www.microchip.com/forums/m603446-print.aspx

   

 

   

    

   

          www.atmel.com/images/doc2508.pdf

   

 

   

You can use the AC power line to detect loss of a single cycle, but AC line

   

can be pretty noisy, and you are in no need of an immeadiate detection

   

of power loss, proper cap on Vdd will eliminate need to monitor ac line and

   

all the safety factors that entails. Just detect voltage to PSOC, and if it is

   

high enough, and you sized the cap properly, you will have enough time for

   

your FLASH writes. And no external components that have to be HV related due to

   

AC line L type loads, motors, etc...

   

 

   

Regards, Dana.

0 Likes