You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've taken a look at the littlefs design documentation, and there are some examples of how to identify and deal with bad areas. I wonder if calling lfs_file_write() returns LFS_ERR_OK, does that mean the data was written correctly? Do we also need to customize the contents of the file, such as adding crc, and then reading it out to verify the crc after successful writing?
The text was updated successfully, but these errors were encountered:
Hi @binlaodi, thanks for creating an issue, sorry about the late response.
First thing to note is that lfs_file_write caches data and doesn't write it immediately, but you can force pending writes to be written to disk with lfs_file_sync.
Second thing to note is that LFS_ERR_OK indicates the data was written to disk to the best of littlefs's knowledge. The way littlefs works is that on every prog operation, it immediately reads back the data to check that the data read matches the data written. If it doesn't match littlefs move the data to a different block.
But this only happens at write time, and doesn't account for errors that may occur to the data after writing. There are some plans to add data checksumming in the future, but right now any bit errors that develop after writing+verification go undetected.
So you don't need a separate CRC to verify writes, but it may be useful for verifying data at read time.
Alternatively, implementing error correction in the block device layer (some block devices provide this in hardware) can also protect against bit errors, but may require more work to implement.
I've taken a look at the littlefs design documentation, and there are some examples of how to identify and deal with bad areas. I wonder if calling lfs_file_write() returns LFS_ERR_OK, does that mean the data was written correctly? Do we also need to customize the contents of the file, such as adding crc, and then reading it out to verify the crc after successful writing?
The text was updated successfully, but these errors were encountered: