jasoncoon / esp8266-fastled-webserver

GNU General Public License v3.0
714 stars 359 forks source link

FastLED and Webserver crashlooping #257

Closed gelicia closed 1 year ago

gelicia commented 1 year ago

Hello, I checked out this project because I was unable to keep a server stable doing something similar with Webserver and FastLED, just wanted to see if someone could see something I'm missing.

I've stripped out all actual LED functionality to try to figure out what the issue could be. I've included the code for the two files I use after removing all the other code.

Running the ESP32C3 Dev Module.

Serial crash logs
This happens continuously. It stops if I remove the `FastLED.addLeds` call from setup. ``` 11:06:53.607 -> HTTP server started 11:06:54.360 -> Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0). 11:06:54.360 -> 11:06:54.360 -> Core 0 register dump: 11:06:54.360 -> MEPC : 0x40387734 RA : 0x40388fca SP : 0x3fc9c1d0 GP : 0x3fc8e200 11:06:54.360 -> TP : 0x3fc87a38 T0 : 0x4005890e T1 : 0x000f8023 T2 : 0x00000000 11:06:54.360 -> S0/FP : 0xffffffff S1 : 0x00000000 A0 : 0x3fca5268 A1 : 0x3fc9c3cc 11:06:54.392 -> A2 : 0x00000018 A3 : 0x3fc9c3cc A4 : 0x00000018 A5 : 0x3fc9c3cc 11:06:54.392 -> A6 : 0x0000001e A7 : 0x0028800a S2 : 0xffffffff S3 : 0x3fca5268 11:06:54.392 -> S4 : 0x3fc953a0 S5 : 0x3fc953bc S6 : 0x3fc95000 S7 : 0x3fc95000 11:06:54.392 -> S8 : 0x00000000 S9 : 0x00000000 S10 : 0x00000000 S11 : 0x00000000 11:06:54.425 -> T3 : 0x0028800a T4 : 0x00007fff T5 : 0x00000004 T6 : 0x00008000 11:06:54.425 -> MSTATUS : 0x00001881 MTVEC : 0x40380001 MCAUSE : 0x00000018 MTVAL : 0x000087b6 11:06:54.425 -> MHARTID : 0x00000000 11:06:54.425 -> 11:06:54.425 -> Stack memory: 11:06:54.425 -> 3fc9c1d0: 0x0028800a 0x00007fff 0x3fc9c208 0x3fca5268 0xffffffff 0x00000000 0x3fca5244 0x403882c6 11:06:54.457 -> 3fc9c1f0: 0x00000000 0x00000000 0x00000001 0xffffffff 0x3fc953ac 0x3fc953a8 0x00000000 0x0000022c 11:06:54.457 -> 3fc9c210: 0x3fc95000 0x3fc953bc 0x3fc953a8 0x00000002 0x3fc953ac 0x3fc953a8 0x3fc95398 0x403805aa 11:06:54.457 -> 3fc9c230: 0x40000000 0x60023000 0x60023000 0x00000063 0x0000000a 0x3fc90d2c 0x4200040a 0x00000001 11:06:54.457 -> 3fc9c250: 0x000000ff 0x3fc90e64 0x3fc90cd0 0x4200045e 0x00000000 0x00000000 0x0000000a 0x00f0b0ff 11:06:54.490 -> 3fc9c270: 0x0028800a 0x3fc90d4a 0x0000000a 0x00000000 0x01010101 0xb0ff0101 0x000003f0 0x00000000 11:06:54.490 -> 3fc9c290: 0x000000ff 0x3fc90e64 0x3fc90cd0 0x420009da 0x00000000 0x00000000 0x00f0b0ff 0x40f0b0ff 11:06:54.490 -> 3fc9c2b0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 11:06:54.490 -> 3fc9c2d0: 0x000002b5 0x00000064 0x3fc90e64 0x42000a1e 0x00000000 0x3fc95000 0x42007a58 0x42009f6a 11:06:54.522 -> 3fc9c2f0: 0x00000000 0x00000000 0x00000000 0x40389bce 0x00000000 0x00000000 0x00000000 0x00000000 11:06:54.522 -> 3fc9c310: 0x00000000 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0x27146414 0x01010107 0x00000001 0x00000000 11:06:54.522 -> 3fc9c330: 0x00000000 0x00000000 0xffffffff 0x7fefffff 0x00000000 0x3fc00000 0x00000000 0x40300000 11:06:54.522 -> 3fc9c350: 0x00000000 0x3fe00000 0x00000000 0x3ff80000 0x636f4361 0x3fd287a7 0x8b60c8b3 0x3fc68a28 11:06:54.554 -> 3fc9c370: 0x509f79fb 0x3fd34413 0x00000000 0x3ff00000 0x00000000 0x40240000 0x00000000 0x401c0000 11:06:54.554 -> 3fc9c390: 0x00000000 0x40140000 0x00000000 0x43500000 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 11:06:54.554 -> 3fc9c3b0: 0x00000154 0x3fc9c150 0x0000022d 0x3fc92788 0x3fc97e48 0x3fc9c3b4 0x3fc92780 0x00000018 11:06:54.554 -> 3fc9c3d0: 0x3fc9c3cc 0x3fc9c3cc 0x3fc9c3b4 0x3fca5268 0x00000001 0x3fc9a3b0 0x706f6f6c 0x6b736154 11:06:54.587 -> 3fc9c3f0: 0x7de8db00 0x00efb4e2 0x00000000 0x3fc9c3a0 0x00000001 0x00000000 0x3fca12d4 0x4201302e 11:06:54.587 -> 3fc9c410: 0x00000009 0x3fc9682c 0x3fc96894 0x3fc968fc 0x00000000 0x00000000 0x00000001 0x00000000 11:06:54.587 -> 3fc9c430: 0x00000000 0x00000000 0x42077258 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 11:06:54.619 -> 3fc9c450: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 11:06:54.619 -> 3fc9c470: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 11:06:54.619 -> 3fc9c490: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 11:06:54.619 -> 3fc9c4b0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 11:06:54.652 -> 3fc9c4d0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 11:06:54.652 -> 3fc9c4f0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x3f000000 0x00000054 0x00000000 11:06:54.652 -> 3fc9c510: 0x3fc9c50c 0x00000000 0x00000000 0x00000000 0x3fc9c524 0xffffffff 0x3fc9c524 0x3fc9c524 11:06:54.652 -> 3fc9c530: 0x00000000 0x3fc9c538 0xffffffff 0x3fc9c538 0x3fc9c538 0x00000001 0x00000001 0x00000000 11:06:54.683 -> 3fc9c550: 0xfb00ffff 0x00000000 0xb33fffff 0x00000000 0x00000104 0x00000000 0x00000014 0x3fc96d74 11:06:54.683 -> 3fc9c570: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 11:06:54.683 -> 3fc9c590: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 11:06:54.683 -> 3fc9c5b0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 11:06:54.715 -> ELF file SHA256: 0000000000000000 11:06:54.715 -> Rebooting... 11:06:54.715 -> ESP-ROM:esp32c3-api1-20210207 11:06:54.715 -> Build:Feb 7 2021 11:06:54.715 -> rst:0x3 (RTC_SW_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT) 11:06:54.748 -> Saved PC:0x40381c28 11:06:54.748 -> SPIWP:0xee 11:06:54.748 -> mode:DIO, clock div:1 11:06:54.748 -> load:0x3fcd6100,len:0x438 11:06:54.748 -> load:0x403ce000,len:0x90c 11:06:54.748 -> load:0x403d0000,len:0x2358 11:06:54.748 -> SHA-256 comparison failed: 11:06:54.748 -> Calculated: a9753a4fc647c6545c1b919ef08db429130a48592727edca270f1e5a3da0d0a9 11:06:54.748 -> Expected: 3bf6ef2cf3b9eefcd4b3c70cc5d1ce5138292d101a5cb1d5db6fbebf081b0a19 11:06:54.748 -> Attempting to boot anyway... 11:06:54.780 -> entry 0x403ce000 11:06:55.009 -> Connecting to 11:06:55.009 -> HTTP server started 11:06:55.930 -> WiFi connected 11:06:55.930 -> IP address: 11:06:55.930 -> HTTP server started ```

Here is the stripped down source code

main.ino
``` #include #include #include WebServer webServer(80); #include "web.h" #define DATA_PIN 4 #define LED_TYPE WS2812B #define COLOR_ORDER GRB CRGB leds[10]; const char* ssid = "ssid"; const char* password = "password"; void setup() { Serial.begin(115200); WiFi.mode(WIFI_STA); Serial.printf("Connecting to %s\n", ssid); if (String(WiFi.SSID()) != String(ssid)) { WiFi.begin(ssid, password); } setupWeb(); FastLED.addLeds(leds, 10).setCorrection(TypicalLEDStrip); FastLED.setMaxPowerInVoltsAndMilliamps(5, 1900); } void loop() { handleWeb(); FastLED.show(); FastLED.delay(1000 / 10); } ```
web.h
``` void handleRoot() { webServer.send(200, "text/plain", "connected"); } void handleNotFound() { webServer.send(404, "text/plain", "Not found"); } void setupWeb() { webServer.on("/", HTTP_GET, handleRoot); webServer.onNotFound(handleNotFound); webServer.begin(); Serial.println ( "HTTP server started" ); } void handleWeb() { static bool webServerStarted = false; // check for connection if ( WiFi.status() == WL_CONNECTED ) { if (!webServerStarted) { Serial.println(); Serial.println("WiFi connected"); Serial.print("IP address: "); Serial.println(WiFi.localIP()); webServerStarted = true; setupWeb(); } webServer.handleClient(); } } ```
gelicia commented 1 year ago

Wrong repo 🤦