EEPROM Config - Exceeded maximum number of writes

Started by HeneryH, November 28, 2018, 12:20:43 PM

HeneryH

I have a Mote that I am using in a SwitchMote scenario and this device seems to be giving me trouble with the EEPROM.  I just want to clear it out and start over.

I tried resetting the EEPROM via menu and got the following error
Exceeded maximum number of writes


Now even when I try to save the config I get the same error.

Anyone ever seem this before?

Felix

Haven't seen this, but it's a great catch.
Looks like it's because of them setting a "conservative" write limit of 100:
https://github.com/thijse/Arduino-EEPROMEx/blob/master/EEPROMex.cpp#L40

And so I guess I never hit the 100 limit myself :o
Usually I configure a SwitchMote after assembly, and after install there's no more touching it. So a minimal amount of EEPROM writes happens.
If you keep playing with the menu, then the 100x limit can be reached pretty quick. But 100 is stupid conservative...

The real official limit on AVRs is on the order of 100k:
https://arduino.stackexchange.com/questions/226/what-is-the-real-lifetime-of-eeprom

The fix is to have the EEPROMex library increase this limit. I already updated the SwitchMote sketches to include this fix.

Or to fix this in your existing sketch, add this line to your setup() before calling anything else on EEPROM (parameter is signed INT so it could be as high as 32767):

EEPROM.setMaxAllowedWrites(10000);



Thanks for reporting this!