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

    Software watchdog

    Scheduled Pinned Locked Moved Discussion
    7 Posts 4 Posters 121 Views 4 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.
    • A Offline
      Andrea Zauli
      last edited by

      Hi all, I am asking for a suggestion.
      I use a LoPy and need to check if the main task get stuck (don't terminate within a specified time) forcing it to terminate after the timeout happens.
      I tried using software timer, but I am not able to propagate the exception from the Timer's callback to the "stuck" thread, also using sys.exit() doesn't help: the SystemExit exception doesn't propagate to the main thread.
      Any help or idea would be appreciated...
      Many thanks!

      robert-hhR 1 Reply Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @Andrea Zauli
        last edited by robert-hh

        @Andrea-Zauli There is is always the big hammer called "machine.reset()", which starts the whole device again.

        1 Reply Last reply Reply Quote 1
        • T Offline
          tuftec
          last edited by

          I use the watchdog reset function. You enable the watchdog function and then keeping feeding the time out timer at various stages during your code. If something goes horribly wrong the watchdog timer expires (dog does not get feed) and forces a reset.

          When your code boots you need to read the reset reason code. If the reason is watchdog timeout you can then do something sensible, like flag an error message.

          I hope this helps.
          Peter.

          1 Reply Last reply Reply Quote 1
          • A Offline
            Andrea Zauli
            last edited by

            Thanks for the reply. How con I set the watchdog function? Is it a specific timer?

            T 1 Reply Last reply Reply Quote 0
            • T Offline
              tuftec @Andrea Zauli
              last edited by

              @Andrea-Zauli Yes!!!

              Read here
              https://docs.pycom.io/firmwareapi/pycom/machine/wdt/

              and here
              https://docs.pycom.io/firmwareapi/pycom/machine/

              Peter.

              A 1 Reply Last reply Reply Quote 1
              • rcolisteteR Offline
                rcolistete
                last edited by

                I suggest a hardware WDT (Watch Dog Timer), like the TPL5010.

                My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

                1 Reply Last reply Reply Quote 1
                • A Offline
                  Andrea Zauli @tuftec
                  last edited by

                  @tuftec said in Software watchdog:

                  @Andrea-Zauli Yes!!!

                  Read here
                  https://docs.pycom.io/firmwareapi/pycom/machine/wdt/

                  and here
                  https://docs.pycom.io/firmwareapi/pycom/machine/

                  Peter.

                  Many thanks!!

                  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