ALFAT-SD prevent data corruption

Good afternoon,

I’m using ALFAT-SD in order to memorize log data of other device using UART communication.

Now, I’m in trouble due to damaged the data.
I make the system to send “F” command(Flash File Data) at regular interval,
and send “C” command(Close File) before shut down the system.

However, depending on the operation method, SD card may be removed before sending “C” command.
At the time, the saved data in the SD card may be damaged because don’t close the file.

Is there any way to prevent data corruption even if the SD card is removed before closing the file?

The frequency of data corruption can vary, but the larger the recorded data, the greater the chance of data corruption.

Thank you for any and all help.


FAT file system was not designed to hot removal. There only way to prevent corruption is by closing at data before removing the media.

Thank you for your help.

ALFAT-SD uses the FAT file system,
If SD card is removed during writing, data corruption cannot be prevented.
So, we must close the file before SD card removing.