View previous topic :: View next topic |
Author |
Message |
arvaloez
Joined: 01 Nov 2012 Posts: 3 Location: Colombia
|
After discharge and charge of source, EEPROM appears erased |
Posted: Thu Nov 01, 2012 3:30 pm |
|
|
Hello
I have a circuit that uses a battery such a source. Everything works correctly. Even the EEPROM stores and maintain the data without problems. But when the battery is discharged completely, I charge the battery again but the EEPROM is erased.
Some people told me that the problem is about programing. But I say again everything works well while the battery has charge. So the problem I guess is about electrical problems (write voltages).
I don't know if this problem is caused for that reason but I have searched at the manuals pic and around the web, but nobody could help me.
I'm using the PIC16F688-E/ML.
Thank you for your time and help. |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Thu Nov 01, 2012 3:40 pm |
|
|
Is this a problem which only occurs as you SLOWLY lower and raise the supply voltage?
What happens to your stored EEPROM data if the supply is rapidly disconnected then restored?
Mike |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Thu Nov 01, 2012 3:46 pm |
|
|
Are you checking the supply _before_ you write to the EEPROM?. Have you got enough supply holdup (capacitors), to ensure the supply stays good during a write?.
You can corrupt the EEPROM if a write is in progress and the supply falls below a critical point while it is happening.
Best Wishes |
|
|
arvaloez
Joined: 01 Nov 2012 Posts: 3 Location: Colombia
|
|
Posted: Thu Nov 01, 2012 5:06 pm |
|
|
I just write the EEPROM once and with this information, I work in the program. Even, never change the EEPROM data after the first writing.
Mike,
When I disconnect and connect the system the EEPROM data is ok.
Quote: | Is this a problem which only occurs as you SLOWLY lower and raise the supply voltage?
|
YES |
|
|
arvaloez
Joined: 01 Nov 2012 Posts: 3 Location: Colombia
|
|
Posted: Thu Nov 01, 2012 5:17 pm |
|
|
This problem only occurs when the power falls and rises up slowly. I've probed with a source which the power falls and rise up rapidly and in this case the data remain saved.
How can I fix this problem if I have a battery as a source, and a regulator that falls the regulation voltage proportional with the battery voltage ? |
|
|
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Thu Nov 01, 2012 10:57 pm |
|
|
While not an answer to your question, it is generally a bad practice to take batteries all the way down. Normally, there should be a cutoff voltage for the batteries and at that voltage, the load should be disconnected. Full discharge can result in some cells in a multiple cell arrangement being reversed which can destroy the battery.
mikey _________________ mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3 |
|
|
languer
Joined: 09 Jan 2004 Posts: 144 Location: USA
|
|
Posted: Thu Nov 01, 2012 11:36 pm |
|
|
What do you have for nominal battery voltage? What do you have for regulated voltage (i.e. voltage at output of regulator)? At what point do you write to the EEP (at power up, before power down, other)?
You should use a regulator with an enable/shutdown pin and use that to only enable the regulator output when the battery voltage is above a certain level. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Fri Nov 02, 2012 4:21 am |
|
|
Reading the replies from the original poster, I'm going to make a 'summary' of what I think he is saying, and then some comments:
1) He is not writing the EEPROM anywhere in the code?.
2) He is running the chip from a battery, and letting the battery completely discharge?.
3) When he does so, and then attaches a new battery, he is finding that the EEPROM has lost it's contents?.
Comment: Why do you think the chip has a _minimum_ supply voltage specified?. Basically if you try to operate below this, what happens is pure luck (mostly bad...).
Suggestion: Enable the brownout detect fuse.
This way, if the supply rail falls below 2.1v (minimum the chip is rated to run is 2v provided your clock is not over 4MHz), the chip will reset, and basically stop working if the supply stays below this. This may prevent the problem.
Seriously, once you go below the minimum rated voltage by more than a tiny amount, you run into memory cells being read as having completely different values to what they really hold (both RAM and ROM). If somehow this results in the chip actually executing an EEPROM access code, with the supply voltage under half what is specified for a write cycle, the behaviour is completely indeterminate.
Best Wishes |
|
|
|