Interrupt wdt timeout on CPU1 using DHT and Firebase for ESP

FedX33
Posts: 1
Joined: Tue Jan 09, 2024 7:13 pm

Interrupt wdt timeout on CPU1 using DHT and Firebase for ESP

Postby FedX33 » Tue Jan 09, 2024 7:22 pm

Hi,

i already posted this on GitHub but i think it makes more sense to ask in this forum for a little help..

i'm struggling with my projetct. I use Firebase ESP client to open some streams with callbacks and to send DHT22 Sensor Data to a specific topic every minute.

Sensor Data is refreshing every 5s:
  1.   if(millis() > sensorSyncMillis + 5000){
  2.     sensorSyncMillis = millis();
  3.  
  4.     float rawTemp = dht.readTemperature();
  5.     float rawHum = dht.readHumidity();
  6.    
  7.     if (!isnan(rawTemp) || !isnan(rawHum)){
  8.       hum = rawHum; //Global values to store valid readings
  9.       temp = rawTemp;
  10.     }
  11.   }
i use the adafruit library <DHT.h> and found some blocking code in there, it also seems that DHT22 is quite slow. Additionaly i log outputs on a SD card for information and debugging. The combination of using firebase and the blocking code of DHT22 seem to sporadically trigger a Interrupt wdt timeout..

i debugged the Backtrace and PC with following information:

PC:
0x400fb465: DHT::expectPulse(bool) at E:\.../.pio/libdeps/esp32doit-devkit-v1/DHT sensor library/DHT.cpp:382

Backtrace:
0x400ff8c9: loopTask(void*) at C:/Users/.../.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:50
0x400d3bf5: loop() at E:\.../src/main copy.cpp:456
0x400fb5dd: DHT::readTemperature(bool, bool) at E:\.../.pio/libdeps/esp32doit-devkit-v1/DHT sensor library/DHT.cpp:88
0x400fb54d: DHT::read(bool) at E:\.../.pio/libdeps/esp32doit-devkit-v1/DHT sensor library/DHT.cpp:306
0x400fb462: DHT::expectPulse(bool) at E:\.../.pio/libdeps/esp32doit-devkit-v1/DHT sensor library/DHT.cpp:382
versions:

PACKAGES:
  1.  - framework-arduinoespressif32 @ 3.20014.231204 (2.0.14)
  2.  - tool-esptoolpy @ 1.40501.0 (4.5.1)
  3.  - tool-mkfatfs @ 2.0.1
  4.  - tool-mklittlefs @ 1.203.210628 (2.3)
  5.  - tool-mkspiffs @ 2.230.0 (2.30)
  6.  - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
  7. LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
  8. LDF Modes: Finder ~ chain, Compatibility ~ soft
  9. Found 37 compatible libraries
  10. Scanning dependencies...
  11. Dependency Graph
  12. |-- Firebase Arduino Client Library for ESP8266 and ESP32 @ 4.4.9
  13. |-- DHT sensor library @ 1.4.6
  14. |-- Adafruit Unified Sensor @ 1.1.14
  15. |-- ESP32Ping @ 1.7.0
  16. |-- SD @ 2.0.0
  17. |-- SPI @ 2.0.0
  18. |-- WiFi @ 2.0.0
Error:
Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1).

so what would be the best solution for this issue? Of course i could just use a faster and more reliable sensor, but i would like to use the hardware i have for now..

Maybe just raise the time for timeout, how could i do this?
Feed the watchdog before and after trying to get DHT22 data?

And another big problem is this Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1). I would expect the ESP to do a soft reset, but it gets stuck which is a great reliability issue for my usecase.

br

lbernstone
Posts: 826
Joined: Mon Jul 22, 2019 3:20 pm

Re: Interrupt wdt timeout on CPU1 using DHT and Firebase for ESP

Postby lbernstone » Fri Jan 12, 2024 3:11 pm

The API has changed in IDF 5, and I haven't had the time or need to look at the changes.
This will work in arduino-esp32 2.0.14.

Code: Select all

#include <esp_task_wdt.h>
...
esp_task_wdt_init(40,0); // 40 seconds, don't panic if triggered
// Long process here
esp_task_wdt_init(5,1); // Back to the default with 5 seconds and panic

Who is online

Users browsing this forum: No registered users and 60 guests