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 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 far (24 hours) no 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.

  • Just create a timer alarm that feeds the watchdog..if you program hangs it will reboot.

    class WD:
    def init(self):
    self.seconds = 0
    self.__alarm = Timer.Alarm(self._seconds_handler, 3, periodic=True)
    def _seconds_handler(self, alarm):

Log in to reply

Pycom on Twitter