Closed D-ominik closed 3 years ago
Would you be able to obtain a full stack trace of the crash? I think there is a plugin for Arduino that can decode the backtrace...
Hello Joël,
thanks for keeping an eye on it!
The full stack trace is:
0x4008c454: invoke_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c line 155
0x4008c685: abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c line 170
0x40088889: xQueueGenericReceive at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c line 1442
0x400d46cb: ledcWrite at C:\Users\ds\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32\esp32-hal-ledc.c line 193
0x400d176f: mqtt_callback_am(String&, String&) at C:\Users\ds\AppData\Local\Temp\arduino_modified_sketch_554708/sketch_oct21a.ino line 143
0x400d3435: MQTTClientHandler(lwmqtt_client_t*, void*, lwmqtt_string_t, lwmqtt_message_t) at F:\Dokumente\Arduino\libraries\MQTT\src\MQTTClient.cpp line 118
0x400d38ab: lwmqtt_cycle_until at F:\Dokumente\Arduino\libraries\MQTT\src\lwmqtt\client.c line 215
0x400d3a65: lwmqtt_subscribe at F:\Dokumente\Arduino\libraries\MQTT\src\lwmqtt\client.c line 430
0x400d3ada: lwmqtt_subscribe_one at F:\Dokumente\Arduino\libraries\MQTT\src\lwmqtt\client.c line 458
0x400d373a: MQTTClient::subscribe(char const*, int) at F:\Dokumente\Arduino\libraries\MQTT\src\MQTTClient.cpp line 329
0x400d1842: setup() at F:\Dokumente\Arduino\libraries\MQTT\src/MQTTClient.h line 113
0x400d5173: loopTask(void*) at C:\Users\ds\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32\main.cpp line 14
0x40088b9d: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143
You have to ensure that ledcSetup
is called before any of the MQTT stuff. The crash is likely due to a ledcWrite
triggered by a retained messaged before ledcSetup
has been called.
Thanks Joel, you are absolutely right!
As this didn't happen if only one retained message arrives and it never happens with PubSubClient, I couldn't see the wood for the trees
Hello Joël,
first of all, many thanks for your great work!
I got the following situation, which reproducibly always reboots an ESP32 (Arduino IDE 1.8.13 with up-to-date libraries.):
As soon as I change only one of these parameters, the error does not happen:
To troubleshoot the problem I've created a script reduced to the bare minimum. As soon as the retained messages arrive on the topics (after the MQTT connection has been established), the ESP32 will crash.
Sample script:
Serial output:
Do you have an idea what's going on?
Kind regards Dominik