Watchdog

bkgoodman
Posts: 3
Joined: Fri Feb 17, 2017 12:41 pm

Watchdog

Postby bkgoodman » Fri Feb 17, 2017 12:55 pm

I am trying to enable a watchdog which will reboot the board in the event of a massive problem, lockup, etc.

This seems to not be implemented in the Arduino libraries, so am try to implement it myself. Since the manual says:

Only the RWDT can trigger the system reset


I assume I have to do this from the RTC WDT. The ESP32 Technical Reference Manual says:

The RWDT registers are part of the RTC submodule and are described in the RTC Registers section.


...but the RTC section does not make reference to any watchdog stuff at all.

THe `soc/rtc_cntl_reg.h` file seems to make reference to some registers which are similar to the timer watchdog registers, like RTC_CNTL_WDTCONFIG0_REG, RTC_CNTL_WDT_FEED, etc - but these registers are *not* discussed in the ESP32 Technical Reference Manual. In fact, the actual registers reference in these includes seem to fit into a "hole" in those described in the RTC section.

Furhtermore, the only usage I could find of them anywhere, in any project were bootloaders which merely "disabled" the watchdog by clearing a bit in CONFIG0 - as the manual says:

After booting, the register TIMERS_WDT_FLASHBOOT_MOD_EN should be cleared to stop the flash boot protection procedure for the MWDT, and RTC_CNTL_WDT_FLASHBOOT_MOD_EN should be cleared to do the same for the RWDT. After this, the MWDT and RWDT can be configured by software.


So - questions:

1. "How do I do this?""
2. Are these registers documented?

User avatar
kolban
Posts: 513
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Watchdog

Postby kolban » Fri Feb 17, 2017 4:02 pm

Hopefully you won't have to drop down to the CPU registers level. My understanding is that within your Arduino code you can make calls to the ESP-IDF framework. Within that framework there are APIs for controlling watchdog processing. See here for the docs:

http://esp-idf.readthedocs.io/en/latest ... /wdts.html

Hopefully you will be able to leverage these functions in your Arduino scripts.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

WiFive
Posts: 500
Joined: Tue Dec 01, 2015 7:35 am

Re: Watchdog

Postby WiFive » Fri Feb 17, 2017 5:44 pm

He wants to use rtc watchdog to have some separation. Unfortunately there is not much rtc documentation or source code available yet.

bkgoodman
Posts: 3
Joined: Fri Feb 17, 2017 12:41 pm

Re: Watchdog

Postby bkgoodman » Mon Feb 20, 2017 3:11 pm

I tried another hack that worked for a while - I ran a wire from a GPIO to a reset, and made a timer/alarm/interrupt to fire the pin after a given point of time. It did the job - but I ran into two problems:

1. At one point the LWIP stack hit an exception, and it hung in the "Guru Meditation".

2. At another point on reboot it got "Flash read err, 1000 Falling back tp built-in command interpreter". Even hitting the RESET button wouldn't get out of this, but power cycle did.

So - any idea how to deal with any of these?

Who is online

Users browsing this forum: No registered users and 1 guest