PCB Design Tips: Should You Include an External Watchdog Timer (WDT) in Your Board Design
Would you invest in an external mouse, keyboard, and a high definition monitor when your laptop comes equipped with these features? It’s a personal choice, especially when you want to turn your laptop into a portable workstation. My girlfriend, who’s starting her career as a professional accountant, dismissed my choice as a waste of money.
In electronics, deciding whether to include an external watchdog timer (WDT) into your design can be an equally difficult choice. This is especially the case if your microcontroller (MCU) already has a built-in WDT. Like my girlfriend and I, design experts are divided in their opinions on whether it is a good decision. However, as a hardware , the final decision is ultimately yours. That is why it is important to have a good understanding of internal and external hardware watchdog timers, to draw your own conclusions.
What is A Watchdog Timer (WDT) And Why Do You Need It In Your Design
A watchdog timer (WDT) is an electronics feature that is used to detect anomalies in embedded systems and reset the microcontroller. It usually consists of a pre-loaded timer that counts down to zero. When the pre-loaded watchdog timer card expires, the microcontroller will be reset. Under normal operation, the microcontroller consistently refreshes the value of the timer to prevent it from entering the reset state. This is often candidly called “kicking the watchdog”.
As much as you try to perfect your hardware and firmware, mistakes can happen. Unstable power supply, memory stack overflow or having your program trapped in a perpetual loop are reasons why microcontrollers stall. These errors can result in a system crash, which can be problematic in applications that have little to no tolerance for downtime. When this happens, systems equipped with a Watchdog Timer Relay will reset automatically. This is because a WDT triggers a reset of the system so that it can resume functioning normally without human intervention.
In the past I’ve made the mistake of not using a WDT with my microcontroller since I was overconfident about my coding skills. After experiencing multiple system crashes, which were caused by a bug that wasn’t discovered in development, I learned to make WDTs a priority in all my designs. The question that remains is, should you incorporate an external WDT in MCUs that come with an internal one or rely solely on the internal WDT.
Internal WDT Vs External WDT, what is your best choice?
Before choosing one WDT over the other, it is important to understand how they might be the same or similar to one another. Internal WDTs are watchdog timers built within the microcontroller itself. Configuring and refreshing the WDT is done by writing values to respective registers of the WDT.
On the other hand, external WDTs are physical integrated circuits (IC) and require passive components to function. The duration of the reset countdown is often determined by capacitor’s value. External WDTs are usually refreshed by sending a voltage pulse and they reset the microcontroller in the same manner.
The advantage of choosing an internal WDT over its external counterpart is that you save money by minimizing the cost of additional components and can have a smaller PCB. Since most modern MCUs are equipped with an internal WDT that are said to be reliable, this seems like a sensible choice.
Cost saving and minimalism were my motivation when I decided not to use an external WDT in one of my designs. However, my supervisor at the time changed my opinion on this. He pointed out that the internal WDT is part of the same IC as its MCU. So, if a microcontroller could fail, wouldn’t it also be possible for the WDT to fail?
With today’s microcontroller manufacturing capability, the likelihood of encountering an unreliable internal WDT is pretty slim. However, they do stand a chance of failing from runaway code that mistakenly deactivates the timer. Also, an internal WDT that shares the same system clock with the microcontroller has a higher chance of malfunctioning if the system clock fails.
In mission-critical applications, it is always safer to place an external WDT on top of the internal ones. In the end, you’ll find that the cost of adding a handful of components is still lesser than the damage inflicted by the stalled system. This is particularly the case for applications in the medical, oil and gas, and automotive industry.
At the end of the day, you have the final say in choosing one over the other. Including an external WDT shouldn’t be a huge problem, especially when you’re designing with professional pcb design software and PCB components libraries, like Altium Designer® , Altium’s CircuitStudio® , and Altium Vault® .
Have a question about WDTs? Talk to our team at Altium now.