-
-
Notifications
You must be signed in to change notification settings - Fork 438
Description
I am scratching my head about an issue that I encountered today.
I thought it would be neat to add an (external) WS2812B led as my TTGO T-Beam V1.1 does not have one.
I copied the relevant lines (HAS_RGB_ etc) from the lolin32lora hal file.
For the first 1-3 seconds the WS2812B led does work and flash orange multiple times during first Lora TX, but then ESP32 crashes with some exception before coming to first Lora RX window.
Without RGBled activated it works flawlessly.
EDIT: it seems ledloop causes it because the task has written past the end of its allocated stack memory:
`I (157) src/i2c.cpp: Starting I2C bus scan...
I (302) src/i2c.cpp: Device found at 0x34, type = AXP192
I (303) src/i2c.cpp: Device found at 0x3C, type = Unknown
I (304) src/i2c.cpp: 2 I2C device(s) found
W (305) /Users/whoami/.platformio/packages/framework-arduinoespressif32@3.20011.230801/libraries/Wire/src/Wire.cpp: Bus already started in Master Mode.
I (10529) src/main.cpp: Starting LED Controller...
Guru Meditation Error: Core 1 panic'ed (Unhandled debug exception).
Debug exception reason: Stack canary watchpoint triggered (ledloop)
Core 1 register dump:
PC : 0x4009baff PS : 0x00060036 A0 : 0x80099b3c A1 : 0x3ffbbf90
A2 : 0x3ffbf7e8 A3 : 0xb33fffff A4 : 0x0000cdcd A5 : 0x00060023
A6 : 0x00060023 A7 : 0x0000abab A8 : 0xb33fffff A9 : 0xffffffff
A10 : 0x00000003 A11 : 0x00060023 A12 : 0x00060023 A13 : 0x3ffbbf40
A14 : 0x007bf7e8 A15 : 0x003fffff SAR : 0x00000020 EXCCAUSE: 0x00000001
EXCVADDR: 0x00000000 LBEG : 0x400919c0 LEND : 0x400919cc LCOUNT : 0x00000000
Backtrace: 0x4009bafc:0x3ffbbf90 0x40099b39:0x3ffbbfd0 0x40097e50:0x3ffbc000 0x40097e00:0xa5a5a5a5 |<-CORRUPTED
`
EDIT2: solved. Stack size is set to 1024 for ledloop, works fine when increasing to 4096 (to be save). Maybe 2048 would be enough.
in src/main.cpp I changed stack size for the led task from 1024 to 4096 as follows:
#if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED)
// start led loop
ESP_LOGI(TAG, "Starting LED Controller...");
xTaskCreatePinnedToCore(ledLoop, // task function
"ledloop", // name of task
4096, // stack size of task
(void *)1, // parameter of the task
1, // priority of the task
&ledLoopTask, // task handle
1); // CPU core
#endif