Watchdog timer question
Can someone explain the correct use of the watchdog timer...
I have various combinations of SiPy or FiPy on Pysense or Expansion Board 3.1's all with the latest firmware as of today.
The code is simply reading sensors and sending data to Adafruit.io via wifi, sigfox or lte. Occasionally the code would hang (typically 1 per 200 cycles or thereabouts)...not sure where as they were running on batteries so not connected to the REPL.
I added a WDT to the code (single thread) and set it at 3 x the cycle time of the code...still had hangs (still 1 per 200 cycles or thereabouts). I've now put a separate pseudoWDT on some of the Pysense combinations again set a 3 x the cycle time of the code, but this time in a separate thread to the main code and the WDT..so far (24 hours) no hangs...so this raises the question, should the WDT be on a it's own thread.
Doesn't feeding the watchdog simply delay the reset? That doesn't help my situation.
I already have a watchdog timer in the code and when it hung, the watchdog didn't activate so I'm not sure if the watchdog hung because it was in the same thread as the code or if WDT class runs in a separate thread by design which implies a bigger problem with the WDT in general.
misterlisty last edited by
Just create a timer alarm that feeds the watchdog..if you program hangs it will reboot.
self.seconds = 0
self.__alarm = Timer.Alarm(self._seconds_handler, 3, periodic=True)
def _seconds_handler(self, alarm):