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 support@ccsinfo.com

EEPROM corruption

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



Joined: 10 Feb 2011
Posts: 241
Location: Vancouver, BC

View user's profile Send private message

EEPROM corruption
PostPosted: Fri Mar 16, 2012 10:54 am     Reply with quote

Hi,

I'm fighting with EEPROM corruption if I power up and down my system multiple times. Looking at the power up, it's quite ugly and choppy for about 100ms and I believe that that might be the cause of the issues we're seeing. I found this from Microchip:
http://support2.microchip.com/KBSearch/KB_StdProb.aspx?ID=SQ6UJ9A00DZERwhich says
Quote:
separate the "write enable" section of code, from the "write to EEPROM" section.

Now in order to do that, I would need to write some inline assembly. How can I do this?
Also, I already set the EEADR and EEADRH registers after read_eeprom() and write_eeprom() to an unused position to avoid spurious writes on power down to corrupt the address where EEADR is pointing at. (developed my own eeprom w/r functions using CCS' eeprom functions inside).
Any other hints or suggestions?
Assistance & ideas are appreciated!

Ron
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Mar 16, 2012 12:18 pm     Reply with quote

Quote:

Looking at the power up, it's quite ugly and choppy for about 100ms and
I believe that that might be the cause of the issues we're seeing.

Disconnect (unsolder) your on-board power supply and substitute a
power supply that starts up cleanly. Possibly use a bench power supply.
Test it and see if you still get the problem.

Quote:

Now in order to do that, I would need to write some inline assembly.
How can I do this?

Set the .LST file format to Symbolic mode, compile a small test program
that uses the CCS write_eeprom() function and look at the .LST file.
You will see how they do it. This thread discusses how to look at the
.LST file code for the eeprom routines:
http://www.ccsinfo.com/forum/viewtopic.php?t=38718&start=15
You don't have to write in assembly, though you could if you wanted to,
by using #asm and #endasm. Instead, just write the code at one level
above assembly. Use #byte and #bit statements and declare the registers
and bits used with the internal eeprom. Then write C code to talk to those
registers and bits.

But before you do any of this, it might help to read all previous threads
on eeprom corruption problems in the forum archives. Do a search for this:
Quote:

eeprom corruption

Set it to: Search for all terms


This thread shows a problem where the user wrote his own low
http://www.ccsinfo.com/forum/viewtopic.php?t=38718&start=15
temtronic



Joined: 01 Jul 2010
Posts: 9170
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Mar 17, 2012 5:35 am     Reply with quote

Fix the hardware first, don't rely on a software 'patch'!

No amount of clever code will truly cure the 'ugly' power supply problem.
While it might in the short term, sooner or later, that 'ugly' power supply will come back and do real damage.Destroying one PIC on your bench is no big deal, having it destroy a customer's 37 systems is really,really bad news.
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Sat Mar 17, 2012 9:27 am     Reply with quote

How does your "corruption" manifest??

Do you add a checksum or CRC to EEPROM data when you store it ?
Or are you simply saving data and reading it back w/o any validity check in the code you used?

What are the circumstances in your code that cause an intentional write to EEPROM??
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