Software watchdog
-
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! -
@Andrea-Zauli There is is always the big hammer called "machine.reset()", which starts the whole device again.
-
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. -
Thanks for the reply. How con I set the watchdog function? Is it a specific timer?
-
@Andrea-Zauli Yes!!!
Read here
https://docs.pycom.io/firmwareapi/pycom/machine/wdt/and here
https://docs.pycom.io/firmwareapi/pycom/machine/Peter.
-
I suggest a hardware WDT (Watch Dog Timer), like the TPL5010.
-
@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!!
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