If I use EEPROM.write(someAddr, someValue)
to write a value to an address, how long will that value "stick" to that address before being lost?
If I were to power down the Arduino, flash a whole new program to it, and power it on, could I still retrieve that old/cached value written from the previous program?
-
I am also interested in a technical answer to your first paragraph. Do you not have an Arduino to perform the test in the second paragraph yourself?linhartr22– linhartr222015年05月21日 21:25:11 +00:00Commented May 21, 2015 at 21:25
2 Answers 2
Only if the EESAVE
fuse is programmed (it is unprogrammed by default). If not then the EEPROM will be erased when a chip erase command is performed.
-
Do you know how the Arduino IDE handles this? There are zero user options there.Joris Groosman– Joris Groosman2015年05月14日 18:04:11 +00:00Commented May 14, 2015 at 18:04
-
@JorisGroosman: It doesn't. You'll need to use avrdude and ISP in order to read or manipulate the fuses.Ignacio Vazquez-Abrams– Ignacio Vazquez-Abrams2015年05月14日 18:07:27 +00:00Commented May 14, 2015 at 18:07
-
So the IDE erases the EEPROM? I would say this explicitly in your answer, it seems important.Joris Groosman– Joris Groosman2015年05月14日 18:10:24 +00:00Commented May 14, 2015 at 18:10
-
@JorisGroosman: It erases the EEPROM if the
EESAVE
fuse isn't programmed.Ignacio Vazquez-Abrams– Ignacio Vazquez-Abrams2015年05月14日 18:17:33 +00:00Commented May 14, 2015 at 18:17 -
1I have couple of Unos, all of them keep eeprom content betweem flashing and I did not do anything with fuses.Michal Foksa– Michal Foksa2015年05月15日 12:51:47 +00:00Commented May 15, 2015 at 12:51
how long will that value "stick" to that address before being lost?
The Atmega328 data retention is guaranteed by Atmel (the manufacturer) for 20 years at 85 degrees Celsius, 100 years at 25 degrees Celsius. Beware cheap Chinese clones usually use counterfeits chips, meaning those values are not going to be guaranteed any more
If I were to power down the Arduino, flash a whole new program to it, and power it on, could I still retrieve that old/cached value written from the previous program?
While @ignacio answer is more detailed I believe you are interested in plain Arduino IDE programming along with standard Arduino boards, in which case the answer is yes, the data is not going to be erased.