CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

After discharge and charge of source, EEPROM appears erased

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
arvaloez



Joined: 01 Nov 2012
Posts: 3
Location: Colombia

View user's profile Send private message Visit poster's website MSN Messenger

After discharge and charge of source, EEPROM appears erased
PostPosted: Thu Nov 01, 2012 3:30 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Nov 01, 2012 3:40 pm     Reply with quote

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: 19513

View user's profile Send private message

PostPosted: Thu Nov 01, 2012 3:46 pm     Reply with quote

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

View user's profile Send private message Visit poster's website MSN Messenger

PostPosted: Thu Nov 01, 2012 5:06 pm     Reply with quote

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

View user's profile Send private message Visit poster's website MSN Messenger

PostPosted: Thu Nov 01, 2012 5:17 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Nov 01, 2012 10:57 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Nov 01, 2012 11:36 pm     Reply with quote

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: 19513

View user's profile Send private message

PostPosted: Fri Nov 02, 2012 4:21 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group