Exception, reset and watchdog in ESP8266

If you have experienced that the system does NOT reboot when the watchdog comes after an exception, don’t get fooled. It might be caused by the GPIO configuration of your chip. If you are using GPIO0 and GPIO2 (for example, in an ESP12 module)┬áin your application, remember that this pins are also used for choosing the boot mode of your ESP8266

MTDO GPIO0 GPIO2 Mode Description
L L H UART Download code from UART
L H H Flash Boot from SPI Flash
H x x SDIO Boot from SD-card

The guys from Espressif shoud have some precautions when the exception handler is called. Before sending the chip to reset, all the GPIOs should be placed into HiZ with internal pull-ups, then wait a little bit, and finally go to reset.

However they don’t do it, and when the WDT reset comes, if your GPIO0 is down because you own application is forcing it, the system won’t recover, and will stay in flash update forever!!!

(by the way, flash update should also have a timeout to jump into normal boot mode, but I guess this is silicon issue)

Leave a Reply

Your email address will not be published. Required fields are marked *