Pumpkin, Inc.

Pumpkin User Forums

Watch Dog Timer and Salvo

If you can't make Salvo do what you want it to do, post it here.

Watch Dog Timer and Salvo

Postby luben » Fri Jan 12, 2001 3:32 am

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

luben
 
Posts: 324
Joined: Sun Nov 19, 2000 12:00 am
Location: Sofia, Bulgaria

Re: Watch Dog Timer and Salvo

Postby Salvo Tech Support » Fri Jan 12, 2001 12:06 pm

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.

--------
Salvo Technical Support
Please request all tech support through the Forums.
Salvo Tech Support
 
Posts: 173
Joined: Sun Nov 19, 2000 12:00 am

Re: Watch Dog Timer and Salvo

Postby aek » Sun Mar 16, 2008 12:27 am

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.

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

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: Watch Dog Timer and Salvo

Postby aek » Sun Mar 16, 2008 12:38 am

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.

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

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: Watch Dog Timer and Salvo

Postby samuel » Sun Mar 16, 2008 9:31 am

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.
samuel
 
Posts: 22
Joined: Sun Oct 08, 2006 11:00 pm


Return to Coding

Who is online

Users browsing this forum: No registered users and 2 guests

cron