Watchdog timer implementation

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
uCTRL
Posts: 30
Joined: Fri Oct 12, 2018 11:50 pm

Watchdog timer implementation

Post by uCTRL » Fri Jun 07, 2019 1:26 am

I am trying to understand the implementation of Watchdog timers in ESP32 Micropython.

Based on ESP-IDF documentation , there are two WDT.
The ESP-IDF has support for two types of watchdogs: The Interrupt Watchdog Timer and the Task Watchdog Timer (TWDT). The Interrupt Watchdog Timer and the TWDT can both be enabled using make menuconfig, however the TWDT can also be enabled during runtime. The Interrupt Watchdog is responsible for detecting instances where FreeRTOS task switching is blocked for a prolonged period of time. The TWDT is responsible for detecting instances of tasks running without yielding for a prolonged period.
https://docs.espressif.com/projects/esp ... /wdts.html

I have done some experimenting with Micropython pre-built firmware.
It appears that Micropython has some ties to FreeRTOS WDT, will reset the system if IRQ's are disabled.
However, I can not find more specific information on how ESP32 Micropython (pre-built firmware) works with underlying FreeRTOS Watchdog timers and implication on Micropython applications.

I need to build a robust system that will reset reliably in case of Micropython application or any other underlying OS lockups.

Would appreciate more information and clarification as I'm sure would others.

Best Regards

uCTRL
Posts: 30
Joined: Fri Oct 12, 2018 11:50 pm

Re: Watchdog timer implementation

Post by uCTRL » Fri Jun 07, 2019 8:29 pm

Doesn't look like ESP32 port is taken seriously by micropython developers.

I guess you get what you pay for.

User avatar
Mike Teachman
Posts: 69
Joined: Mon Jun 13, 2016 3:19 pm
Location: Victoria, BC, Canada

Re: Watchdog timer implementation

Post by Mike Teachman » Sat Jun 08, 2019 2:56 am

Is it possible to consider an external watchdog device in your design? That would deliver a more robust implementation than an internal watchdog. The TPS3823-33 device from TI works well for ESP32 designs - it has both a voltage monitor and watchdog timer.

User avatar
pythoncoder
Posts: 3597
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Watchdog timer implementation

Post by pythoncoder » Sat Jun 08, 2019 7:29 am

A "poor man's" solution is a software WDT such as this one but there is no question that external hardware offers the most robust solution.
Peter Hinch

Post Reply