Hello! Last week I described the PSoC 6 multi-counter watchdog (MCWDT) resource. Here I will describe the basic watchdog timer (WDT).

 

PSoC 6 actually has multiple watchdogs - a single basic watchdog timer (WDT) and one or more multi-counter watchdogs (MCWDT). In most cases you will use the WDT for the basic watchdog function, and the MCWDT counters for general counter/timer functions such as measuring time between events and generating periodic interrupts.

The WDT and MCWDT are similar in function, in that the counters generate periodic interrupts, with device reset on the third unhandled interrupt. There are some differences:

  • The WDT has a single 16-bit counter with a 16-bit match register.
  • The WDT is clocked by the internal low-speed oscillator; the MCWDT by ClkLf.
  • The WDT works in Active, Sleep, DeepSleep, and Hibernate modes. The MCWDT does not work in Hibernate mode.

PDL API support is provided for both resources. Remember, for an effective watchdog function, good practice is to never reset the watchdog from an interrupt handler. If you do, then if the CPU or background firmware crashes the watchdog may never trigger because it is still being reset in an interrupt handler. It is better to reset the watchdog somewhere in the main loop.