WDT and deepsleep



  • Hi

    Does the WDT also trigger in deepsleep? And is the WDT cleared after deepsleep wakeup?



  • You can make the wdt persistent through deepsleep

    pycom.wdt_on_boot(True)          # enable WDT on boot
    pycom.wdt_on_boot_timeout(60000) # reboots after a minute if no wdt.feed
    

    which is nice given the gears penchant for reverting to it's default 4s blue flash mode. Be careful though, too short a timeout & you don't get a chance to enter pycom.wdt_on_boot(False) before it reboots again



  • Quick answer is no and yes.

    The code below set the WDT for 8 s and deep sleep for 100 s and my device doesn't wake up after 8 s.

    from machine import WDT
    wdt = WDT(timeout=8000) #WDT for 8 s
    
    import machine
    machine.deepsleep(100*1000) #deep sleep for 100 s
    

    WDT is reset after deep sleep wake up because this wake up resets the board and clears all libraries (WDT can't run if it's library isn't imported). Always best to try some code to test your questions!


 

Pycom on Twitter