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:

Code: Untitled.cpp Select all

  if(millis() > sensorSyncMillis + 5000){
sensorSyncMillis = millis();

float rawTemp = dht.readTemperature();
float rawHum = dht.readHumidity();

if (!isnan(rawTemp) || !isnan(rawHum)){
hum = rawHum; //Global values to store valid readings
temp = rawTemp;
}
}
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:

Code: Untitled.txt Select all

 - framework-arduinoespressif32 @ 3.20014.231204 (2.0.14)
- tool-esptoolpy @ 1.40501.0 (4.5.1)
- tool-mkfatfs @ 2.0.1
- tool-mklittlefs @ 1.203.210628 (2.3)
- tool-mkspiffs @ 2.230.0 (2.30)
- toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 37 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Firebase Arduino Client Library for ESP8266 and ESP32 @ 4.4.9
|-- DHT sensor library @ 1.4.6
|-- Adafruit Unified Sensor @ 1.1.14
|-- ESP32Ping @ 1.7.0
|-- SD @ 2.0.0
|-- SPI @ 2.0.0
|-- 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: 1131
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: Barkrowler, Bytespider and 5 guests