Watch Dog Timer (WDT) for ESP8266

While messing with an ESP8266 for the past couple of days, I decided I should look into how the watch dog timer operates.

Turns out the WDT is enabled automatically for the ESP8266. Most of the library routines reset it so you may never even know it is running unless your program hangs in a loop.


My primary resource for researching ESP8266 WDT was:

ESP8266: Watchdog functions

Hardware and Software Timers

There is a hardware WDT and a software WDT. The HW WDT is always running and will reset the MCU after about 6 seconds if the HW WDT timer is not reset.

The SW WDT seems to reset the MCU at 1.5 about seconds. You can enable/disable the SW WDT, but not the HW WDT. There seems to be little point in disabling the SW WDT as you must reset it to also reset the HW WDT.

Enabling the Software WDT

As previously mentioned, the SW WDT is running by default. If  you wish to disable it, the SW WDT is disabled with


The SW WDT is enabled with:


While you must pass a timeout value to wdtEnable, it is currently ignored.

Resetting, Kicking, Feeding the Dog

As mentioned before, most of the libraries will automatically reset the WDT for you so you should not have to do so. But if you are doing something compute bound that will take more than a second or so, you should manually reset the timer with



Unlike Teensy and Arduino, WDT is very easy to use. The downside is when the timer pops, the system just resets. You can’t jump to some code to handle the reset.


This entry was posted in c-esp8266 and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.