Hi (again) !
I am trying to understand what is “watchdog”, how to use “watch dog” and what it does?
Thank you all!
Hi (again) !
I am trying to understand what is “watchdog”, how to use “watch dog” and what it does?
Thank you all!
If it’s in reference to what I think it is, you are referring to the watchdog timer in our robot controller.
Basically, our user processor has to get data from the master processor when it comes in, and the user processor has to spit the new data outputs (to the motors, Spike relays, etc.) to the master processor. If the user code takes too long between grabbing data and spitting it back, the “watchdog” timer freezes our processor and flashes the “Code Error” light–it’s red, so it’s known as the “red light of death”.
The user code doesn’t have to do anything special to use the watchdog timer; it’s just there–a feature of the IFI-proprietary master code loaded on the robot controller. We don’t turn it on or off or set the delay; it’s just there. If you’re programming in easyC, don’t worry about a thing. If you’re programming in MPLAB, try not to put for loops or other extremely time-consuming tasks in your code, and if you do, make sure to thoroughly test it before trusting it.
Don’t worry about the watchdog timer; it’ll only shut your code down if you’ve written code that takes too long to execute.
And if you need more help, as always, post back and we’ll try to help.
JBot
FYI, if you’re reading through the PIC reference manual and/or datasheet, there are references to a watchdog timer in the processor. This is not the same thing as the “watchdog” JBotAlan discussed. (I’ve never heard the term applied to the master processor before this year.)
Well, I knew that the master processor would shut us down if we took too long, and I’ve heard of watchdog timers on PLCs and such, so I assumed that’s what IFI called it. I haven’t actually seen that term referring to the master processor either, but…that’s what it is.
JBot
More generally, a “watchdog” is simply a timer that needs to be “serviced” every so often or the system activates some sort of fail-safe mechanisms. In the world of engineering, we often use watchdogs to monitor systems of several processors or devices - a pulse is periodically sent out to all devices, and if a response is not received in a given window of time, then the system assumes that the device that failed to respond has stopped working, and acts accordingly.
In FIRST, the master uP and user uP indeed have a watchdog-like relationship.
This can cause problems in some cases. namely, don’t make my mistake:) i put a puts(“a”); inside the encoder code:rolleyes: that didn’t work. it told us when they fired, but then the interrupts backed up too much and the watchdog shut us down. To make a long 30 minutes of hair pulling short, DON’T PRINT INSIDE THE INTERRUPTS!!!
Oh yeah, you’ve just discovered how slow printing is when compared to interrupts. Go as fast as you possibly can when inside an interrupt; you will see some strange behavior if you don’t. A ++ of a variable is about all I will do inside an interrupt handler.