EEPROM

The documentation makes it clear that the EEPROM memory in the Atmel processor is preserved when the device is powered down. "The microcontroller on the Arduino board has EEPROM: memory whose values are kept when the board is turned off (like a tiny hard drive)."

What this does not make clear is the EEPROM memory is preserved when a sketch is loaded, even if it is a totally different sketch - provided of course it does not write to the same EEPROM locations for its own purposes.

alco's picture

Re: EEPROM

yes it let the values in the EEPROM memory even if you load a diverent sketch (that) don't use the EEPROM persistent memory. In fact, I used the Jeelibs RF12 demo sketch (jeelabs.org) for setting the node ID,network and radioband into the memory. and I load it in my nanodeRF board.

So yes, it will work.

dBC's picture

Re: EEPROM

If you're using avrdude and an ISP, then each time you flash a new image you can choose whether or not you want the EEPROM reset to all 0xff (see the -e switch).

I think the only time the default Arduino IDE emits a '-e' switch to avrdude is when you ask it to reflash the bootldr.

And if you want to load the EEPROM with known values at flash time, you can treat it like just another memory section, just use 'eeprom' for <memtype> instead of 'flash'.

dBC's picture

Re: EEPROM

It looks like the Arduino EEPROM interface just give you a byte read and a byte write interface.

The AVR libs (which are available to Adruino programmers) have a much nicer API for this stuff:

http://www.nongnu.org/avr-libc/user-manual/group__avr__eeprom.html

You can store entire C structures out there with the 'block' transactions, and use the 'update' variants which will only write the fields that have changed.   It looks like the Arduino IDE ships with an older lib that doesn't include the 'update' routines, but that's easily fixed should you want to use it.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.