Watchdog reset



  • How does one feed or disable the watchdog.

    The documentation https://docs.pycom.io/wipy2/library/machine.WDT.html
    says:
    from machine import WDT
    wdt = WDT(timeout=2000) # enable it with a timeout of 2s
    wdt.feed()

    WDT is not available from machine
    I've never called WDT(timeout = anything) but it seems to be already operational at 4secs (as documented and experienced)
    Without WDT I can't call wdt.feed()

    Loops that run past the timeout (presumably 4secs?) HALT the CPU, not RESET.
    Can we rather do something better than: "I've got a bit tired so I'm just going to stop trying altogether."

    Its a bit like calling System.exit() in Java in response to an unexpected exception.

    Screen capture below:

    Task watchdog got triggered. The following tasks did not feed the watchdog in time:
    Tasks currently running:
    CPU 0: MicroPy
    Aborting.
    Guru Meditation Error: Core 0 panic'ed (Unhandled debug exception)
    Register dump:
    PC : 400e19df PS : 00060036 A0 : 800ec57f A1 : 3ffd4790
    A2 : 0000000a A3 : 0000000a A4 : 00000004 A5 : 00000000
    A6 : 00000000 A7 : fffffff8 A8 : 00000000 A9 : 3ffd4700
    A10 : 00000000 A11 : 3ffdcba3 A12 : 3ffd46cf A13 : 00000030
    A14 : 00000000 A15 : 00000000 SAR : 00000014 EXCCAUSE: 00000001
    EXCVADDR: 00000000 LBEG : 4000c46c LEND : 4000c477 LCOUNT : ffffffff
    CPU halted.



  • While it's a crude workaround, it seems time.sleep_ms(1) feeds the watchdog. I'm guessing the watchdog is fed by a low priority thread, but didn't find a yield function in _thread.


Log in to reply
 

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.