[SOLVED] ESP8266 WDT reset

Hello!
I'm quite new to this and have successfully created an ESP8266 (Adafruit HUZZA) gateway with an NRF24L01+PA+LNA radio. All is powered by an 2,4A USB charger.

I've had it up and running without problems for some days. But after tweaking and having problems I reverted back to original settings (only tweaked PA level and channel).
Now I get it working somewhat. Sometimes it's all fine, I can include and receive values. And then suddenly the chip reboots.

I can replicate the reboot by restarting my Vera Edge (Reload Engine).

The client connects, and after a few sec I see soft WDC reset.
Usualy the ESP just reboots and connect to my wifi and starts receiving values. But to get Vera to connect I need to reload the engine and then the ESP reboots.
And sometimes it's just hangs afterwards.

ets Jan 8 2013,rst cause:4, boot mode:(3,6)
wdt reset

The thing is that I had it going several days with PA level at HIGH with no big problem. Except when I wanted to include a new sensor . Then I started checking and everything then fell apart.
I have dual 100uf capacitor on the 3.3V and one on the input 5V. And can't measure any voltage drops with my multimeter. Only had one 100uf on the 3.3v at first, added the others now when I try to troubleshoot.

Hello and thanks for the tips.
I have now upgraded to 2.0.0 of mysensors library.
I reflashed the ESP module with the new libraries and open the serial monitor. It connects fine with the router etc.
But as soon as I start a sensor (not touched them, still 1.5 version) it recieves a message and then reboots.

It also good when I reloaded Vera. I got values into vera aswell.
But as soon as I power in a new sensor it restarts. is that normal? And sometimes when I restart Vera the ESP restarts aswell, so it's the same now. Works sometimes, sometimes not (mostly not)

I notice that when the client connects to it fine, untill it sends "0;255;3;0;9;Client 0: 2;1;1;0;24"
Then there is a soft WDT reset

All sensors are connected to pro mini's thats powered by 2x AA batteries.
I've now installed separate 5v->3v regulator for the GW radio.
It looks like it starts up right, can reload vera etc but now it don't recieve any radiomessages at all. Something special when having separate regulator? It has the the GND, just VCC that's separated.

Had gotten my hopes up on this solution, but as it don't apply to 2.0 dev branch it was not the answer.
I'm no programmer so I can't really do any real bug searching. I only noticed that two types of messages makes it restart. What they mean or what they do it beyond my knowledge.
I'll just sit tight and hope some smart person comes up with a suggestion, meanwhile I'll continue to google the web

I THINK I'm having the same problem.. I'm building my first WiFi gateway.. I used a Sparkfun Thing Dev board because it was handy and accessible. Only oddities were that since the Sparkfun board has an LED on GPIO 5, I set the LED pin to 5 instead of 7, and the inclusion pin to 2..

I haven't tried the dev branch (will do, and report back) but with 1.5, I get a connection to my wifi, then a reboot:

Over and over again.. Vera says it's connected, but then says it cant communicate. As mentioned, this type of problem is usually a tight loop not giving time for the WDT on the 8266 but I'm not familiar enough with this code to track it down.. Any ideas?

PLEASE NOTE: I gather there are three different problems which have similar results:

A power supply with insufficient current to drive the ESP causes it to crash / reboot.

A NULL message (somewhere in the process) can cause ESP to restart.

Something called a 'WDT Reset' , which I have never encountered (?possibly only applies when using a Vera controller?).

Because all three produce similar looking results, I posted my fix here, even though I had not seen a 'WDT Reset' message (??possibly because I wasn't running a Vera controller??).

My Symptoms
My system appeared to have been running 'fine' for a solid week (as a test), using MYScontroller, I didn't notice anything abnormal. I also had a telnet (Potty) connection to the ESP. It wasn't until I started testing OpenHAB that OpenHab would report that it 'could not communicate'. At the same time my telnet connection and MYScontroller just stopped, no error message etc.

Then, OpenHab log reported that it was 'creating new connection', and resumed communicating, BUT both the telnet link and MYScontroller never resumed communications. I would have to disconnect / reconnect both, then they would continue for a few minutes until OpenHab reported the error again, when they would 'stall' again - this kept repeating.

If I stopped OpenHab, then the Telnet and MYScontroller worked flawlessly. At first I assumed that the OpenHab binding was the problem. Lots of testing, inserting debug 'print' statements into the drivers etc etc... Eventually I discovered that the 'MySensors ESP driver' was receiving a NULL pointer, when it was expecting a char pointer to a message, this was causing the ESP to reset.

I've since been told this problem was fixed in the MySensors 2.0 (beta) drivers and only applies to the 1.5 version (current ver at this point in time).

I hope this helps others clarify which of the three 'causes' apply to their issue. For example, my ESP was resetting, I didn't have a clue if it was a "WDT" reset, it could have been an "ABC" or "XYZ" reset as far as I knew. I still don't know what a WDT reset is?

Cheers... Paul

p.s. The first thing to check with any radio device (ESP, nRf2401 or GSM etc) is that you MUST have a good power source. When these devices transmit their current requirements go up significantly, which can cause all sorts of weird and wonderful thing to happen. Whenever I have a problem with a radio device, I will (temporarily) power the (3.3v) RF device direct from a Lipo battery (3.7v) with a 1N4001 (or similar) diode in series, this drops the voltage to 3.1v. Even though the voltage is a tad low, the Lipo (or NiCad) can deliver tremendous 'grunt' (amps) thus its a 'clean' and stable power source!

The esp (and AVR) has something called a watchdog timer. It's actually there to help if something goes wrong, resetting the MCU. The watchdog timer can be disabled and reconfigured to allow longer interval. On ESP it's enabled by default and on AVR you have to enable it yourself (requires a special bootloader).

Its works by using a timer which gets "reset" by calling yield() or delay(). Normally you don't have to worry about it as yield() is called automatically in the main loop().

If yield() isn't called each second (which is the default timeout on ESP) the MCU will reset.

If you have some long blocking tasks you can disable the wdt temporariily like this:

@hek are you sure disabling the WDT does actually work for ESP? The fact that the function exists, doesn't automatically mean it works
In the past there were numerous issues of users who tried to disable it but kept getting WDT resets. But again, maybe that's been fixed in 2.x

@Yveaux
Thanks for the response.. I actually did get the 1.5 to at least come up, by putting some WDT resets around in various places that may take a while in a loop, for example, BUT, based on yours, and several other recommendations, I decided to try the 2.0 dev branch.. I deleted everything in my librarys\MySensors directory, and downloaded the DEV branch, and re-extracted the code, and now I can't compile.. I'm getting this:

@172pilot I'm not behind a PC right now, so it's hard to replay the situation.
I'd say you either didn't clean everything out completely (use e.g. a completely separate Arduino folder for sketches and libraries), or it's the ESP Arduino port you're using (which version did you install through board manager?)

I have been storing everything in what I think is the default directory, which under my \users\sjones\Documents\Arduino\libraries. This is what the Arduino IDE is pointing to.

Under that directory, I removed the MySensors directory and extracted the new 2.0 one.. BUT, I do see that there are more modules than just those under MySensors, so even though I think those are supposed to NOT conflict with the default ones, I missed one?

Also, I dont understand why, but I see SOME arduino extension stuff under \program Files (x86)\arduino although I didn't see any MySensors information..

And, the only other thing I saw which I didn't know how it got there was the one referred to in the error: "C:\Users\sjones\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\libraries\ESP8266WiFi" Since that specifically was referred to in the error, I thought maybe I had an old version there, so I renamed the ESP8266Wifi directory to "old", figuring that whatever put it there in the first place would replace it with the current version if needed, but it didn't happen - it just failed to compile, complaining that it was missing, so I put it back..

I'm not near my home computer now, but maybe when I get home I'll try with a completely new windows profile (create a new user) and reinstall Arduino from scratch

I'm fairly certain from what you have described that you have NOT done this, but just in case I will mention it. Remember, simply renaming a folder within libraries (eg. 'MySensors' to 'MySensorsOLD') can cause grief as the old and new will both be compiled / seen by the linker.

I think your 'new user' idea will work.

FWIW: Some time ago I had a similar issue with a different library, I can't remember the details, but I found/fixed it by doing a global search of "C:" for various keywords (e.g. "ESP8" and "MySen" in your case). I ended up finding files I didn't realise were there.

I uninstalled Arduino completely, deleted everything I could find, and reinstalled from scratch, and after a bit of patience and rebooting the vera, I now have a functioning Wifi gateway using a Sparkfun 8266 Thing Dev board, and an NRF radio.. Then I was able to build a quick "Arduino switch" with an Uno and an NRF just to test, and it works great!!

Problem now to figure out is how to connect a new sensor, as it restarts as soon as it's powered on.
Any ideas?

I have the same problem. I'm using the Esp8266Gateway sketch in the Lib v1.5 and have a NRF24 radio as described in the instructions.
Every time that I connect a new sensor, the MCU is restarting as you described. This is only happening when the Gateway is connected to a controller (Homeassistant or MYSController). If the gateway is not connected to any controller then it receive the data without any problem.

@afeno what esp arduino core are you using? Try updating to the latest version.
I have an esp gateway running (2.0.0, fixed ip, mqtt client, powered through micro USB) without any issues. Power could be insufficiently stable though, so you could also try switching the power supply.

I didn't give up (yet...) I tried today to power the NRF from an external power supply. Same result. The esp8266 is rebooting after receiving some data as shown above. My conclusion is that the problem is on the esp8266 itself or in the power supply that I am using.
My last try will be to power the esp8266 from something different than the microUSB.
Just in case, this is the setup. Maybe I'm missing something very basic: