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.
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

Description

@simkard69

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions