Using Watchdog in K20D50M

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using Watchdog in K20D50M

1,197 Views
Amit_Kumar1
Senior Contributor II

Hi

What is the best configuration to use the Watchdog Timer in K20D50M (I mean Basic Register settings) for basic operation? How is Windowed watchdog helpful ?

While going through the user manual, I think I found a typo, kindly confirm the same.

1.JPG.jpg

Regards

Amit

1 Reply

786 Views
mjbcswitzerland
Specialist V

Hi Amit

1. The best configuration depends on the specific requirements of the watchdog functionality.

A basic but typically useful setup may be:

WDOG_TOVALL = (1000/5);

WDOG_TOVALH = 0;

WDOG_STCTRLH = (WDOG_STCTRLH_ALLOWUPDATE | WDOG_STCTRLH_STNDBYEN | WDOG_STCTRLH_WAITEN | WDOG_STCTRLH_STOPEN | WDOG_STCTRLH_WDOGEN);

which would set a 1s timeout, keep the watchdog enabled in certain low power modes but allow futher updates to it (change timeout or disable it, etc.).

As long as the watchdog is triggered regularly at a rate faster than 1s it will not fire (and reset the system).

2. The windowed mode is useful in applications where the watchdog should be triggered 'only' within a certan periodic window. For example, triggers between 500ms and 1000ms could be set as valid. If the watchdog is triggered slower than 1000ms or faster than 500ms it would be illegal and cause a reset.

This mode of operation is less common but it will allow the HW watchog to detect code that is triggering the watchdog 'too' quickly - for example an error which causes a task to be called at the wrong rate or an unexpected loop causing multiple triggers. The mode may be used in high reliability applications designed to have a very specific operation pattern but is less interesting for more regular work, where one uses it to catch code that essentially 'hangs'.

3. There are many registers that use "write-'1'- to clear" flags so the WDOG_STCTRLL description is correct.

Regards

Mark

µTasker Kinetis support