RMK-Jacob
RMK-Jacob

Reputation: 209

ESP8266 Constantly Restarting

I have been struggling for some time now trying to get my ESP8266 ESP-12 to work. I was able to get it loaded with the NodeMCU software. Now, the board constantly restarts itself. Whether I have a script loaded on it or not, the module seems to continually restart. I am using ESPlorer, and can see it get connection to NodeMCU. Then the board restarts several seconds to several mins later. I have tried various pinout, capacitors, etc. with no luck in solving this problem. I have been searching all over and have had no luck finding a solution. Any help is greatly appreciated. Here is my current pinout:

ESP-12          -----------      TTY 3.3v Serial
================================================
TX ----------------------------- RX    
RX ----------------------------- TX    
GND, GPIO15 -------------------- GND    
VCC, CH_PD, GPIO0, (RST) ------- LD1117v33 voltage regulator +3.3v    
GND, GPIO15 -------------------- LD1117v33 voltage regulator GND

Thanks so much in advance for any help!

Upvotes: 6

Views: 30769

Answers (7)

Rufusy
Rufusy

Reputation: 11

I suggest that you connect your reset pin to 3.3v via a 10K ohm resistor and to ground via a push button. This way your reset pin is always pulled high to prevent the random resets. I assume that your code has no bugs.

Upvotes: 0

Mert Gülsoy
Mert Gülsoy

Reputation: 2919

Get the serial terminal program named "terminal v1.9b by br@y++". While I wrote this answer I was not able to download. When I find the link I'll add in a comment. Run the program and set the baud rate to custom and enter the value 74880 or 74400. With this you'll be able to see the fw messages. In this messages there is the reboot reason code. The codes are :

  • 0 -> normal startup by power on
  • 1 -> hardware watch dog reset
  • 2 -> software watch dog reset (From an exception)
  • 3 -> software watch dog reset system_restart (Possibly unfed wd got angry)
  • 4 -> soft restart (Possibly with a restart command)
  • 5 -> wake up from deep-sleep

Looking at the provided code you can decide from what reason the chip is restarting.

Upvotes: 1

forqzy
forqzy

Reputation: 389

If your hardware is good, then the problem should be inside your code. And sometime your code takes too long to finish, then it will trigger the watchdog to restart.

Upvotes: 0

mkarliner
mkarliner

Reputation: 51

Use a pullup resistor on the RST line rather than just connecting it directly to VCC. I used 4.7K, but the actual value is not critical.

Upvotes: 1

nickandrew
nickandrew

Reputation: 66

I had a NodeMCU dev board which worked fine for some hours, then suddenly restarted and wouldn't stay up. I tried adding power-supply capacitors and using a different power supply, to no avail.

What fixed it for me was resetting the watchdog timer every second:

tmr.alarm(6, 1000, 1, function() tmr.wdclr() end)

The watchdog timer needs to be reset periodically. I don't know how often. My device was resetting after about 35-40 seconds uptime. My code (which ran every 30 seconds from timer) was resetting the watchdog itself. This was not enough, somehow.

Upvotes: 1

user1816847
user1816847

Reputation: 2067

Assuming the hardware is okay and the right binary is loaded it's almost surly a power problem.

1) Make sure what ever voltage regulator you're using is rated for 200mA or more. In your case the LD1117 can source 800mA so that's good.

2) Make sure you're upstream power supply can source 200mA or more. If you're powering from a USB hub make sure the hub is powered.

3) Make sure you have some large low ESR capacitors across GND and 3.3v. Two capacitors: 10uF and 100uF worked for me (there's nothing magic about these exact values, 10-100uF should work). The ESP8266 can draw huge (relatively) amounts of current for short periods while booting or transmitting. This can cause a bad transient on the power supply, which will cause the system to reboot, which can lead to an infinite reboot cycle.

Upvotes: 4

Talha
Talha

Reputation: 1636

ESP8266 running lua goes to panic mode if the program loaded on it is has some bug.

Look at your code again. Reflash the firmware and upload code again. Try to upload code bit by bit. So that you know which part is causing the issue.

fix the setup in such way that flashing firmware is super easy. Trust me you will need to reflash it many times if you wanna play with code on it.

Upvotes: 1

Related Questions