Welcome, Guest
Username: Password: Secret Key Remember me

TOPIC: EEPROM, writing and reading..

Re: EEPROM, writing and reading.. 8 years 2 months ago #8535

  • Jon Chandler
  • Jon Chandler's Avatar
  • Offline
  • Moderator
  • Posts: 365
  • Thanks received: 352
Thank you for the clarification Jerry. Learn something new every day if you're not careful

To wear out a location in a week, you'd have to write to it every 6 seconds. Not impossible at all...just make sure you don't save values every time through the program loop.

Reminds me of an error I made in my first programming class. Fortran IV and yes, I admit it, punched cards! You'd make your deck on the keypunch and hand them over to a computer operator to run. As it got towards the end of the quarter, it might take hours to get your results back.

My program was supposed to calculate values in a 10 x 10 array and print out a table of the values. I knew something was wrong when my program started running and it started ejecting page after page of output before the operator aborted it.

Put the code to print OUTSIDE the loop that calculates the values! Inside the loop, 1 value was calculated, and then the table of 100 values was printed. Two values the next time, and etc. 100 pages of line-printer output would have been a thick stack had the job been allowed to complete!

Like my printer error, it's important to verify your logic in writing to EEPROM. Paper was cheap. Replacing your controller might not be.

Re: EEPROM, writing and reading.. 8 years 2 months ago #8536

  • jmessina
  • jmessina's Avatar
  • Offline
  • Senior Boarder
  • Posts: 44
  • Thanks received: 189
I think I wrote the same program, Jon. Those poor operators must have hated end of semester week!


One of the reasons you may not have noticed this spec before is that you'll probably NOT find it called out in the standalone serial EEPROM devices we're all used to, just in the uC devices with internal EEPROM.

I don't know why... perhaps it's some process related effect, or they just point it out since the endurance number is usually much lower for internal vs external EEPROM (100K typ vs 1M typ).

I'm not sure I recall seeing this spec in other devices, but they do tend to hint at it a little with statements like "Also, there is not a polysilicon to polysilicon stress for adjacent cells since all cells are at the same potential" when discussing things like block vs byte mode. Maybe for the standalone chips they just roll all the endurance numbers up together into one spec. I know I was surprised when I first ran across it.

One way to combat this is to divide the EEPROM space up into small blocks and keep moving where you write the data block. For example, perhaps you only need 128 bytes out of that 1K. That's eight 128-byte blocks you have to work with. If you keep your usage cycling through the blocks, you can kill three birds with one stone... you effectively get 8 times the endurance, the array is automatically refreshed, and you can even get backups of your data in case a write is corrupted or interrupted by a power cycle.

Re: EEPROM, writing and reading.. 8 years 2 months ago #8537

  • jmessina
  • jmessina's Avatar
  • Offline
  • Senior Boarder
  • Posts: 44
  • Thanks received: 189
FYI -
I found the following in the mchip knowledge base (ID Q6UJ9A0004F4)
Refresh the EEPROM

Issue
The PICmicro data sheet mentions that I may need to refresh the EEPROM. Why do I need to refresh and how do I know if it will be necessary?

Solution
Writing to a EEPROM cell can cause a very small leakage in other EEPROM cells. This is common to virtually all Flash and EEPROM cells of all manufacturers. The cells are not damaged and if you write to the cells (refresh), their condition will be restored.

You only need to be concerned about refreshing the cells if some of the memory locations will not be written at all during the time that you do the specified number of writes to other locations in the EEPROM.

If you do not write to EEPROM very much or if you write all the locations regularly, refreshing will not be necessary. If you have some locations that are seldom written and other locations that are written often, you may need to refresh the seldom written locations.

Newer devices tend to have much smaller memory cells and are more affected by this phenomenon than older parts.

To refresh, simply read all the EEPROM memory and write it back.

So I guess this issue has been there all along

Re: EEPROM, writing and reading.. 8 years 2 months ago #8540

  • RogerTango
  • RogerTango's Avatar
  • Offline
  • Fresh Boarder
  • Thanks received: 2
I think I found a solution to high volume writing.... I2C SRAM, if I can ever get my I2C setup working. Or SD card, if i can ever get the SD lib to fit in a chip.

Re: EEPROM, writing and reading.. 8 years 2 months ago #8547

  • jmessina
  • jmessina's Avatar
  • Offline
  • Senior Boarder
  • Posts: 44
  • Thanks received: 189
Battin' 0 for 2 so far, huh? Sorry, can't help too much with the Proton side of things.

BTW, did you mean FRAM instead of SRAM? SRAM wouldn't hold the contents after power cycle, but FRAM (made by Ramtron) would. Nice stuff, but expensive.

Re: EEPROM, writing and reading.. 8 years 2 months ago #8549

  • W4GNS
  • W4GNS's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 11
  • Thanks received: 43
Looks like this is what he found in the samples, which was apparently ported from PBP

' PicBasic Plus program to read and write to I2C Serial FRAM
'
' Write to the first 16 locations of an external Serial Eeprom
' Read first 16 locations back and send to LCD repeatedly
' Note: for serial eeproms with WORD-sized address
Time to create page: 0.253 seconds