Page 1 of 1

Watch Dog Timer and Salvo

PostPosted: Fri Jan 12, 2001 3:32 am
by luben
Hello,

On the PIC uP there is a watch dog timer. Does Salvo supports build-in function to reset the timer every time the scheduler is called, or I should care by myself to do this? And if there is such function how I can switch on/off it?

Regards
Luben


Re: Watch Dog Timer and Salvo

PostPosted: Fri Jan 12, 2001 12:06 pm
by Salvo Tech Support
Hi Luben.

Yes, Salvo supports this already. See the OSCLEAR_WATCHDOG_TIMER() configuration option in the User Manual.

When used, the processor's watchdog timer is cleared at the end of the scheduler.


Re: Watch Dog Timer and Salvo

PostPosted: Sun Mar 16, 2008 12:27 am
by aek
If the WDT hook is defined, then the watchdog is hit once for every call to the scheduler (OSSched()). You can deduce the effect on the WDT from that.

------------------


Re: Watch Dog Timer and Salvo

PostPosted: Sun Mar 16, 2008 12:38 am
by aek
quote:
can I assume that when a task gets control (i.e. after an OS_Delay(), OS_Yield(), OS_WaitBinSem(), or when the task starts) that the WDT counter is cleared?
Not quite ... what you can assume is that the WDT is cleared either immediately before or immediately after the task is dispatched, since the scheduler must run to dispatch the task ...

IF you are only clearing the WDT via the WDT hook, THEN i) this is bad and ii) a task that takes "forever" to yield back to the scheduler will in fact cause a WDT reset.

But it's bad in the first place because the hook is not meant to be an end-all solution to WDT clearing. For example, your Salvo application can completely die, yet you won't get a WDT reset. How? If all your tasks are delayed, and you inadvertently disable global interrupts, none of those tasks will ever run again (because their timer-based delays never exppire). The scheduler runs merrily along, clearing the WDT in a tight loop ... Oops.

As is outlined in the Salvo User Manual, the hook is a very rudimentary way of managing the WDT. It's in there by default because many beginner users fail to disable the watchdog in their code, and so their Salvo apps crash, and they wonder why (and blame Salvo). Oops.

So, use the WDT hook, but caveat emptor.

------------------


Re: Watch Dog Timer and Salvo

PostPosted: Sun Mar 16, 2008 9:31 am
by samuel
I'm using salvo 4.0.0 source for the MSP430. If I kick the watch dog timer in OSClrWDTHook() can I assume that when a task gets control (i.e. after an OS_Delay(), OS_Yield(), OS_WaitBinSem(), or when the task starts) that the WDT counter is cleared? In this case it is up to a task to kick the WDT if it uses it for more than the WDT timeout.