Using second core as watchdog? #9592
Replies: 4 comments 5 replies
-
No experience with a Pico, but I think that any error stopping one core might as well lock the whole processor. |
Beta Was this translation helpful? Give feedback.
-
It depends what you mean by this... a regular Python exception on the "main" thread will not interrupt the second core, and so in this case a watchdog running on the second core will work. Have you looked at machine.WDT ? |
Beta Was this translation helpful? Give feedback.
-
[I thought I had already sent a reply along these lines - but I can't see it!] Thanks for the contrributions everyone. @jimmo - yes to machine.WDT. In my experience it's not great to be honest. I have decided that the most likely 'bulletproof' approach is something that power cycles the Pico. I am refining that design and will get a custom PCB made to act as a baseboard into which the Pico plugs, but which also has some other useful things I need - the power-cycling watchdog, a few I2C breakouts and a modest non-volatile i2c ram t make power-cycling no problem with keeping state(s). If anyone is interested in being kept in the loop in this, just PM me in Github. Thanks again. |
Beta Was this translation helpful? Give feedback.
-
There is another way of looking at this problem: ask why is it locking up? When developing resilient MQTT we had tests running for months and nearly a million messages. Lockups never occurred. While a WDT is great for truly unexpected events (lightning strikes nearby) I wouldn't advocate them as an alternative to robust code. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using Pi Pico W which has two cores.
I am typically implementing simple units which have several sensors and send the data periodically to a MQTT broker.
It's annoying when the Pico stops / locks up / whatever. The watchdog function is not 100% reliable.
Given the two cores in the Pico, I want to know:
If all my sensor/MQTT code is running in one core, and locks up, does it affect any code running in the second core?
In not, then I could imagine a simple watchdog where core 2 has code monitoring core 1's loop. If the loop ceases, core 2 can trigger a relay and do a hardware restart...
Possible?
Beta Was this translation helpful? Give feedback.
All reactions