ESP32 freezes without printing any exception, watchdog does not trigger

I am using an ESP32 to continuesly scan for BLE devices. There is a working watchdog tested to successfully restart the device.

After running for a couple of hours the device freezes and prints a few new lines on the serial but not any exception or stack trace. Also the device doesn't get restarted by the watchdog after that. After each scan I print the available heap space which is consistantly in the 36k range.

Any ideas to help debug this? Not posting any code yet because I'm in the process of stripping it gradually.

...........................................................................

Help us help you.

......................................................................
If you are using a 9V battery like this.


Don't.
.................................................................

.......................................................................................................................

I2C scanner

What did the I2C scanner report?

.........................................................................................
Bread board power rail split


...............................................................................................................................................
Serial Input basics.

................................................................................................................

The search box is a useful tool.


For instance, using the words "9v battery" in the search box one could find lots of reasons why this may be a bad idea.

Other search words include "level shifter", "round", "millis()",
.........................................................................................................

code merging

http://www.thebox.myzen.co.uk/Tutorial/Merging_Code.html

..........................................................................................................

disclaimer

The events portrayed in this post are not all true. The names are not real names of real people and real organizations.
..............................................................................

Servo stuff

Power externally.

power distrubition blocks.



....................................................................................

Without your code that's the best I can do. Good luck.

1 Like

One possibility is that the code is getting stuck in a loop somewhere which has the equivalent of a yield() or delay() in it which is enough to reset the watch dog timer.
Maybe flash a led in your loop() or loops to see if this could be the case.

sounds difficult to debug and reproduce.
sounds like you've already eliminated a memory leak

one approach is to track the progress of the code. i've used leds in smaller cases, the pattern of LEDs would indicate where it was when things went wrong. using prints don't always work because that last print never gets out

perhaps a set of counters, one for each block of code, printed out in loop() that may provide some hint at what parts of the code are being exercised

if there's a watchdog and it's not firing, how is it being reset when the code freezes? (hopefully not in an interrupt - past history)

can you do anything to accelerate the code?

any recursion?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.