How to avoid exceeding maximum EEMEM writes

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I want to record total pulses that will come in at approximately 20hz. If I write to the eemem every pulse, then maximum writes wil be exceeded pretty quickly. (100,100writes/20per sec)/3600sec/hr = less than two hours.

I'm thinking of recording the pulses to eemem at power down, by using a resistor and a large capacitor in the power line, monitor the voltage, and record to the eemem when the supply voltage drops. Quickly, of course, before the the capacitor discharges.

Has anybody done this? Any other ideas? --Karl

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How accurate must the logging be? Can you live with losing some of the pulse count?

I'm thinking: Decide how long the device needs to work. Let's say two months. In round figures this means one write every minute, rather than e.g. every second.

Now... If the count is the only thing you need to keep a count of and store in EEPROM then you can distribute the wear over the complete EEPROM. I.e. you have 100K erase/write cycles for address 0, and then 100K W/E cycles for address 1 etc... Now you can extend the lifetime if that is prioritized, or the granularity of writes, or some combo of those.

And of-course, you only erase/write if the new value is different from the old. AVR-GCC/avrlibc has EEPROM routines that has this built in. Reading the EEPROM before deciding whether to write or not does not wear the EEPROM down. There has been many previous discussions on how to ditribute the wear over the whole EEPROM - search them out.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Or power your avr with a supercap or something and switch to a sub-micro-amp mode when the power goes out so the supercap can run it for weeks of power outage. Then you don't need to store in eeprom at all.

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Or just a battery backup? Additional hardware: Battery, an R and 2 zeners IIRC. Tell me if I should look up the schematic sketch I saved. Included possibility to sense on an AVR pin when it falls back to the battery so you can apply power-saving things.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]