I am using external eeprom to save data periodically. I use a data_pointer to point present memory location . But some time I facing problem that if power is failed during write cycle then data is lost.
For this I use two memory location for pointing the last location.one is for memory pointer and other is for backup pointer. I calculate the CRC for both location. If crc of one is failed then program use back up location for addressing.and if CRC of both failed then I reset both location.I put this reset because I assume that it never happen because I keep delay of 20ms between storing memory_pointer and back up pointer along with crc . I want to know is this is correct method for error handling or there is some better way???