Hi everybody!
I'm using SPIFFS file system to store some intermediate data in files. So I use fopen/fread/fwrite/fclose functions to manipulate file contents. Generally everything works OK, but fread fails in about 10% of cases. When it happens ferror returns 1 and errno is equal to 5. I've tried to repeat read operations in such cases, but it does not help at all (if I try to call fread 5 times it fails all 5 times).
I expect that this happens because of some sort of conflict on SPI bus (I also use HSPI to access several peripheral devices from different threads) but I have no proofs for that.
Is where any way to make fread be successful in 100% of calls?
fread fails very often
-
- Posts: 9715
- Joined: Thu Nov 26, 2015 4:08 am
Re: fread fails very often
FWIW, error 5 is EIO, which indeed indicates something has gone wrong in communicating with the device. Something SPI related is likely. Could you elaborate a bit more on your setup, as in, tell us what devices are attached where and how you communicate with them?
Who is online
Users browsing this forum: No registered users and 62 guests