On the FatFs API, most of file functions return common result code as enum type FRESULT. When a function succeeded, it returns zero, otherwise returns non-zero value that indicates type of error.
+
Return Code of API Functions
+
Most of API functions return common result code as enum type FRESULT. When an API function succeeded, it returns zero (FR_OK), otherwise it returns non-zero value indicates type of error.
+
FR_OK (0)
The function succeeded.
+
FR_DISK_ERR
-
An unrecoverable hard error occured in the lower layer, disk_read(), disk_write() or disk_ioctl() function. Note that if once this error occured at any operation to an open file, the file object is aborted and all operations to the file except for close will be rejected.
+
An unrecoverable hard error occured in the lower layer, disk_read, disk_write or disk_ioctl function. Note that if once this error occured at any operation to an open file, the file object is aborted and all operations to the file except for close will be rejected.
+
FR_INT_ERR
Assertion failed. An insanity is detected in the internal process. One of the following possibilities is suspected.
Work area (file system object, file object or etc...) has been broken by stack overflow or any other tasks. This is the reason in most case.
-
There is any error of the FAT structure on the volume.
+
There is an error of the FAT structure on the volume.
+
There is a bug in the FatFs module itself.
Note that if once this error occured at any operation to an open file, the file object is aborted and all operations to the file except for close will be rejected.
+
FR_NOT_READY
-
The disk drive cannot work due to incorrect medium removal or disk_initialize() function failed.
+
The storage device cannot work due to a failure of disk_initialize function due to no medium or any other reason.
The required access was denied due to one of the following reasons:
@@ -42,46 +51,66 @@ Note that if once this error occured at any operation to an open file, the file
Deleting the non-empty directory or current directory.
Reading the file opened without FA_READ flag.
Any modification to the file opened without FA_WRITE flag.
-
Could not create the file or directory due to the directory table is full.
-
Could not create the directory due to the volume is full.
+
Could not create the object due to root directory full or disk full.
+
Could not allocate a contiguous area to the file.
+
FR_EXIST
-
Name collision. Any object that has the same name is already existing.
+
Name collision. An object with the same name is already existing.
+
FR_INVALID_OBJECT
-
The file/directory object structure is invalid or a null pointer is given. All open objects of the logical drive are invalidated by the voulme mount process.
+
The file/directory object is invalid or a null pointer is given. There are some reasons as follows:
+
+
It has been closed, it has not been opened or it has been collapsed.
+
It has been invalidated by a voulme mount process. Open objects on the volume are invalidated by voulme mount process.
+
Physical drive is not ready to work due to a media removal.
+
+
+
FR_WRITE_PROTECTED
-
Any write mode operation against the write-protected media.
+
A write mode operation against the write-protected media.
+
FR_INVALID_DRIVE
-
Invalid drive number is specified in the path name. A null pointer is given as the path name. (Related option: _VOLUMES)
+
Invalid drive number is specified in the path name. A null pointer is given as the path name. (Related option: _VOLUMES)
+
FR_NOT_ENABLED
-
Work area for the logical drive has not been registered by f_mount() function.
+
Work area for the logical drive has not been registered by f_mount function.
+
FR_NO_FILESYSTEM
There is no valid FAT volume on the drive.
+
FR_MKFS_ABORTED
-
The f_mkfs() function aborted before start in format due to a reason as follows:
+
The f_mkfs function aborted before start in format due to a reason as follows:
-
The disk/partition size is too small.
-
Not allowable cluster size for this disk. This can occure when number of clusters gets near the boundaries of FAT sub-types.
-
There is no partition related to the logical drive. (Related option: _MULTI_PARTITION)
+
It is pmpossible to formart with the given parameters.
+
The size of volume is too small.
+
The size of given work area is too small.
+
The partition bound to the logical drive coulud not be found. (Related option: _MULTI_PARTITION)
+
FR_TIMEOUT
-
The function was canceled due to a timeout of thread-safe control. (Related option: _TIMEOUT)