ALFAT power off tests

OK I did some testing with ALFAT reliability:

One thread writes (mount, open, (write and flush continously until error detected)) a log entry every 1 second. The log entry contains entry number, date, and 500 '#' symbols.
Another independent thread turns off power (via relay) for 5 ms ant random intervals from 500ms to 5000ms.
10000 power offs.

ALFAT tested was 1.0.8.
Test went trully good - card did not needed to be formated and data could be written and read after the test.
But check lines 6320 and 7770 (attached immages since log can not be added). Well in case of 6320 I suspect that it is normal if I disconnected power in middle of writing some unexpected/binary character blocks may appear. But with 7770 it is strange that just few odd bits change value. Can someone explain that effect to me?

FAT file system, by design, is not a journaling file system and it is not safe when it comes to power loss or removing the media before the data is completely flushed on the drive. This is the case on ALFAT, on a PC and on any device that uses FAT file system.

ALFAT 2 includes a flush all feature where a pin can trigger flush all when power loss.

The first image shows scrambled data under [em]normal [/em]power conditions. That’s what bugs us.

You are using ALFAT?

Yup.

If files are closed before the media is removed or power is lost, you should never see corrupted data.

Right Gus, your favorite exception “This should never happen” found many times in your firmware code :slight_smile: However, it [em]did [/em]happen.

Can you reproduce it? We have done plenty of testing that makes me feel very confident about this.

Unfortunately, no. Hopefully we can discard it as a magnetic storm side effect.