I'm thinking about implementing a data acquisition system for recording very rare events over a long time span. I'd like to make it robust in the event of power failure (whether deliberately cut by the user or due to some unexpected event.) Options for storing the data include some form of external flash memory (e.g. SD card), the uC's own unused flash memory and the uC's EEPROM.
The questions I have are:
1. Am I correct in understanding that the EEPROM may be written one byte at a time?
2. An SD card or the AVR's flash memory has to be written to a block at a time (correct?).
(I'm trying to figure out if I can write event data immediately as they occur or if I have to buffer it.)
3. What ideas would you suggest for detecting that the main power has failed and switching over to a short-term backup supply (like a cap, perhaps)? The backup supply would only have to power the AVR long enough so it could save any unsaved data to the nonvolatile memory.