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) in your PCB 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, PCB design experts are divided in their opinions on whether it is a good decision. However, as a hardware designer, 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. Read on for a talk on PCB layout, your ground plane, decoupling capacitor, and other circuit board tips, and know more about the function of a watchdog timer.
A watchdog timer (WDT) is an electronic 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 watchdog timer in MCUs that come with an internal one or rely solely on the internal watchdog timer?
Before choosing one WDT over the other, it is important to understand how they might be the same or similar to one another. Internal watchdog timers are watchdog timers built within the microcontroller itself. Configuring and refreshing the WDT is done by writing values to the respective registers of the WDT.
On the other hand, external watchdog timers are physical integrated circuits (IC) and require passive components to function. The duration of the reset countdown is often determined by the 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 watchdog timer over its external counterpart is that you save money by minimizing the cost of additional components and can have a smaller PCB layout. Since most modern MCUs are equipped with an internal watchdog timer that is 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 watchdog timer in microcontroller PCB design. However, my supervisor at the time changed my opinion on this. He pointed out that the internal watchdog timer 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 industries.
When you need to access an easy-to-use PCB layout tool that includes everything needed to build high-quality manufacturable circuit boards, look no further than CircuitMaker. In addition to easy-to-use PCB design software, all CircuitMaker users have access to a personal workspace on the Altium 365 platform. You can upload and store your design data in the cloud, and you can easily view your projects via your web browser in a secure platform.
Start using CircuitMaker today and stay tuned for the new CircuitMaker Pro from Altium.