Pages: 1 [2] 3   Go Down
Author Topic: Flash & EEPROM memory maximum life  (Read 3150 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Online Online
Brattain Member
*****
Karma: 485
Posts: 18778
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't think he does sleep!

I sleep. And I drink. smiley

Later in the day my posts get a bit more snippy. smiley-wink
Logged


Monterrey, N.L. México
Offline Offline
Full Member
***
Karma: 1
Posts: 154
Model Railroading & Arduino are Fun
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

See you tomorrow, Nick. I'm going to watch a movie and then go to sleep, before I pass away!!!
Logged

Billy     http://www.z-world.com/operations/gbremer/

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

Monterrey, N.L. México
Offline Offline
Full Member
***
Karma: 1
Posts: 154
Model Railroading & Arduino are Fun
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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"
« Last Edit: April 08, 2012, 02:44:58 am by bibre » Logged

Billy     http://www.z-world.com/operations/gbremer/

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

Global Moderator
Online Online
Brattain Member
*****
Karma: 485
Posts: 18778
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Buenas noches mi amigo.
Logged


Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 207
Posts: 12912
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Monterrey, N.L. México
Offline Offline
Full Member
***
Karma: 1
Posts: 154
Model Railroading & Arduino are Fun
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Good night, my friend. You really have the Flash of Genious!!! Thanx.
Logged

Billy     http://www.z-world.com/operations/gbremer/

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

Monterrey, N.L. México
Offline Offline
Full Member
***
Karma: 1
Posts: 154
Model Railroading & Arduino are Fun
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@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.
Logged

Billy     http://www.z-world.com/operations/gbremer/

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

Monterrey, N.L. México
Offline Offline
Full Member
***
Karma: 1
Posts: 154
Model Railroading & Arduino are Fun
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Billy     http://www.z-world.com/operations/gbremer/

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

0
Offline Offline
Faraday Member
**
Karma: 23
Posts: 3482
20 LEDs are enough
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Monterrey, N.L. México
Offline Offline
Full Member
***
Karma: 1
Posts: 154
Model Railroading & Arduino are Fun
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Interesting idea, thank you.   smiley-cool
Logged

Billy     http://www.z-world.com/operations/gbremer/

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

Monterrey, N.L. México
Offline Offline
Full Member
***
Karma: 1
Posts: 154
Model Railroading & Arduino are Fun
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@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!   smiley
Logged

Billy     http://www.z-world.com/operations/gbremer/

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

Offline Offline
Edison Member
*
Karma: 29
Posts: 2448
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
}
« Last Edit: April 08, 2012, 09:15:02 pm by cjdelphi » Logged

Global Moderator
Online Online
Brattain Member
*****
Karma: 485
Posts: 18778
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

That's pretty much what I was suggesting, except to use 2 bytes. The EEPROM can stand more than 255 writes.
Logged


Offline Offline
Edison Member
*
Karma: 29
Posts: 2448
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

SE USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Pages: 1 [2] 3   Go Up
Jump to: