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

Do you trust the internal EEPROM ?

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



Joined: 03 Oct 2005
Posts: 88
Location: Ploiesti, Romania

View user's profile Send private message

Do you trust the internal EEPROM ?
PostPosted: Fri Feb 16, 2007 5:20 pm     Reply with quote

I want to store some configuration parameters (a few dozens of bytes) in the internal EEPROM of the 18F452. Is it worth making a checksum for the entire configuration block in order to detect storage errors or am I really paranoid? Smile If I do so, every time I update a variable in the configuration I have to remake the checksum and rewrite it as well. Is this a waste of CPU time? Would it be enough if I store each variable without any error checking?
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Feb 16, 2007 5:38 pm     Reply with quote

It depends on how critical your application and the parameters are. When lives are depending on them you for sure want to have some validation.

I think the EEPROM in the PIC is quiet a save way for storing data, but always there is the small chance of a power failure when writing data to the EEPROM.

A simple CRC-8 like the one used in the 1-wire protocol would suffice for most applications to detect an error.

What are you going to do in case a configuration error is detected? You could fall back onto a default configuration or think of some clever way of restoring the configuration (error correcting codes or storing the configuration multiple times).

Check the maximum number of writes you can do to the EEPROM of your PIC, especially the CRC-code will be the byte most frequently updates.
VanHauser



Joined: 03 Oct 2005
Posts: 88
Location: Ploiesti, Romania

View user's profile Send private message

PostPosted: Fri Feb 16, 2007 5:54 pm     Reply with quote

I could do writes with read-back for verification. If the original data matches what it is read back, the the write was successful. Otherwise, the system would say Contact Service and halt, because the EEPROM is faulty. But I cannot deal with power failures this way.

If I think about it, yes, lives and expensive equipment are depending on those parameters!
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Feb 16, 2007 6:21 pm     Reply with quote

VanHauser wrote:
I could do writes with read-back for verification. If the original data matches what it is read back, the the write was successful.
A read-back is no final proof, there have been some reports on this forum of the eeprom reading the same result after a write but over time or power cycle the data changed.

A possible solution could be to store the configuration data multiple times, each secured by a CRC code. If one of these configurations is in error you give the user an error message.

How often is your configuration data changing? The older PIC EEPROM's have a byte endurance for minimal 10k writes, newer PIC's have a minimal byte endurance of 100k write cycles (reads are never a problem). This sounds like a lot but with, for example, one update per second the 100k will be reached within 70 days.

I never had to deal with critical data, so maybe someone else can jump in and give some smart hints?
newguy



Joined: 24 Jun 2004
Posts: 1903

View user's profile Send private message

PostPosted: Fri Feb 16, 2007 6:30 pm     Reply with quote

Is there any way you can incorporate an external eeprom? If so, an SPI ramtron chip would be ideal. SPI would give you fast access times and in cooperation with the pic's brownout detect, power failures shouldn't ever become an issue. Also with the ramtron chips, fatigue/wearout is not going to be an issue either.
VanHauser



Joined: 03 Oct 2005
Posts: 88
Location: Ploiesti, Romania

View user's profile Send private message

PostPosted: Sat Feb 17, 2007 11:04 am     Reply with quote

The configuration data is not changed often. It is entered by hand or remotely and stays like that for a while, hours, days or even longer, but there is a lot of overhead when saving the configuration and EEPROM writing is really slow.

The datasheet for 18F452 says the endurance is 1,000,000 cycles.

It's kind of difficult to find FRAM here in Romania. The stocks for small serial FRAMs are empty and myy PIC's pins are almost all taken. It is an idea that's worth remembering in the future though, thanks for the tip.
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Mon Feb 19, 2007 9:32 am     Reply with quote

One possible solution might be to write the data to multiple locations within the eeprom and then compare your main data with one or more backup sections. This might detect if your main section has become corrupt some how.

Ronald
VanHauser



Joined: 03 Oct 2005
Posts: 88
Location: Ploiesti, Romania

View user's profile Send private message

PostPosted: Mon Feb 19, 2007 12:18 pm     Reply with quote

Like they use voting for onboard computers on space ships? I should keep an odd number of the same record in order to detect and eliminate the error. That would be a good idea, if I could squeeze at least 3 configuration sets in the 256-byte EEPROM. I'll try that.

Realistically speaking, supposing no power failure occurs when writing the EEPROM and the write is successful, what are the odds for the data to get altered by itself? Pretty small I think.
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

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

PostPosted: Mon Feb 19, 2007 12:35 pm     Reply with quote

Just a note. We get the FRAM directly from Ramtron. Not from
Digi-key,Mouser,ect...

And they have samples
http://www.ramtron.com/doc/Products/productsOptInEmail.asp
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