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

EEPROM Variable getting written - but not in code!

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



Joined: 04 Nov 2004
Posts: 67

View user's profile Send private message Send e-mail

EEPROM Variable getting written - but not in code!
PostPosted: Thu Nov 29, 2007 8:02 am     Reply with quote

I have a fairly length program, so I cannot publish it here, but my problem is this: My program is an RS-232 based program, and via RS-232 you can change the variables in the EEPROM, so to test the program I have a VB program changing one EEPROM value over and over again to test how good the communciations is.

Occasionally, however, one EEPROM value gets changed to a random value, and there is NO code (that I can find) which does this! I have even looked at every write_eeprom command in the code and put "IF" statements to check if that variable is being written to, and it is not, however after running the RS-232 program, after several hours to one day, that ONE eeprom_value changes to a random value (and no other EEPROM variables change).

Does anyone have any ideas what the issue could be? Anything I can try?

PS: Using PCWH V3.249 with 18F2620
Ttelmah
Guest







PostPosted: Thu Nov 29, 2007 8:20 am     Reply with quote

You may just have an EEPROM cell dying.
How often have you written the EEPROM in all?. or example, if you write a value, once per second, then 'several hours', can easily be 25000 cycles. The minimum rated life of the EEPROM, is only 100K cycles. If you have repeated this just four times, you may be seeing the death of the EEPROM starting.

Best Wishes
jseidmann



Joined: 04 Nov 2004
Posts: 67

View user's profile Send private message Send e-mail

PostPosted: Thu Nov 29, 2007 8:27 am     Reply with quote

I put the code onto a different microcontroller (brand new), and ran the same test and after 4-5 hours I had the same problem happening again.

However, doing the calculation, that does come out right, that the cell could be dying. I run across the 100k mark at less than 3 hours, so I could be burning out the cell.

Its always the same cell that has this happening, and NOT the cell which I'm rewriting to all of the time. Also, if I change the EEPROM address of the cell (change the constant that points to the EEPROM address to another address - that NEW address will change).

A note: If I let the system just do nothing (no RS-232 comm.) and power is on, nothing happens to the EEPROM value.

Do you still think its EEPROM burnout or could it be something else?
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Fri Nov 30, 2007 3:06 am     Reply with quote

The EEProm on the PIC18 series and possibly others are NOT EEProms.

From the PIC18F8722 Family data sheet
"Frequently changing values will typically be updated more often than specification D124. If this is not the case, an array refresh must be performed"

"If data EEPROM is only used to store constants and/or data that changes often, an array refresh is likely not required. See specification D124."

As far as I am awhare, if a memory device NEEDs refreshing then it is DRAM!

The fact that is also NOT deterministic with the use of the words "likely", "often" means you have no way of knowing if you need to refresh or not. So if you are using the EEProm then you should have a refresh routine in place.

This MAY or MAY not be related to your problem. You say you are reading and writing a single value! (Byte ?) which is effect is the refresh routine.

Have you checked the recieved value to make sure it is correct before writing it to EEProm ?
Have you checked the read data to check that is correct before sending to the PC ?

A simple test will check this if your VB program sends constant cycling data 0123456789012345... or ABCD etc then you can mod you program to check the next value is the previous value incremented by 1. Of cause you will have to cater for the wrap araound.

Just checked for the 18F2620 and it is the same. Also re-read your last post and noticed that this may well be the reason for your problem.
jseidmann



Joined: 04 Nov 2004
Posts: 67

View user's profile Send private message Send e-mail

PostPosted: Fri Nov 30, 2007 8:05 am     Reply with quote

I'm not sure what you mean by a 'refresh' routine in your post.

I am checking all the deta before it is being sent from the PC to the PIC, and I am checking it on the PC and on the PIC as well, and I cannot seem to find anywhere where it can possibly be changing it. I have these 'flags' set up to notify me whenever this specific EEPROM cell is being changed, but for some reason those flags never pop up and it does change.

I am starting to beleive that it is because I am rewriting the cell too many times. When I do my program again, and instead of writing to the EEPROM many times, I get some other data my PIC calculates and this problem does not happen.

It still frightens me a little bit that this may be an error in the code, but if it is an issue with the EEPROM there is not much I can do.

Also, in this application, I never have an array of EEPROM variables that I work off of in RAM, I just use the EEPROM. How do most people handle this situation?
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Fri Nov 30, 2007 12:45 pm     Reply with quote

I stopped using the internal EEPROM and switched to an external Ramtron memory. The reason is that I never have to worry about a Ramtron memory wearing out.
jseidmann



Joined: 04 Nov 2004
Posts: 67

View user's profile Send private message Send e-mail

PostPosted: Fri Nov 30, 2007 12:48 pm     Reply with quote

Did you have issues with the internal EEPROM?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Nov 30, 2007 1:19 pm     Reply with quote

There are many threads on the eeprom refresh issue on the Microchip
forum. Go to their search page:
http://forum.microchip.com/search.aspx
Select the "16-Bit Core" forum, and then search for:
Quote:
eeprom refresh


Here's one of the threads:
http://forum.microchip.com/tm.aspx?m=202378

Here's a good explanation of the eeprom refresh issue from that thread:
Quote:

If you are writing to different locations in the EEPROM are differing rates,
look at Section 8.8 of the datasheet.

When you write to the EEPROM the charge on all of the cells are
affected. If you write some locations frequently, and other infrequently,
the data for the later may be corrupted. In this case you may have to
perform an 'EEPROM Refresh' periodically.
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