Closed bhupiister closed 2 years ago
I can't help since it's a intermittent hardware read error and I can't guess what causes it.
On ESP32 this could be due to a glitch or noise on the SPI bus. I have had poor luck diagnosing ESP32 problems remotely.
Could this error be remotely related to available heap size? This is kind of show stopper for me. I recently shifted to SDFat because of its feature to work on half duplex mode as SPI bus is shared by tft Display as well and its much faster than standard SD library.
@greiman I think i have solved the problem. I am not sure though. When you said that SPI bus may have glitch or noise, it came to my mind that since display and SD card are sharing same SPI bus, it can be the case that they both are interfering. Since my UI updates progress bar when uploading files. I created semaphore between them and made sure only one of them access the SPI bus at a time and i think that made the problem go away.
Using library version: Latest(Master) Board: ESP32 (M5 Core2)
I am reading a .wav file of roughly around 1-2 MB and uploading it to server. While most of the time it works, but on some files i get this error and read operation returns -1. On further investigating i found the exact line where it happens. If i reinitialize SD card and try again, it gets successful.
DBG_FAIL: FatFile.cpp.972
code at FatFile.cpp line 972
My Read code