Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ets Jan 8 2013,rst cause:4, boot mode:(3,6) #1809

Closed
EagleSmith opened this issue Mar 23, 2016 · 56 comments
Closed

ets Jan 8 2013,rst cause:4, boot mode:(3,6) #1809

EagleSmith opened this issue Mar 23, 2016 · 56 comments

Comments

@EagleSmith
Copy link

EagleSmith commented Mar 23, 2016

Basic Infos

Hardware

Hardware: ESP-12E
Core Version: 2.1.0

Description

Problem description

Settings in IDE

Module: Generic ESP8266 Module
Flash Size: 4MB
CPU Frequency: 80Mhz
Flash Mode: DIO
Flash Frequency: 80Mhz
Upload Using: SERIAL
Reset Method: ck

Sketch

#include <Arduino.h>

void setup() {
Serial.begin(115200);
  Serial.setDebugOutput(true);

WiFi.mode(WIFI_STA);
    WiFi.disconnect(); 
    DEBUG_WM(F("WiFi mode STA"));

    if (connectWifi("", "") == WL_CONNECTED) {DEBUG_WM(F("connect wifi with no saved "));}
    else
    {
      DEBUG_WM(F("connect wifi with config value "));
      if (connectWifi(ssid.c_str(), password.c_str()) == WL_CONNECTED) {}
    }
    Serial.print(F("IP Address:"));
    Serial.println(WiFi.localIP());

    Serial.println("");
    Serial.print("Connected to ");
    Serial.println(ssid);
    Serial.print("IP address: ");
    Serial.println(WiFi.localIP());
  }
 HX711_Init();
}

void loop() {

}

Debug Messages

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

wdt reset
load 0x4010f000, len 1264, room 16
tail 0
chksum 0x42
csum 0x42
~ld

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@igrr
Copy link
Member

igrr commented Mar 23, 2016

Is this the same as #1335?

@igrr
Copy link
Member

igrr commented Mar 23, 2016

Also would be cool if you provide the link to the source of HX711_Init function, since it is obviously causing issues.

@EagleSmith
Copy link
Author

SPIFFSImpl: allocating 512+180+1400=2092 bytes
SPIFFSImpl: mounting fs @100000, size=2fb000, block=2000, page=100
SPIFFSImpl: mount rc=0

@EagleSmith
Copy link
Author

thanks ,the code is :
#define SCK 12
#define DOUT 13

SCK = sck;
DOUT = dout;
set_gain(gain);
COEFFICIENT = scale;
pinMode(SCK, OUTPUT);
pinMode(DOUT, INPUT);
digitalWrite(SCK, LOW);
if (is_ready())
{
read();
}

@EagleSmith
Copy link
Author

i removed the hx711_init(),but the exception still happend

@igrr
Copy link
Member

igrr commented Mar 23, 2016

I tried compiling your example, but I am getting an error that connectWifi is not defined. Also in your hx117_init function, read function is not defined. Could you please post the complete source code?
It is also not clear why you are getting messages related to SPIFFS if you are not using it (at least not in the code you have posted).

@igrr
Copy link
Member

igrr commented Mar 23, 2016

If you are getting an exception, please post the exception message here and decode it using EspExceptionDecoder tool.

https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/stack_dump.md

@EagleSmith
Copy link
Author

https://github.com/bogde/HX711

sorry,My chip is 13

@EagleSmith
Copy link
Author

I use 1.6.5 (SDK2.0.0)to recompile, it is working fine

Exception occurs when WIFI connecting

@jumpjack
Copy link

jumpjack commented Oct 5, 2016

Solutions?

@badf007
Copy link

badf007 commented Oct 24, 2016

Any solution ? tutorial ?

@Adrianotiger
Copy link

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

Same with my ESP-12 using the AT commands firmware (boot1.2).

@sayak-brm
Copy link

sayak-brm commented Nov 11, 2016

Got this same problem:

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>

MDNSResponder mdns;

char ssid[] = "ssid";    // your network SSID (name) 
char pass[] = "pass"; // your network password (use for WPA, or use as key for WEP)

ESP8266WebServer server(80);
String webPage = "<!DOCTYPE html><html><head><title>Remote Controlled Vehicle</title><script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js\"></script></head><body><center><img src=\"http://192.168.1.100/?action=stream\" /><div id=\"panel\" style=\"color:#f2f2f2;height:100px;width:100%;\"></div></center><script>global.$ = require(\"jquery\");require(\"jquery-touch-events\");$(\"#panel\").bind(\"swipeup\", function(e){$.post(\"/\",{task:'f'});});$(\"#panel\").bind(\"swipedown\", function(e){$.post(\"/\",{task:'b'});});$(\"#panel\").bind(\"swipeleft\", function(e){$.post(\"/\",{task:'l'});});$(\"#panel\").bind(\"swiperight\", function(e){$.post(\"/\",{task:'r'});});$(\"#panel\").bind(\"swipeend\", function(e){$.post(\"/\",{task:'h'});});</script></body></html>";

PROGMEM const int l=7,r=6,f=5,b=4,h=3;

void setup() {
  Serial.begin(115200);
  Serial.println("yesss");
  pinMode(f, OUTPUT);
  pinMode(b, OUTPUT);
  pinMode(l, OUTPUT);
  pinMode(r, OUTPUT);
  pinMode(h, OUTPUT);
  digitalWrite(f, LOW);
  digitalWrite(b, LOW);
  digitalWrite(l, LOW);
  digitalWrite(r, LOW);
  digitalWrite(h, LOW);
  Serial.println(WiFi.begin(ssid, pass));
  delay(2000);
  Serial.println(WiFi.status());
  Serial.println(mdns.begin("sayak", WiFi.localIP()));
  server.on("/", [](){
    if(server.hasArg("task"))
    {
      String task=server.arg("task");
      digitalWrite(f, LOW);
      digitalWrite(b, LOW);
      digitalWrite(l, LOW);
      digitalWrite(r, LOW);
      digitalWrite(h, LOW);
      if(task=="h") digitalWrite(h,HIGH);
      else if(task=="f") digitalWrite(f,HIGH);
      else if(task=="b") digitalWrite(b,HIGH);
      else if(task=="l") digitalWrite(l,HIGH);
      else if(task=="r") digitalWrite(r,HIGH);
      return;
    }
    server.send(200, "text/html", webPage);
  });
  server.begin();
  Serial.println("yesss");
}

void loop() {
  server.handleClient();
}

@sayak-brm
Copy link

Works after changing PROGMEM const int l=7,r=6,f=5,b=4,h=3; to PROGMEM const int l=D4,r=D3,f=D2,b=D1,h=D0;

@john3exonets
Copy link

And for those of us who are less psychic, where would I go to change this PROGMEM const int??

@JZ-SmartThings
Copy link

Ditto, would be nice to know exactly where to change PROGMEM. Few things I already searched, my Arduino IDE folder and this location where the IDE places upgraded libs: C:\Users\myuser\Documents\Arduino

I also found PROGMEM referenced in ArduinoJson lib which seems to say that PROGMEM is only available in AVR architecture which contradicts what we have with the ESP8266 (non-AVR):
// PROGMEM is only available on AVR architecture

My project (SmartThings generic HTTP driver/Device-Handler controlling 2 relays & more) is much larger than the few concise samples posted above but this error is killing me and made me put in reboot logic, occurring every 8 hours; pathetic solution... posting that reboot sample below for others to reference but it's a crappy workaround and we'd love to get this figured out, please elaborate on the proposed fix.

//SELF-STANDING FUNCTION AT THE TOP OF THE SKETCH OUTSIDE OF SETUP/LOOP
void(* resetFunction) (void) = 0;

//AT TOP OF THE LOOP --- RESET EVERY 8 HOURS
if (millis () >= 28800000) {
resetFunction();
}

@hemangjoshi37a
Copy link

hemangjoshi37a commented May 31, 2017

What is the meaning of this "boot mode:(3,6)"??
There are also other types of boot modes, what do they mean??
Please provide any table that has all possible values and meanings of boot modes.
Please help. Thank you....
https://hjlabs.in/

@lrmoreno007
Copy link
Contributor

Read the documentation before asking something already explained or do it at www.esp8266.com

http://arduino-esp8266.readthedocs.io/en/latest/boards.html#boot-messages-and-modes

@hemangjoshi37a
Copy link

hemangjoshi37a commented May 31, 2017

@lrmoreno007 thax yo... That is what I was looking for my whole day... You saved my day...
https://hjlabs.in/

@akashash
Copy link

Hi, I am also getting same isssue but only while using "Wifi.config()" to set static IP. If I am not using this...my code is working fine. But with this...I am getting this issue. Can anyone please help??

@Kondenado
Copy link

Hi

I am getting the same problem in a D1 mini (ESP8266 based board).

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

wdt reset
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v09f0c112
~ld
"

When i go the webpage to know which is the problem here, i find: That reset cause 4 is watchdog reset,

and the modes are:

Number GPIO15 GPIO0 GPIO2 Mode
0 0V 0V 0V Not valid
1 0V 0V 3.3V Uart
2 0V 3.3V 0V Not valid
3 0V 3.3V 3.3V Flash
4 3.3V 0V 0V SDIO
5 3.3V 0V 3.3V SDIO
6 3.3V 3.3V 0V SDIO
7 3.3V 3.3V 3.3V SDIO

So my personal guess is that my D1 mini is in " flashing mode" right? So the issue is to put it in the "running mode" right? Any suggestion on where to look to do that? (I am not very proefficient in this things ..)

@devyte
Copy link
Collaborator

devyte commented Oct 18, 2017

This looks like user error due to use of wrong pins, or use of 3rd party lib that wasn't supported for the ESP.
Closing per #3655 .

@devyte devyte closed this as completed Oct 18, 2017
@junwoo091400
Copy link

Absolutely, after the same error, my code worked perfectly, without any need for better POWER-SUPPLY....
it was just a 'Wrong, Unsupported 3rd party library' !!!!!!

@StarsoftAnalysis
Copy link

Ah, yes. It was wrong pin numbers in my case. Thanks.

@ABHI072
Copy link

ABHI072 commented Apr 5, 2018

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

Hardware used: ESP-12F

Debug Messages:

ets Jan 8 2013,rst cause:4, boot mode:(3,6)
wdt reset
load 0x4010f000, len 1264, room 16
tail 0
chksum 0x42
csum 0x42
~ld

Reason(in my case):
pins RST(reset), EN(enable) and VCC were facing fluctuations in power supplied irrespective of the constant power supply. This was causing a rst of no. 4, i.e. Hardware WDT reset.

Solution:
Add a 47uF capacitor at each of the pin mentioned wrt GND.

@Kondenado
Copy link

Once I had a similar problems, not sure if the same.

it turned out that I was not declaring properly the pins. For instance, PIN 1 in the arduino IDE code, is not PIN 1 in the D1 mini. I just looked the pinmap change the pins and it worked OK.

@dcolley
Copy link

dcolley commented May 31, 2019

@Kondenado thanks, I also moved from Uno to D1. Your suggestion solved my issue!

@msalik42
Copy link

Any solution ? tutorial ?

Maybe you are not using the right version of the Library.

@dcolley
Copy link

dcolley commented Jun 10, 2019

@msalik42 you should read the comments from @junwoo091400

"In ESP8266, if you access [...] a null pointer [...], the program goes into watchdog reset."

I would recommend you double-check all variables and pin numbers, make sure they have been initialised and have correct values.

@ffbboy30
Copy link

ffbboy30 commented Jan 15, 2020

I'm facing the same problem of many people with the reboot of the esp8266 board.
I'm using the arduino lib as it is , why it is not working directly ? on the 8266 arduino file there is more the 500 structure which one is wrong .
I'm using ESP-01
The STA mode works TCP & UDP, the AP reboot TCP&UDP
Thanks

@chimeranzl
Copy link

chimeranzl commented May 25, 2020

rst cause:4, boot mode:(3,6) often happens when you define the pins incorrectly. For example, I was using a Wemos D1 Mini and specified constants to define pins 6 and 7, whereas I should have put in D6 and D7. EDIT: oops, noted above this has already been mentioned.

@beshur
Copy link

beshur commented Jun 11, 2020

I have the same issue, but with no externals attached, on a BasicHttpClient example, that is below.

Board is Wemos D1 mini lite, nothing is connected. Board is powered via USB from computer.

Blink example is fine though. Also it worked before on the same board.

Serial log:

[SETUP] WAIT 4...
[SETUP] WAIT 3...
[SETUP] WAIT 2...
[SETUP] WAIT 1...

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

wdt reset
load 0x4010f000, len 3456, room 16 
tail 0
chksum 0x84
csum 0x84
va5432625
~ld

SDK:2.2.2-dev(38a443e)/Core:2.7.1=20701000/lwIP:STABLE-2_1_2_RELEASE/glue:1.2-30-g92add50/BearSSL:5c771be

[SETUP] WAIT 4...

Code:

/**
   BasicHTTPClient.ino

    Created on: 24.05.2015

*/

#include <Arduino.h>

#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>

#include <ESP8266HTTPClient.h>

#include <WiFiClient.h>

ESP8266WiFiMulti WiFiMulti;

void setup() {

  Serial.begin(115200);
  // Serial.setDebugOutput(true);

  Serial.println();
  Serial.println();
  Serial.println();

  for (uint8_t t = 4; t > 0; t--) {
    Serial.printf("[SETUP] WAIT %d...\n", t);
    Serial.flush();
    delay(1000);
  }

  WiFi.mode(WIFI_STA);
  WiFiMulti.addAP("SSID", "PASSWORD");

}

void loop() {
  // wait for WiFi connection
  if ((WiFiMulti.run() == WL_CONNECTED)) {

    WiFiClient client;

    HTTPClient http;

    Serial.print("[HTTP] begin...\n");
    if (http.begin(client, "http://jigsaw.w3.org/HTTP/connection.html")) {  // HTTP


      Serial.print("[HTTP] GET...\n");
      // start connection and send HTTP header
      int httpCode = http.GET();

      // httpCode will be negative on error
      if (httpCode > 0) {
        // HTTP header has been send and Server response header has been handled
        Serial.printf("[HTTP] GET... code: %d\n", httpCode);

        // file found at server
        if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
          String payload = http.getString();
          Serial.println(payload);
        }
      } else {
        Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
      }

      http.end();
    } else {
      Serial.printf("[HTTP} Unable to connect\n");
    }
  }

  delay(10000);
}

@chimeranzl
Copy link

chimeranzl commented Jun 11, 2020

I have the same issue, but with no externals attached, on a BasicHttpClient example, that is below.

Board is Wemos D1 mini lite, nothing is connected. Board is powered via USB from computer.

Blink example is fine though. Also it worked before on the same board.

Serial log:

[SETUP] WAIT 4...
[SETUP] WAIT 3...
[SETUP] WAIT 2...
[SETUP] WAIT 1...

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

wdt reset
load 0x4010f000, len 3456, room 16 
tail 0
chksum 0x84
csum 0x84
va5432625
~ld

SDK:2.2.2-dev(38a443e)/Core:2.7.1=20701000/lwIP:STABLE-2_1_2_RELEASE/glue:1.2-30-g92add50/BearSSL:5c771be

[SETUP] WAIT 4...

Code:


Seems to be caused by your wireless multi definition - not sure why there are numerous wifi headers included. Try getting rid of #include <ESP8266WiFiMulti.h> and just use #include <ESP8266Wifi.h>

Also get rid of the wifi declare ESP8266WiFiMulti WiFiMulti; and change to WiFiClient wifiClient; instead and use that in your code.

I usually create a function to start Wifi and call it from the setup or loop. Eg like this...

//
// Starts WIFI connection
//
void startWIFI()
{

  // If we are not connected
  if (WiFi.status() != WL_CONNECTED)
  {
    int iTries;
    iTries = 0;
    digitalWrite(LED_BUILTIN, LOW);
    Serial.println("Starting WIFI connection");
    WiFi.mode(WIFI_STA);
    WiFi.disconnect();
    WiFi.begin(ssid, password);

    // If not WiFi connected, retry every 3 seconds for 1 minute
    while (WiFi.status() != WL_CONNECTED)
    {
      iTries++;
      Serial.print(".");
      delay(3000);

      // If can't get to Wifi after 1 minute, reboot ESP
      if (iTries > 20)
      {
        Serial.println("TOO MANY WIFI ATTEMPTS, REBOOTING!");
        ESP.reset();
      }
    }

    Serial.println("");
    Serial.println("WiFi connected");
    Serial.println(WiFi.localIP());

    // Turn off LED
    digitalWrite(LED_BUILTIN, HIGH);

    // Let network have a chance to start up
    delay(500);

  }

}

@beshur
Copy link

beshur commented Jun 11, 2020

Seems to be caused by your wireless multi definition - not sure why there are numerous wifi headers included. Try getting rid of #include <ESP8266WiFiMulti.h> and just use #include <ESP8266Wifi.h>

Also get rid of the wifi declare ESP8266WiFiMulti WiFiMulti; and change to WiFiClient wifiClient; instead and use that in your code.

This is from the ESP8266 library example.

I usually create a function to start Wifi and call it from the setup or loop. Eg like this...

Thanks.

Anyway, I tried your suggestions and nothing changed.

@chimeranzl
Copy link

chimeranzl commented Jun 11, 2020

Seems to be caused by your wireless multi definition - not sure why there are numerous wifi headers included. Try getting rid of #include <ESP8266WiFiMulti.h> and just use #include <ESP8266Wifi.h>
Also get rid of the wifi declare ESP8266WiFiMulti WiFiMulti; and change to WiFiClient wifiClient; instead and use that in your code.

This is from the ESP8266 library example.

I usually create a function to start Wifi and call it from the setup or loop. Eg like this...

Thanks.

Anyway, I tried your suggestions and nothing changed.

Do you have the latest libraries installed and updated?

Have you tried another Wemos D1? I've been delivered one in the past that just failed like this all the time, regardless of the code I had on it. Although, if Blink works on it and this code doesn't, then that kind of points to the code or library.

@beshur
Copy link

beshur commented Jun 12, 2020

Thanks for reply, @chimeranzl

Do you have the latest libraries installed and updated?

Yes

Have you tried another Wemos D1? I've been delivered one in the past that just failed like this all the time, regardless of the code I had on it. Although, if Blink works on it and this code doesn't, then that kind of points to the code or library.

Yes, my other Wemos D1 works fine, but this one was also okay just a couple weeks ago, and I did only sketch changes.

@beshur
Copy link

beshur commented Jun 12, 2020

Fixed my issue with:

Reduced the main delay to 3000 in loop (presumably the cause of wdt reset), dropped wifi multi, and I was getting a new error:

Fatal exception 3(LoadStoreErrorCause)

I did some more searching, and found this thread that suggests erasing flash.

I changed the Erase Flash in Aduino to "All Flash Contents" and it helped.

@blaskovicz
Copy link

My exception was happening because I was hitting an infinite recursion case...

@jayanta-banik
Copy link

this is probably a fluke, but my error was resolved when i used D6, instead of 6 as reference to pin number,
I am using node-mcu. Hope this helps someone.

@rTiagoS
Copy link

rTiagoS commented Nov 2, 2020

Absolutely, after the same error, my code worked perfectly, without any need for better POWER-SUPPLY....
it was just a 'Wrong, Unsupported 3rd party library' !!!!!!

That's correct!!!! I had the same issue. I was using #include <WiFi.h> library instead <ESP8266WiFi.h>. So after chaging that, i was able to connect to the Wireless Network and broker without the watchdog reset and all those stuffs. Thanks!

@Nardjis
Copy link

Nardjis commented Nov 19, 2020

I changed the values ​​of the variables and everything worked fine

@firtinahg
Copy link

This problem happened to me , cause is 'PROGMEM' usage. If you are change the PROGMEM values to another type e.g. String you can manage the wdt reset.

@eliazgheib
Copy link

I am having the same problem. I tried to upload a blank sketch and I still receiving the following on the serial monitor:
ets Jan 8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x4010f000, len 3584, room 16
tail 0
chksum 0xb0
csum 0xb0
v2843a5ac
~ld

@jayanta-banik
Copy link

jayanta-banik commented Apr 4, 2021 via email

@renanlido
Copy link

renanlido commented Jul 1, 2021

Hey guys, i found this archive that explains everything. It's in Portuguese but it's worth taking a look. https://portal.vidadesilicio.com.br/watchdog-esp8266/

@Eronrhcp
Copy link

Works after changing PROGMEM const int l=7,r=6,f=5,b=4,h=3; to PROGMEM const int l=D4,r=D3,f=D2,b=D1,h=D0;

Obrigado amigo, para mim funcionou!

@ghost
Copy link

ghost commented Dec 29, 2021

It's cause you use pin6 as input lol. Don't do that and problem solved.

@hneel
Copy link

hneel commented Feb 14, 2022

I got the error when I wanted to send a F("string") instead of a "string".
It didn't give a problem with an Arduino Uno or an ESP32.

@pedator92
Copy link

simple fix, use the GPIO Numbers, not the D7 or so.
work fine

@wasimghafar-15530
Copy link

I was facing this problem with JSON.
In my case size of the payload and JSON document was not suitable, I changed the size and fix it.

@vyk2rr
Copy link

vyk2rr commented Apr 9, 2022

Absolutely, after the same error, my code worked perfectly, without any need for better POWER-SUPPLY....
it was just a 'Wrong, Unsupported 3rd party library' !!!!!!

That's correct!!!! I had the same issue. I was using #include <WiFi.h> library instead <ESP8266WiFi.h>. So after chaging that, i was able to connect to the Wireless Network and broker without the watchdog reset and all those stuffs. Thanks!

4 years to get the right answer 😄

@kcchang61
Copy link

If you are using ESP8266, pls include <ESP8266WiFi.h> instead of <WiFi.h>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests