Using a Cog as a watchdog
william chan
Posts: 1,326
Hi,
I am planning to use one cog of the Propeller as a watchdog.
My questions
1. In what situations would the Propeller clock or PLL stop or hang, preventing the watchdog cog from doing it's job?
2. What is the best way for the watchdog to watch all other cogs?
3. If only one cog has hung and the watchdog detects the problem, how can the watchdog reset only that problematic cog?
4. Would it be advisable for the watchdog cog to physically control the RST pin, in case a whole chip reset is required?
If the watchdog pulls the RST pin, would it immediately kill itself?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
I am planning to use one cog of the Propeller as a watchdog.
My questions
1. In what situations would the Propeller clock or PLL stop or hang, preventing the watchdog cog from doing it's job?
2. What is the best way for the watchdog to watch all other cogs?
3. If only one cog has hung and the watchdog detects the problem, how can the watchdog reset only that problematic cog?
4. Would it be advisable for the watchdog cog to physically control the RST pin, in case a whole chip reset is required?
If the watchdog pulls the RST pin, would it immediately kill itself?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
Comments
2) The simplest way would be for each cog to increment a LONG in hub memory. The watchdog cog would periodically compare a private copy of the counters to the ones in hub memory and make sure they don't match. It would then copy the new values over its copy.
3) Do a COGINIT on the cog forcing it to reset and reload its program.
4) There's a RESET bit in the clock mode value used for the CLKMODE instruction. If that's set, it forces the chip to reset just like the RST pin.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
between 2 hrs and 60 hrs of run time. Since I can't afford for it to stop working while I'm not watching it I ran up a quick
hack to perform as a watchdog. The main line loop toggles a led at 0.5 hz (1s on / 1s off).. if it latches up this waits
~30 secs and reboots the chip. Works a treat.
'scuse the formatting. Just a quick left click / middle click from an xterm.. it's all good in the Propeller Tool.
Following your recommendation,
If I put a 0.1uF capacitor between the RST pin and ground, how long will the Propeller take to start-up from application of power?
Thanks.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
A) Adequate startup delay to get the chip running and ensuring it does not false trigger
Some way of disconnecting it while you program the chip
and my favourite
C) What if the watchdog cog locks up in a state that keeps the capacitor in a benign state?
A dedicated watchdog chip, or at least a 555 would be a better solution if you really have to go hardware.
I've hit my propeller with all sorts of horrible noise, bad power, invalid inputs and numerous other nasty things and found the processor itself to be
as close to rock solid as I've seen anywhere (read as I've never seen the hardware lockup/reboot without me inducing incredible amounts of noise into the reset pin directly -
- courtesy of 15M of cable between the prop clip and the proto board).
My code on the other hand can be slightly less reliable than the chip its running on.