EEPROM writes and BOD
Posted: Sat Sep 27, 2014 6:38 am
After reading the Atmel docs on the 32u4, and various comments concerning the use of BOD, I still have some questions.
I understand that EEPROM is written one byte at a time. If I want to store an int (2 consecutive bytes) I have to do two EEPROM writes (along with the shift and mask to disassemble the int). Beyond the BOD, are there any strategies to make sure that both writes, or no writes, actually happen ? Getting the first write, but having BOD stop the second write (for legitimate reasons, obviously) still leaves my written contents in an unexpected state.
To better explain what is happening here, I am writing a circular list of entries. The circular list is to spread the data being logged around, and to prevent hammering on certain EEPROM locations. It would helpful if I had a way of knowing that an entire entry (currently 2 bytes) is intact or not. The only thing I can think of is adding a CRC/checksum byte to each entry in the list. Better, but still leaves some exposure to a false positive.
I understand that EEPROM is written one byte at a time. If I want to store an int (2 consecutive bytes) I have to do two EEPROM writes (along with the shift and mask to disassemble the int). Beyond the BOD, are there any strategies to make sure that both writes, or no writes, actually happen ? Getting the first write, but having BOD stop the second write (for legitimate reasons, obviously) still leaves my written contents in an unexpected state.
To better explain what is happening here, I am writing a circular list of entries. The circular list is to spread the data being logged around, and to prevent hammering on certain EEPROM locations. It would helpful if I had a way of knowing that an entire entry (currently 2 bytes) is intact or not. The only thing I can think of is adding a CRC/checksum byte to each entry in the list. Better, but still leaves some exposure to a false positive.