Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

SD card as source for files : very slow and crashes ESP32 most of the time (watchdog got triggered ...) #1123

Closed
simkard69 opened this issue Feb 21, 2022 · 1 comment

Comments

@simkard69
Copy link

Hello Everyone,

I've tried to run the AsyncWebServer on an ESP32 to serve files from the SD card (connected as SPI // not 1bit or 4bit connections).
So I'm basically using SD and FS libraries and I've tried these initiators :
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){ request->send(SPIFFS, "/index.htm", "text/html"); }); < Working 100% and relatively fast
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){ request->send(SD, "/webui/index.htm", "text/html"); }); < Do not work at all on small files, large files goes the same (starts to appear on browser very slowly and at some point, ESP32 crashes with the following :

task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
task_wdt: - async_tcp (CPU 0/1)
task_wdt: Tasks currently running:
task_wdt: CPU 0: IDLE
task_wdt: CPU 1: loopTask

server.serveStatic("/", SD, "/"); < crashes exactly the same as request->send(SD, "/webui/index.htm", "text/html");

Is there any way to get this library to work with SD card files and folders ?
In my scenario, I have those files loading :

  • 1 HTML page (~20KB)
  • 3 JS scripts (~100KB all)
  • 1 CSS file (~100KB)
  • 1 image file (~40KB)
    TOTAL : ~260KB

When using SPIFFS storage, everything goes fine and fast, but when I try to use SD, not even any single file loads correctly.
Does someone have any idea of what could be the culprit ?

Things to know : I'm actually just testing on a very small and up to date environment :

  • ESP32 WROOM-32D
  • SD card slot connected on SPI (pins : 5, 18, 19, 23)
  • Arduino IDE 1.8.16
  • Espressif SDK 2.0.2
@simkard69 simkard69 changed the title SD card as source for files SD card as source for files : very slow and crashes ESP32 most of the time (watchdog got triggered ...) Feb 21, 2022
@simkard69
Copy link
Author

Ok so finally, this is not related to this library which works, VERY GOOD.
Anyway it was not my culprit too, neither my wiring or anything hardware related.

Check the end of this post, you'll know the truth : #770

Fact is that arduino-esp32 v2.0.2 contains a bug on file sd_diskio.cpp at line 612 exactly.
Apply the fix and voilà, problem solved !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant