Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    WDT and deepsleep

    Scheduled Pinned Locked Moved Getting Started
    wdtdeepslereset
    5 Posts 3 Posters 1.2k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      Jardar
      last edited by

      Hi

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

      1 Reply Last reply Reply Quote 2
      • A Offline
        alexpul
        last edited by

        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!

        1 Reply Last reply Reply Quote 2
        • K Offline
          kjm
          last edited by

          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

          A 1 Reply Last reply Reply Quote 0
          • A Offline
            alexpul @kjm
            last edited by

            @kjm Just to clarify, your code makes the WDT turn on automatically when the device wakes up but it will not trigger a WDT reset while the device is in deep sleep, correct?

            K 1 Reply Last reply Reply Quote 0
            • K Offline
              kjm @alexpul
              last edited by

              @alexpul correct

              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • 1 / 1
              • First post
                Last post

              Pycom on Twitter

              Pycom