I’m using an ESP32 DevKit V1 to implement the project Smart Home v1.4, 7.4 Motion Detector with Notifications. There doesn’t seem to be anything wrong with my software or hardware, except that I get an interrupt error from the ESP32 when I trigger the HC-SR501 PIR by waving my hand in front of it. The error relates to the watchdog timer.
The text of the ESP32 error is:
“Guru Meditation Error: Core 1 panic’ed (Interrupt wdt timeout on CPU1).”
Could it be that the watchdog timer is timing out before the interrupt routine is finished, thereby giving this error? If I run the ESP32 everything is normal until I put my hand in front of the PIR and then the error occurs. I’m using an HC-SR501 set to trigger from low to high, and it works as it should when tested on the oscilloscope (0V -> 3.3V on IR detection).
Has anyone seen this watchdog timeout (WDT) error before?
Do I need to change the WDT period in the code?
Here’s the abbreviated output from the serial monitor:
21:00:51.520 -> Publishing on topic esp/dht11/tempf at QoS 1, packetId: 62Message: 80.600 21:00:51.520 -> Publish acknowledged. 21:00:51.520 -> packetId: 61 21:00:51.863 -> Publish acknowledged. 21:00:51.863 -> packetId: 62 21:00:55.839 -> Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1). 21:00:55.839 -> 21:00:55.839 -> Core 1 register dump: 21:00:55.839 -> PC : 0x4008fc21 PS : 0x00060635 A0 : 0x8008db10 A1 : 0x3ffc0aac 21:00:55.839 -> A2 : 0x3ffb8310 A3 : 0x3ffb81a0 A4 : 0x00000004 A5 : 0x00060623 2 ... ... ... ... 21:00:55.976 -> 21:00:55.976 -> ELF file SHA256: e5bc4ba9f39f10e2 21:00:55.976 -> 21:00:56.149 -> Rebooting...
I have DOIT ESP32 DEVKIT V1 selected in Arduino IDE, which is the same physical board that I’m using.
Sometimes the interrupt works and the “Motion Detected” message is printed and published in MQTT, but I can’t figure out why it sometimes crashes. I tried another ESP32 DEVKIT V1 board with the same results. I checked the wiring for secure connections, and the oscilloscope shows a very sharp, clean signal transition from 0V to 3.3V upon triggering the PIR.
Hi. again.
Do you have any other peripherals connected to the board besides the ones in the circuit in the eBook?
Can you try another gpio for the PIR sensor?
Which version of the ESP32 boards installation are you using?
Tools > Boards > Boards Manager, > Search for ESP32 and check the version.
Regards,
Sara
Hey Sara,
I disconnected everything from the ESP32, even the PIR. I tried using a wire from a 3.3V voltage source and contacting the D26 pin with it to simulate a signal. Same results, sometimes the ESP32 works properly, and sometimes it resets. Sometimes I will get a “MOTION DETECTED” message 3 or 4 times in a row without a reset, even when I make contact just once and hold it.
I tried using GPIO25 as well, same results.
This anomaly has happened on two separate ESP32 DevKit v1 boards.
I’ve selected the ‘DOIT ESP32 DEVKIT V1’ board in Arduino, which matches my physical board.
I plan to research the interrupts on the ESP32 by reading through the Espressif datasheet today. I will experiment with changing/disabling the WDT if possible. I’ll get back to you with the results of my troubleshooting.
OK.
Thanks. Then, let us know.
Getting that error is not normal.
Sometimes insufficient power supply can cause guru meditation error or brownout error. So, also double-check that.
Regards,
Sara
I think you’re probably correct Sara. I was just reading Kolban’s Book on the ESP32. He highly recommends ensuring that the power supply is stable, and notes that WiFi consumes a lot of power. I was powering the board from the micro-USB port. I’ll connect through an AC adapter and see if that solves the problem.
Well, no solution yet. I tried powering the board from a dedicated DC power supply but I still have the problem. I must be doing something different in my setup. I tried several different DoIT ESP32 DevKitC v1 boards – all give the problem. I even tried different breakout boards, and tried using the bare board without a breakout board (with power and signal connections directly to the exposed pins). Nothing seems to work.
Would it help to send you a picture of the setup, the board I’m using, the power connections, etc so you might spot something I’m doing incorrectly?
Hi.
Try the following.
On the detectsMovement() function
void IRAM_ATTR detectsMovement() {
Serial.println("MOTION DETECTED!!!");
motionDetected = true;
}
remove this line
Serial.println("MOTION DETECTED!!!");
Let me know if this makes a difference.
Regards,
Sara
I removed the “Serial.println… …” statement and it seems to work reliably now.
But the question still remains as to why my boards crash and no one else seems to have a problem with the Serial print statement inside the interrupt routine. What could be going on?
I modified the interrupt routine as follows with unreliable results (sometimes works, sometimes not):
// Indicates when motion is detected
void IRAM_ATTR detectsMovement() {
if(Serial.availableForWrite()){
Serial.println(“MOTION DETECTED!!!”);
motionDetected = true;
}
}
So apparently it is a Serial port printing issue in so far as I can tell. But why just me???
Hi.
I also don’t understand why some people get that issue, but I never got it on my boards.
Maybe it is related to some version of the ESP32 boards installation?? I’m not sure.
I’m glad the issue is resolved.
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara