Open Tarnak-public opened 2 years ago
It is not practical to detect a corrupt filesystem with the limited memory of a microprocessor like SAMD.
SdFat can detect some problems but corrupt FAT chains or corrupt directory trees can cause problems with ls.
Filesystem corruption can occur due to crashes or failure to close files open for write. Best to check and repair the SD on a PC with Linux or windows.
Hi,
I've an problem with recursion on corrupted sdcard which results in freezing of mine SAMD. I presume issue is related to bad files/dirs names or general fat structure malforming.
Suggested solution:
sdfat: 2.1.2 ide: vscode + platformio board: MKR Zero sdfatconfig.h is default
Below code used on correctly structured sdcard works great:
code is executed with:
SD.ls(&debugSerialPort, LS_R); //full recursion, on corrupted card it fails
I've prepared image with HDDRawCopy tool which can write/read images of files, link to raw image: https://github.com/Tarnak-public/filehosting_for_issues/blob/b5622e9fa7623ae8ed1ce3dbe7849688353938a2/sdfat/recursion_on_malformed_sdcard/SDcardMalformed.7z