Page 1 of 1

reset after deadlock

Posted: Thu Aug 08, 2019 10:47 pm
by bitrat
Hi,

I've been experimenting with handling deadlocks in MicroPython on ESP32 Thingy.

Can I use an interrupt handler to reset the system? I've tried handling an edge on pin 0 but either it isn't called or it's code is blocked.

I'd like to modify/remove main.py and call machine.reset() from the interrupt. Is this possible?


Cheers,
Bitrat

Re: reset after deadlock

Posted: Fri Aug 09, 2019 12:20 am
by jimmo
I think esp32 pin interrupts are "soft" which means they need to be scheduled by MicroPython, which won't work if you're deadlocked.

Would the watchdog timer (WDT) be useful for this?

Re: reset after deadlock

Posted: Fri Aug 09, 2019 12:31 am
by bitrat
Thanks jimmo,

yeah I'll need to do something more robust with the WDT eventually. i was just looking for an easier way to unbrick my device while debugging (I'm writing some monitor classes).

I'll be using C eventually so not too worried. I guess it's the FreeRTOS layer that catches the real irq.

Cheers!