SD Card write stability worse since Version 3.0.0
Posted: Sun Apr 18, 2021 8:52 am
Hi,
I'm working on a Bigger Project that writes Loggings to an SD Card using the ESP32 (using both SPI and MMC).
The is developed in Visual Studio Code with PlatformIO and the Arduino Framework.
I can only give Version numbers of the Espressif Framework in PlatformIO.
The code works very stable for more than a year now. but since the introduction of Version 3.1.0 and higher (including 3.2.0) the
SD Card interaction is not reliable anymore.
It took me quite a lot of time to get sure about this. The Problem only appears after multiple hours of writing.
With 3.0.0 I have never problems writing to a file for more than 44h (writing files with sizes above 500MB). With newer versions the file.write(buff, len) function returns 0, the file position freezes and a complete reboot is needed to access the SD Card (also in some casing the SD Card must be reformated)
I believe the Problem is in the Base library to access the SD Card.
I'm always getting the error:
[W][sd_diskio.cpp:181] sdCommand(): token error [13] 0x3
and the file.write(buff, len) returns 0, signaling no bytes where written.
I see this unreliability as a serious matter. not only that I can not rely on the SD Card logging but in general it's quite a core feature of the ESP32 architecture/eco system. As this is quite hard to track down and happens so rarely I'm afraid it will by quite hard to find the Bug. I had the hope it would be fixed with newer versions but I still get the same error with the current 3.2.0 version.
I'm working on an example code that uses simple operations like open and write from a static buffer that crashes after long time with 3.2.0 but not with 3.0.0
I'm personally testing to find this error for a while now and I'm testing it with multiple SD Cards.
I can give further details on the code used if needed.
Greeting,
Jan
I'm working on a Bigger Project that writes Loggings to an SD Card using the ESP32 (using both SPI and MMC).
The is developed in Visual Studio Code with PlatformIO and the Arduino Framework.
I can only give Version numbers of the Espressif Framework in PlatformIO.
The code works very stable for more than a year now. but since the introduction of Version 3.1.0 and higher (including 3.2.0) the
SD Card interaction is not reliable anymore.
It took me quite a lot of time to get sure about this. The Problem only appears after multiple hours of writing.
With 3.0.0 I have never problems writing to a file for more than 44h (writing files with sizes above 500MB). With newer versions the file.write(buff, len) function returns 0, the file position freezes and a complete reboot is needed to access the SD Card (also in some casing the SD Card must be reformated)
I believe the Problem is in the Base library to access the SD Card.
I'm always getting the error:
[W][sd_diskio.cpp:181] sdCommand(): token error [13] 0x3
and the file.write(buff, len) returns 0, signaling no bytes where written.
I see this unreliability as a serious matter. not only that I can not rely on the SD Card logging but in general it's quite a core feature of the ESP32 architecture/eco system. As this is quite hard to track down and happens so rarely I'm afraid it will by quite hard to find the Bug. I had the hope it would be fixed with newer versions but I still get the same error with the current 3.2.0 version.
I'm working on an example code that uses simple operations like open and write from a static buffer that crashes after long time with 3.2.0 but not with 3.0.0
I'm personally testing to find this error for a while now and I'm testing it with multiple SD Cards.
I can give further details on the code used if needed.
Greeting,
Jan