View previous topic :: View next topic |
Author |
Message |
jseidmann
Joined: 04 Nov 2004 Posts: 67
|
EEPROM Variable getting written - but not in code! |
Posted: Thu Nov 29, 2007 8:02 am |
|
|
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
|
|
Posted: Thu Nov 29, 2007 8:20 am |
|
|
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
|
|
Posted: Thu Nov 29, 2007 8:27 am |
|
|
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
|
|
Posted: Fri Nov 30, 2007 3:06 am |
|
|
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
|
|
Posted: Fri Nov 30, 2007 8:05 am |
|
|
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: 1908
|
|
Posted: Fri Nov 30, 2007 12:45 pm |
|
|
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
|
|
Posted: Fri Nov 30, 2007 12:48 pm |
|
|
Did you have issues with the internal EEPROM? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Nov 30, 2007 1:19 pm |
|
|
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:
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. |
|
|
|
|