• AVR Freaks

EEPROM: Erase a zero word before writing?

Author
Bob Snyder
Starting Member
  • Total Posts : 29
  • Reward points : 0
  • Joined: 2011/01/18 18:07:05
  • Location: Morrisdale PA
  • Status: offline
2011/01/18 18:44:48 (permalink)
0

EEPROM: Erase a zero word before writing?

I would like to minimize wear and tear on data EEPROM by avoiding unnecessary erase and write operations.
 
Questions:
 
  1. Am I correct in assuming that an erase contributes to the wear and tear on the EEPROM?
 
  2. If a word of data EEPROM currently reads out as a zero value, is it necessary to erase the word prior to writing it?
 
    In other words, would the following approach be valid?
 
      let newval = <new value we wish to assign to EEPROM word>
      let curval = <current value of EEPROM word>
      if (newval != curval) {
        if (curval != 0) {
          <erase EEPROM word>
        }
        <write new value to EEPROM word>
      }
 
Thanks.
#1

7 Replies Related Threads

    sborden
    Super Member
    • Total Posts : 1951
    • Reward points : 0
    • Joined: 2010/08/05 02:12:53
    • Location: 0
    • Status: offline
    Re:EEPROM: Erase a zero word before writing? 2011/01/18 19:07:47 (permalink)
    0
    The "erase' sequence is actually a required part of the "write" cycle to prevent "unwanted" writes, which is why it must immediately preceed the write.
    #2
    Brick
    Super Member
    • Total Posts : 1684
    • Reward points : 0
    • Joined: 2006/05/25 09:10:40
    • Status: offline
    Re:EEPROM: Erase a zero word before writing? 2011/01/18 21:22:31 (permalink)
    0
    an, esentially when you are "writting" you are only even clearing bits (1>0) never (0>1)

    When you "erase" a location you set all the bits to "1".
    #3
    sborden
    Super Member
    • Total Posts : 1951
    • Reward points : 0
    • Joined: 2010/08/05 02:12:53
    • Location: 0
    • Status: offline
    Re:EEPROM: Erase a zero word before writing? 2011/01/18 23:20:33 (permalink)
    0
    Never really thought about it.  Does explain why it is mandatory wink
    #4
    threedog
    Super Member
    • Total Posts : 998
    • Reward points : 0
    • Joined: 2009/12/04 12:28:11
    • Location: Boise
    • Status: offline
    Re:EEPROM: Erase a zero word before writing? 2011/01/19 12:29:41 (permalink)
    0
    moshannon 
      1. Am I correct in assuming that an erase contributes to the wear and tear on the EEPROM?
     
    yes, the number of erase cycles is specified in the elecrical characteristic. 
     
    moshannon   
      2. If a word of data EEPROM currently reads out as a zero value, is it necessary to erase the word prior to writing it?
     
    yes, you can change a EEPROM cell from "1" to "0" with a write.  But only an erase changes the cells back to "1", then you write the new value.
    If the expected updates exceede the EEPROM cycle rate, then you should consider a wear leveling algorithym.
    A simple method might be to read after write, and if the values do not match, then find another location to write the data.
    This implies that data is not at absolute EEPROM addresses.
     
    #5
    Bob Snyder
    Starting Member
    • Total Posts : 29
    • Reward points : 0
    • Joined: 2011/01/18 18:07:05
    • Location: Morrisdale PA
    • Status: offline
    Re:EEPROM: Erase a zero word before writing? 2011/01/20 07:19:42 (permalink)
    0
    threedog

    If the expected updates exceede the EEPROM cycle rate, then you should consider a wear leveling algorithym.
    A simple method might be to read after write, and if the values do not match, then find another location to write the data.
    This implies that data is not at absolute EEPROM addresses.
     


    Is it safe to assume that if a word reads back the value that was just written, that the new value will "stick" permanently? Or do nearly-worn-out cells have a tendency to spontaneously flip a bit once in a while, even after successful verification? In other words, would it be advisable to maintain a cycle counter for each cell and assume that the cell is worn out when a certain cycle count is reached? Of course, by the time that the cycle counter reached the threshold, the cycle counter EEPROM would also be worn out and need to be discarded, which would add to the memory cost.   sad
     
    If your life depended upon the accuracy of the EEPROM data, would you wait until verification failure occurred before abandoning the cell and moving the data to a new one, or would you proactively abandon the cell after a certain number of cycles?  (or use a combination of both approaches?)
     
    Maybe I should be thinking in terms of error-correcting codes?
     
    Thanks.
    #6
    sborden
    Super Member
    • Total Posts : 1951
    • Reward points : 0
    • Joined: 2010/08/05 02:12:53
    • Location: 0
    • Status: offline
    Re:EEPROM: Erase a zero word before writing? 2011/01/20 13:39:41 (permalink)
    0
    If my life depended on it, I would not be using a PIC wink
    #7
    Brick
    Super Member
    • Total Posts : 1684
    • Reward points : 0
    • Joined: 2006/05/25 09:10:40
    • Status: offline
    Re:EEPROM: Erase a zero word before writing? 2011/01/20 16:33:48 (permalink)
    0
    Seriously is this used for critical operations that could result in harm to a person? If so then you should talk to Microchip about this.

    Random Changes? The good old classic cosmic ray, could hit the chip and change its value. Its not impossible, the not excatly an everyday event, that it could flip.

    Hence, Im happy bet $10 on it staying the same (odds are I'll make a bit of money) but not my life....
     
    #8
    Jump to:
    © 2019 APG vNext Commercial Version 4.5