Open sengulhamza opened 9 months ago
Hi @sengulhamza,
Is it possible you're losing power between creating a new file and the first call to lfs_file_sync
/lfs_file_close
?
When you create a new file with lfs_file_open
it creates a zero-length file to put the filename somewhere. If you lose power before lfs_file_sync
/lfs_file_close
the zero-length file will still be there.
There some work planned to avoid this case (basically an "ignore me" file type), but it is not yet implemented.
Maybe, I am losing the power, I am not sure actually. We are working on new HW design of device. When it ready I will try on it. For now, I am saving critical parameters to internal flash too.
Thank you for reply. @geky
Hello,
In our R&D project, we are using nRF9160 and mx25r64 external flash. The project uses Zephyr as an OS. Nordic SDK 2.4.0 v2.4.0/modules/littlefs git commit hash ca583fd297ceb48bced3c2548600dc615d67af24 We are running LittleFS to use mx25r64. We did our tests all day long, there was no problem, but we saw a problem in two of our devices. The file system is mounting, we can list and see the files, but the file size returns zero as the value in the reading stage. It seems like the file is corrupted. The file is there, but the size is 0. This problem was seen in our devices that have finished their software and are working in the field.
entry.size returns 0.
When I delete and rewrite the file, or overwrite it, and read it again, there is no problem, but it contains important calibration data. I need to dismantle the device from the field.
What could be the cause, I am open to your suggestions.
Sincerely,