Pumpkin, Inc.

Pumpkin User Forums

Watch Dog Timer

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

Watch Dog Timer

Postby sandhya » Fri Apr 23, 2004 6:34 am

I am using PIC18F8620 microcontroller with Salvo RTOS. I am enabling the watchdog timer in the config bits of the processor. I read from the salvo user manual that it is sufficient to define
'OSCLEAR_WATCHDOG_TIMER() clrwdt' in the salvocfg.h file and this will reset the watchdog timer every time the scheduler is called. I am correct? Please let me know if am wrong.
Posts: 4
Joined: Mon Mar 08, 2004 12:00 am
Location: Erie, PA, USA

Re: Watch Dog Timer

Postby aek » Fri Apr 23, 2004 6:51 am


You are correct. But let me expand on it a bit ...

If you are using a Salvo library, then the library is already configured to issue the CLRWDT instruction at the start of OSSched() -- you can see this by breaking on the call to OSSched(), and then stepping in the Program Memory window (i.e. so that you can see the disassembly).

This is also the default behavior for source-code builds, since OSCLEAR_WATCHDOG_TIMER() is defined in the port-specific header file.

Note that this method of clearing the watchdog timer is not a cure-all. For example, if all of your tasks are delayed, and you (inadvertantly or otherwise) disable the interrupt source that calls OSTimer(), your application will stop functioning (tasks can't time out), yet the watchdog timer will continue to be cleared, and therefore your application will not recover via the WDT timing out.

The default configuration for the WDT in Salvo was chosen simply because many processor have the WDT enabled by default, and we needed to chose a reasonable place to clear the WDT in the Salvo code. Failing to clear the WDT led to a host of problems with users who were unaware that the WDT was enabled.

You will probably want to develop your own, comprehensive, safety-oriented approach towards using the WDT. As part of your approach, you probably won't want to clear the WDT from within OSSched(). Therefore, with your own approach where you explicitly clear the WDT elsewhere in your code, you should do a source-code build and


(i.e. disable it in the Salvo code) to ensure that it is no longer called from within OSSched().

If you are using Salvo libraries, you'll need to build your own custom library so as to avoid having the WDT cleared from within OSSched().



[This message has been edited by aek (edited April 23, 2004).]

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

Return to Coding

Who is online

Users browsing this forum: No registered users and 1 guest