Go Down

Topic: Flash & EEPROM memory maximum life (Read 3782 times) previous topic - next topic

Nick Gammon


I don't think he does sleep!


I sleep. And I drink. :)

Later in the day my posts get a bit more snippy. ;)
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

bibre

See you tomorrow, Nick. I'm going to watch a movie and then go to sleep, before I pass away!!!
Billy     http://www.z-world.com/operations/gbremer/

When you've eliminated the impossible,
whatever remains, however improbable, must be

bibre

#17
Apr 08, 2012, 09:39 am Last Edit: Apr 08, 2012, 09:44 am by bibre Reason: 1
Quote
I sleep. And I drink.


WE drink. ¡SALUD Nick!

And I don't think so, you DO NOT sleep amigo. Gracias por ayudarnos. ┬┐Vete a acostarte YA!!!

As I said before Nick, "never leave this board"
Billy     http://www.z-world.com/operations/gbremer/

When you've eliminated the impossible,
whatever remains, however improbable, must be

Nick Gammon

Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Coding Badly

EEPROM is organized into pages of 4 bytes. So you will wear out 4 bytes at a time.


Naw.  EEPROM paging is strictly to facilitate writing by an external programmer.  AVR internal EEPROMs really are composed of one byte cells.

bibre

Good night, my friend. You really have the Flash of Genious!!! Thanx.
Billy     http://www.z-world.com/operations/gbremer/

When you've eliminated the impossible,
whatever remains, however improbable, must be

bibre

@Coding Badly

Thanx.

So, would I better be sending my data to the host and store it there??? That's what I'm doing now.
Billy     http://www.z-world.com/operations/gbremer/

When you've eliminated the impossible,
whatever remains, however improbable, must be

bibre

Buenas noches, Nick!

What the heck are you doing there, Nick? What time is it in the outback?, C'mon amigo, go to rest. You've helped us! Go to sleep and please ... be here for us!

You will always be my friend.
Billy     http://www.z-world.com/operations/gbremer/

When you've eliminated the impossible,
whatever remains, however improbable, must be

Udo Klein

Check out my experiments http://blog.blinkenlight.net

bibre

Quote
You might want to have a look at this experiment: http://blog.blinkenlight.net/experiments/counting-resets/wear-leveling/.


Interesting idea, thank you.   8)
Billy     http://www.z-world.com/operations/gbremer/

When you've eliminated the impossible,
whatever remains, however improbable, must be

bibre

@James C4S

Quote

Program code (outside of the bootloader partition) can't save to PROGMEM.


You are right, I had completely forgotten that :smiley-red:, since I've never used PROGMEM at all. I had only read about it.

And it makes sense since PROGMEM is only updated when uploading the sketch. Or is it also updated at reset/power-up time?

Not good for run time variable data but for constant data. It is clear to me now.

Thank you, James!   :)
Billy     http://www.z-world.com/operations/gbremer/

When you've eliminated the impossible,
whatever remains, however improbable, must be

cjdelphi

#26
Apr 09, 2012, 04:07 am Last Edit: Apr 09, 2012, 04:15 am by cjdelphi Reason: 1
I just thought up another way, it would take a bit more coding but...

1st byte contains (0.255), you boot up, read the first byte (byte 1) of eeprom, this value represents how many times you've used that 4 bytes of memory (writing)  everytime you do a write say bytes 2,3,4,5, read... Byte 1 becomes 2, etc etc.

When Byte 1 reaches 255;, leave the first 5 bytes of memory alone (so you read byte 1, is it at 255? if so, Seek 5 bytes into the EEPROM, this time, you you read it, 0 and the counter begins again, and start again, if the the next write value says 255, then read further until you find 0 . sequentially reading every 5 bytes of eeprom to find the starting memory address in which to safely write the new data.., the beauty of this is, when you've used 100 (X amount of segments eg divide 5 bytes into total eeprom memory) you can wipe every byte counter back to 0 and start again giving a nice even wear of memory to the eeprom, ie not maxing out it's life cycle for individual bytes leaving an average life left for device, even after using it for 3 years you could then sell it on knowing full well it's going to keep working for some time to come....


the first time the program runs you could format the memory, 1,5,10,15...... to the end of eeprom gets set to 0.

eeprom[1]=1;
write 2,3,4,5
eeprom[1]=2;///

if (eeprom[1]=255)
 {
    baseaddress=baseaddress+5;
}

int returnbaseaddress();

{
scan through each 5 bytes reading memory...
etc etc
}

Nick Gammon

That's pretty much what I was suggesting, except to use 2 bytes. The EEPROM can stand more than 255 writes.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

cjdelphi

255 is to keep it even... so you end up using all of the EEPROM memory then you reset it all back to 0 and start again..

so for example, you don't use bytes 1,2,3,4,5 10,0000 times rendering the memory almost dead and have the rest of memory in near perfect condition, you'd not be able to sell it.

doing a 255 cycle on it means you even it out so selling it on you'd not have to worry about wearing just a few bytes of memory out.

Osgeld


And it makes sense since PROGMEM is only updated when uploading the sketch. Or is it also updated at reset/power-up time?


its only updated when you upload
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL

Go Up