EEPROM - default values


I read the “factory initialized” value of an EEPROM address and it returned FF (or 255 decimal). Is this correct that all EEPROM values are factory-initialized to FF or is this “coincidence” and not trustworthy to test on?


AFAIK this is default, but I would never rely on defaults.
They may change due to changes in production or QC procedures, or may even have been changed by a previous firmware that has not been erased/overwritten correctly.
So I’d always make sure, the data stored is my data an is valid, before using it - e.g. magic numbers, checksums, backups, …

There is a simple way to do this. I always use this method in my project.
Put a head-tail byte (e.g. 0xAA, 0x55) to indicate whether you should initialize the EE to factory default. What u will notice is, as project proceed, EE mapping may change. Unless u can define every bytes upfront which I found impossible :frowning: