Add more information to FATFS errors
Due to FAT filesystem corruption, the FATFS library was returning an
assertion failed error. It wasn't obvious from the error message what
was going wrong, so I added a hint for when this happens again.
@@ -41,26 +41,26 @@ const char *fatfs_error_to_string(FRESULT err)
{
switch (err) {
case FR_OK: return "Succeeded";
- case FR_DISK_ERR: return "A hard error occurred in the low level disk I/O layer";
- case FR_INT_ERR: return "Assertion failed";
- case FR_NOT_READY: return "The physical drive cannot work";
- case FR_NO_FILE: return "Could not find the file";
- case FR_NO_PATH: return "Could not find the path";
- case FR_INVALID_NAME: return "The path name format is invalid";
- case FR_DENIED: return "Access denied due to prohibited access or directory full";
- case FR_EXIST: return "Destination file already exists";
- case FR_INVALID_OBJECT: return "The file/directory object is invalid";
- case FR_WRITE_PROTECTED: return "The physical drive is write protected";
- case FR_INVALID_DRIVE: return "The logical drive number is invalid";
- case FR_NOT_ENABLED: return "The volume has no work area";
- case FR_NO_FILESYSTEM: return "There is no valid FAT volume";
- case FR_MKFS_ABORTED: return "f_mkfs() aborted due to a parameter error. Try adjusting the partition size.";
- case FR_TIMEOUT: return "Could not get a grant to access the volume within defined period";
- case FR_LOCKED: return "The operation is rejected according to the file sharing policy";
- case FR_NOT_ENOUGH_CORE: return "LFN working buffer could not be allocated";
- case FR_TOO_MANY_OPEN_FILES: return "Number of open files > _FS_SHARE";
+ case FR_DISK_ERR: return "FATFS: A hard error occurred in the low level disk I/O layer";
+ case FR_INT_ERR: return "FATFS: Assertion failed (check for corruption)";
+ case FR_NOT_READY: return "FATFS: The physical drive cannot work";
+ case FR_NO_FILE: return "FATFS: Could not find the file";
+ case FR_NO_PATH: return "FATFS: Could not find the path";
+ case FR_INVALID_NAME: return "FATFS: The path name format is invalid";
+ case FR_DENIED: return "FATFS: Access denied due to prohibited access or directory full";
+ case FR_EXIST: return "FATFS: Destination file already exists";
+ case FR_INVALID_OBJECT: return "FATFS: The file/directory object is invalid";
+ case FR_WRITE_PROTECTED: return "FATFS: The physical drive is write protected";
+ case FR_INVALID_DRIVE: return "FATFS: The logical drive number is invalid";
+ case FR_NOT_ENABLED: return "FATFS: The volume has no work area";
+ case FR_NO_FILESYSTEM: return "FATFS: There is no valid FAT volume";
+ case FR_MKFS_ABORTED: return "FATFS: f_mkfs() aborted due to a parameter error. Try adjusting the partition size.";
+ case FR_TIMEOUT: return "FATFS: Could not get a grant to access the volume within defined period";
+ case FR_LOCKED: return "FATFS: The operation is rejected according to the file sharing policy";
+ case FR_NOT_ENOUGH_CORE: return "FATFS: LFN working buffer could not be allocated";
+ case FR_TOO_MANY_OPEN_FILES: return "FATFS: Number of open files > _FS_SHARE";
default:
- case FR_INVALID_PARAMETER: return "Invalid";
+ case FR_INVALID_PARAMETER: return "FATFS: Invalid parameter";
}
}
