It appears that when I load a new sketch, the EEPROM is cleared by the bootloader. Is this the specified behaviour ? ( if so, is there documentation ? ). If not, then either it isn't working right or I've done something really silly.
Assuming you are using Optiboot...
https://github.com/WestfW/Arduino/blob/master/hardware/arduino/bootloaders/optiboot/optiboot.c
...there is nothing in there that touches the EEPROM.
hamiljf:
It appears that when I load a new sketch, the EEPROM is cleared by the bootloader. Is this the specified behaviour ? ( if so, is there documentation ? ). If not, then either it isn't working right or I've done something really silly.
Bootloading a new sketch to flash memory does not effect EEPROM memory contents.
So, I vote for the really silly part. Post your code that reads and writes to the EEPROM and perhaps someone can tell how silly or not it is.
EEPROM is not touched by sketch download. That would be detrimantal to EEPROM lifespan.
Perhaps your pointers to it are not correct?
Thanks for the confirmation. The worst has happened: re-run the test and it worked perfectly. So now I have no clue why it did not work before.
But Crossroads raises a nasty point: EEPROM lifespan ?
I know that early EEPROMs had a limited lifespan and that file management systems used to write into new space rather than rewrite into old to reduce the number of rewrites, but did not realise this is still the case. Is there guidance on rewrites allowed ?
EEPROM rewrites - 100,000 writes.
That's at extremes of voltage, temperature.
At less extremes, and spread over time, quantity will likely be higher.