Bad Eeprom write on '628???


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Jul 2006
    Posts
    22


    Did you find this post helpful? Yes | No

    Default This is my circuit

    As you can see the schematic is very simple.
    I try to make the changes what you say, view the ADDED.jpg file I think that this may work, today I also make code changes and i try again, let know if the the squematics looks like you say,

    Thanks
    Attached Images Attached Images   

  2. #2
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    I have given this consideration for a project that I am working on as well.

    Realistically how often is the status of the relays going to change ?

    How many times per day in total ?

    The EEPROM typically has a life of 1 million cycles which can be used up very quickly with frequent updates, or may well outlive everyone on this list if the frequency of updates is quite low.

    What is the designed lifespan for your product ?

    1 second = 86400 per day = 11.57 days
    10 seconds = 8640 per day = 115.7 days
    30 seconds = 2880 per day = 347 days
    1 minute = 1440 per day = 694 days
    5 minutes = 288 per day = 9.5 years
    10 minutes = 144 per day = 19.0 years
    30 minutes = 48 per day = 57.1 years
    1 hour = 24 per day = 114 years
    2 hours = 12 per day = 228 years
    6 hours = 4 per day = 685 years
    12 hours = 2 per day = 1370 years
    24 hours = 1 per day = 2740 years

    If there are less than 50 updates per day then I wouldnt bother trying to detect power failure as its going to take over 50 years to kil the eeprom, even updating every five minutes will give you the best part of 10 years.
    Keith

    www.diyha.co.uk
    www.kat5.tv

  3. #3
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    Hi Keith,

    Something has been bugging me for several years after reading about the lifetime of an EEPROM. Is the lifetime determined by how many times you write to the EEPROM as a whole or is it per location of the EEPROM? Just curious.

    Thanks,

    BobK

  4. #4
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by BobK View Post
    Hi Keith,

    Something has been bugging me for several years after reading about the lifetime of an EEPROM. Is the lifetime determined by how many times you write to the EEPROM as a whole or is it per location of the EEPROM? Just curious.

    Thanks,

    BobK
    Dunno is the short answer.

    It might be limited to blocks of memory because I have see mention of moving the location where you store data after x number of writes to get a longer lifetime.

    EG 4 times the memory size so you use the first quarter then move the the second quarter etc.

    Hopefully someone with more experiece of EEPROM will give a better answer
    Keith

    www.diyha.co.uk
    www.kat5.tv

  5. #5
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    967


    Did you find this post helpful? Yes | No

    Thumbs up

    Quote Originally Posted by keithdoxey View Post
    The EEPROM typically has a life of 1 million cycles which can be used up very quickly with frequent updates, or may well outlive everyone on this list if the frequency of updates is quite low.

    What is the designed lifespan for your product ?

    1 second = 86400 per day = 11.57 days
    10 seconds = 8640 per day = 115.7 days
    30 seconds = 2880 per day = 347 days
    1 minute = 1440 per day = 694 days
    5 minutes = 288 per day = 9.5 years
    10 minutes = 144 per day = 19.0 years
    30 minutes = 48 per day = 57.1 years
    1 hour = 24 per day = 114 years
    2 hours = 12 per day = 228 years
    6 hours = 4 per day = 685 years
    12 hours = 2 per day = 1370 years
    24 hours = 1 per day = 2740 years
    Keith

    This post of yours is brilliant. You explain very clearly the way the million cycles can be used up and how fast.

    Jerson

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Jerson View Post
    Keith

    This post of yours is brilliant. You explain very clearly the way the million cycles can be used up and how fast.

    Jerson
    I've done something slightly different, but hey, it works for me...
    Got a project (temp/fan controller type thing), controls 4 relays, runs off mains power most of the time, super-low current trickle charger on a battery pack, really small solar cells backing those up...
    I save the current relay status about every 10 seconds, 4 bits total. 256 bytes of eeprom. When the unit was first fired up, I cleared all of the eeprom to $ff. The first time I wrote to a byte, I clear bit 7 in byte 0, and saved the status to the lower 4 bits. The next time, I looked for the first byte in the eeprom with bit 7 set, then cleared that byte's bit 7 and saved the status to the lower 4 bits, and so on and so on and so on...
    When I get to byte 255, I check the power on the mains (make sure I'm not running off battery backup), then clear all of the bytes back to $ff and start the process over again.
    If main power fails, then comes back on, I look for the last byte in the eeprom with bit 7 cleared and read the state from it...then resave it of course...
    This way, I use each of the bytes equally (by looking for the first byte with bit 7 set) and saving the state there. According to the table above, I should get about 40 years or so out of this controller. The building will fall down before that!
    Then again, there's a thousand different ways to do 'wear levelling' with eeprom/flash and as stated earlier...a guy generally doesn't have to worry about it. I've got an article somewhere that talks all about wearing out eeprom/flash and according to this article, the key is to keep the voltage as low as possible and write as slow as possible (up to the point of doing multiple rewrites at marginal voltage) for maximum eeprom life...and temperature has a lot to do with lifespan. The article also went on to say that even after an eeprom cell has failed during normal writing procedures, rewriting the same cell a few times (within reason of course) will usually work just fine.

    I wonder how many of us have actually worn out the flash in a PIC yet...if any...? I thought I did once, turned out the regulator on the MCLR pin went south for the winter (and the rest of the year for that matter)...

  7. #7
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    view the ADDED.jpg
    Your “ADDED” schematic shows a 16F84A, which has no analog features – if you are using this PIC, you will need to use an external comparator (or something else) to detect the dropping voltage. On the plus side, the 84A has a 10,000,000 EEPROM Write endurance, which is 10X that of the 16F628. This means you can 10X the numbers Keith has in post 7. Also keep in mind these numbers are theoretical and not guaranteed (but in many cases, way conservative).

    If you are using the F628, the only change I have on my schematic is another diode between the anode and the analog pin. This ensures the the analog input voltage is the same as VDD and not higher (which would be out of spec).

    The best thing to do would be to skip the power detect and do as Jerson suggested (and not record every second but only when a change was detected). If the estimated number of changes is not too many (see Keith's post 7 for numbers), then you are set. If it is too many, you have another option. You can, in software, set up a “wear leveling” approach (as SKIMASK just noted while I was writing this) and use all locations of the EEPROM. This would give you a theoretical endurance of 127 million writes for the 628 and 630 million for the 84A. Some PICs require refreshing of all the EEPROM after a certain number of writes to any location in EEPROM (e.g., 1 Million writes) – check your datasheet. You can extend this approach by using and external EEPROM and have Trillions+ of writes.

    Good Luck
    Last edited by paul borgmeier; - 17th March 2007 at 07:26.
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

Similar Threads

  1. Can't read sequential addresses in external EEPROM
    By tjkelly in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th February 2010, 14:46
  2. Problem with I2C EEPROM addressing
    By Atom058 in forum General
    Replies: 14
    Last Post: - 3rd November 2009, 03:17
  3. PIC16F684 + LCD to use the 256bytes of EEPROM - HELP
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th March 2008, 14:19
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  5. word variable to 25lc640
    By TONIGALEA in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th July 2004, 19:59

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts