esp8266 / Arduino

ESP8266 core for Arduino
GNU Lesser General Public License v2.1
15.98k stars 13.33k forks source link

Exception (28): epc1=0x4000dfc8 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000 #3687

Closed hemangjoshi37a closed 6 years ago

hemangjoshi37a commented 6 years ago

Basic Infos

Hardware

Hardware: ESP-12 Core Version: I DONT KNOW

Description

When I send a data from device to wifi clients it crashes giving the error " Exception (28): epc1=0x4000dfc8 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000 " but when esp8266 is receiving data from the clients, It works fine.

Settings in IDE

Module: NodeMCU 1.0 (ESP-12E Module) Flash Size: 4MB CPU Frequency: 80Mhz Flash Mode: qio Flash Frequency: 40Mhz Upload Using: SERIAL Reset Method: nodemcu

Sketch

#include <ESP8266WiFi.h>

//how many clients should be able to telnet to this ESP8266
#define MAX_SRV_CLIENTS 1

const char *ssid = "Tenda_5F19A8";
const char *password = "bhumika_301";

WiFiServer server(23);
WiFiClient serverClients[MAX_SRV_CLIENTS];

byte a, alst;
String astr;
unsigned int count = 1;

void setup() {
  a = 0;
  alst = 1;
  pinMode(A0, INPUT);
  Serial1.begin(115200);
  //Serial.begin(115200);
  WiFi.begin(ssid, password);
  Serial1.print("\nConnecting to "); Serial1.println(ssid);
  uint8_t i = 0;
  while (WiFi.status() != WL_CONNECTED && i++ < 20) delay(500);
  if (i == 21) {
    Serial1.print("Could not connect to"); Serial1.println(ssid);
    while (1) delay(500);
  }
  //start UART and the server
  Serial.begin(115200);
  server.begin();
  server.setNoDelay(true);

  Serial1.print("Ready! Use 'telnet ");
  Serial1.print(WiFi.localIP());
  Serial1.println(" 23' to connect");

  a = (byte)analogRead(A0);
  astr = String(a);
}

void loop() {
  uint8_t i;
  //check if there are any new clients
  if (server.hasClient()) {
    for (i = 0; i < MAX_SRV_CLIENTS; i++) {
      //find free/disconnected spot
      if (!serverClients[i] || !serverClients[i].connected()) {
        if (serverClients[i]) serverClients[i].stop();
        serverClients[i] = server.available();
        Serial1.print("New client: "); Serial1.print(i);
        continue;
      }
    }
    //no free/disconnected spot so reject
    WiFiClient serverClient = server.available();
    serverClient.stop();
  }
  /////////////////////////////////////////////////////////////////////////////////////
  //check clients for data
  for (i = 0; i < MAX_SRV_CLIENTS; i++) {
    if (serverClients[i] && serverClients[i].connected()) {
      if (serverClients[i].available()) {
        //get data from the telnet client and push it to the UART
        while (serverClients[i].available()) Serial.write(serverClients[i].read());
      }
    }
  }
  ///////////////////////////////////////////////////////////////////////////////////
  //check UART for data
  if (Serial.available()) {
    size_t len = Serial.available();
    uint8_t sbuf[len];
    Serial.readBytes(sbuf, len);
    //push UART data to all connected telnet clients
    for (i = 0; i < MAX_SRV_CLIENTS; i++) {
      if (serverClients[i] && serverClients[i].connected()) {
        serverClients[i].write(sbuf, len);
        delay(1);
      }
    }
  }

  //////////////////////////////////////////////////////////////////////////////////////

  if (Serial.available()) {
    size_t len = Serial.available();
    uint8_t sbuf[len];
    Serial.readBytes(sbuf, len);

    a = (byte)analogRead(A0);

 //   if (alst != a)
    {

      astr = String(a);
      size_t len = astr.length();
      len = 1;
      uint8_t aread[len];
      //push UART data to all connected telnet clients
      for (i = 0; i < MAX_SRV_CLIENTS; i++) {
        if (serverClients[i] && serverClients[i].connected()) {
          serverClients[i].write((uint8_t *)a, len);
          delay(100);
        }
      }
      alst = a;
      //delay(1);
    }
    count++;
  }
}

Serial Messages

Exception (28):
epc1=0x4000dfc8 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont 
sp: 3ffef2d0 end: 3ffef570 offset: 01a0

>>>stack>>>
3ffef470:  3fff023c 00000000 00000001 00000000  
3ffef480:  402230ca 3fff03d4 00000000 402230a0  
3ffef490:  00000000 00000001 00000000 00000002  
3ffef4a0:  00000001 00000000 00000000 3fff06fc  
3ffef4b0:  00000001 000005b3 00000000 4020335d  
3ffef4c0:  3ffee4fc 000000df 000000df 3ffef510  
3ffef4d0:  3ffef510 00000001 3fff04bc 402028ae  
3ffef4e0:  3ffef510 3ffee3ed 3ffee3f0 402028f0  
3ffef4f0:  00000000 3ffee51c 3ffee3f0 40202027  
3ffef500:  55545559 3ffe0a0d 3ffee3f0 40201f72  
3ffef510:  00000000 00000000 00000000 40203190  
3ffef520:  00000000 00000000 3ffee500 40201e00  
3ffef530:  3ffef510 00000000 00000000 feefeffe  
3ffef540:  00000000 00000000 00000001 3ffee548  
3ffef550:  3fffdad0 00000000 3ffee540 402034b0  
3ffef560:  feefeffe feefeffe 3ffee550 40100718  
<<<stack<<<

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

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

Please help me. I am stuck with this problem from days. I have read somewhere that using core version 2.3.0 solves this issue but i don't know where to download it and replace with existing version.

igrr commented 6 years ago

Please use EspExceptionDecoder to decode that stack trace.

On Sat, Oct 7, 2017 at 9:13 PM, Hemang Joshi notifications@github.com wrote:

Basic Infos Hardware

Hardware: ESP-12 Core Version: I DONT KNOW Description

When I send a data from device to wifi clients it crashes giving the error " Exception (28): epc1=0x4000dfc8 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000 " but when esp8266 is receiving data from the clients, It works fine. Settings in IDE

Module: ESP8266 Module ESP12 Flash Size: 4MB CPU Frequency: 80Mhz Flash Mode: qio Flash Frequency: 40Mhz Upload Using: SERIAL Reset Method: nodemcu Sketch

include

//how many clients should be able to telnet to this ESP8266

define MAX_SRV_CLIENTS 1

const char ssid = "Tenda_5F19A8"; const char password = "bhumika_301";

WiFiServer server(23); WiFiClient serverClients[MAX_SRV_CLIENTS];

byte a, alst; String astr; unsigned int count = 1;

void setup() { a = 0; alst = 1; pinMode(A0, INPUT); Serial1.begin(115200); //Serial.begin(115200); WiFi.begin(ssid, password); Serial1.print("\nConnecting to "); Serial1.println(ssid); uint8_t i = 0; while (WiFi.status() != WL_CONNECTED && i++ < 20) delay(500); if (i == 21) { Serial1.print("Could not connect to"); Serial1.println(ssid); while (1) delay(500); } //start UART and the server Serial.begin(115200); server.begin(); server.setNoDelay(true);

Serial1.print("Ready! Use 'telnet "); Serial1.print(WiFi.localIP()); Serial1.println(" 23' to connect");

a = (byte)analogRead(A0); astr = String(a); }

void loop() { uint8_t i; //check if there are any new clients if (server.hasClient()) { for (i = 0; i < MAX_SRV_CLIENTS; i++) { //find free/disconnected spot if (!serverClients[i] || !serverClients[i].connected()) { if (serverClients[i]) serverClients[i].stop(); serverClients[i] = server.available(); Serial1.print("New client: "); Serial1.print(i); continue; } } //no free/disconnected spot so reject WiFiClient serverClient = server.available(); serverClient.stop(); } ///////////////////////////////////////////////////////////////////////////////////// //check clients for data for (i = 0; i < MAX_SRV_CLIENTS; i++) { if (serverClients[i] && serverClients[i].connected()) { if (serverClients[i].available()) { //get data from the telnet client and push it to the UART while (serverClients[i].available()) Serial.write(serverClients[i].read()); } } } /////////////////////////////////////////////////////////////////////////////////// //check UART for data if (Serial.available()) { size_t len = Serial.available(); uint8_t sbuf[len]; Serial.readBytes(sbuf, len); //push UART data to all connected telnet clients for (i = 0; i < MAX_SRV_CLIENTS; i++) { if (serverClients[i] && serverClients[i].connected()) { serverClients[i].write(sbuf, len); delay(1); } } }

//////////////////////////////////////////////////////////////////////////////////////

if (Serial.available()) { size_t len = Serial.available(); uint8_t sbuf[len]; Serial.readBytes(sbuf, len);

a = (byte)analogRead(A0);

// if (alst != a) {

  astr = String(a);
  size_t len = astr.length();
  len = 1;
  uint8_t aread[len];
  //push UART data to all connected telnet clients
  for (i = 0; i < MAX_SRV_CLIENTS; i++) {
    if (serverClients[i] && serverClients[i].connected()) {
      serverClients[i].write((uint8_t *)a, len);
      delay(100);
    }
  }
  alst = a;
  //delay(1);
}
count++;

} }

Serial Messages

Exception (28): epc1=0x4000dfc8 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont sp: 3ffef2d0 end: 3ffef570 offset: 01a0

stack>>> 3ffef470: 3fff023c 00000000 00000001 00000000 3ffef480: 402230ca 3fff03d4 00000000 402230a0 3ffef490: 00000000 00000001 00000000 00000002 3ffef4a0: 00000001 00000000 00000000 3fff06fc 3ffef4b0: 00000001 000005b3 00000000 4020335d 3ffef4c0: 3ffee4fc 000000df 000000df 3ffef510 3ffef4d0: 3ffef510 00000001 3fff04bc 402028ae 3ffef4e0: 3ffef510 3ffee3ed 3ffee3f0 402028f0 3ffef4f0: 00000000 3ffee51c 3ffee3f0 40202027 3ffef500: 55545559 3ffe0a0d 3ffee3f0 40201f72 3ffef510: 00000000 00000000 00000000 40203190 3ffef520: 00000000 00000000 3ffee500 40201e00 3ffef530: 3ffef510 00000000 00000000 feefeffe 3ffef540: 00000000 00000000 00000001 3ffee548 3ffef550: 3fffdad0 00000000 3ffee540 402034b0 3ffef560: feefeffe feefeffe 3ffee550 40100718 <<<stack<<<

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

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

Please help me. I am stuck with this problem from days. I have read somewhere that using core version 2.3.0 solves this issue but i don't know where to download it and replace with existing version.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/esp8266/Arduino/issues/3687, or mute the thread https://github.com/notifications/unsubscribe-auth/AEJceu0O1xGEiMObLLO-sfNiU1wtrRm7ks5sp3kEgaJpZM4PxWHn .

hemangjoshi37a commented 6 years ago

Okay sir, Thank you for help. It worked. Now I have decoded the stack looks like this 👍 Decoding 12 results

0x40203490: loop_wrapper at C:\Users\aakash\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_main.cpp line 56
0x402230ca: tcp_write at /Users/igrokhotkov/espressif/arduino/tools/sdk/lwip/src/core/tcp_out.c line 575
0x402230a0: tcp_pbuf_prealloc at /Users/igrokhotkov/espressif/arduino/tools/sdk/lwip/src/core/tcp_out.c line 257
:  (inlined by) tcp_write at /Users/igrokhotkov/espressif/arduino/tools/sdk/lwip/src/core/tcp_out.c line 535
0x4020335d: String::operator=(char const*) at C:\Users\aakash\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.cpp line 66
0x402028ae: ClientContext::write(char const*, unsigned int) at C:\Users\aakash\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.cpp line 149
0x402028f0: WiFiClient::write(unsigned char const*, unsigned int) at C:\Users\aakash\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.cpp line 149
0x40202027: loop at C:\Users\aakash\Documents\Energia\WiFiTelnetToSerial\WiFiTelnetToSerial/WiFiTelnetToSerial.ino line 105
0x40201f72: loop at C:\Users\aakash\Documents\Energia\WiFiTelnetToSerial\WiFiTelnetToSerial/WiFiTelnetToSerial.ino line 88
0x40203190: String::~String() at C:\Users\aakash\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.cpp line 66
0x40201e00: setup at C:\Users\aakash\Documents\Energia\WiFiTelnetToSerial\WiFiTelnetToSerial/WiFiTelnetToSerial.ino line 40
0x402034b0: loop_wrapper at C:\Users\aakash\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_main.cpp line 56
0x40100718: cont_norm at C:\Users\aakash\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/cont.S line 109
0x40203490: loop_wrapper at C:\Users\aakash\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_main.cpp line 56
0x402230ca: tcp_write at /Users/igrokhotkov/espressif/arduino/tools/sdk/lwip/src/core/tcp_out.c line 575
0x402230a0: tcp_pbuf_prealloc at /Users/igrokhotkov/espressif/arduino/tools/sdk/lwip/src/core/tcp_out.c line 257
:  (inlined by) tcp_write at /Users/igrokhotkov/espressif/arduino/tools/sdk/lwip/src/core/tcp_out.c line 535
0x4020335d: String::operator=(char const*) at C:\Users\aakash\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.cpp line 66
0x402028ae: ClientContext::write(char const*, unsigned int) at C:\Users\aakash\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.cpp line 149
0x402028f0: WiFiClient::write(unsigned char const*, unsigned int) at C:\Users\aakash\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.cpp line 149
0x40202027: loop at C:\Users\aakash\Documents\Energia\WiFiTelnetToSerial\WiFiTelnetToSerial/WiFiTelnetToSerial.ino line 105
0x40201f72: loop at C:\Users\aakash\Documents\Energia\WiFiTelnetToSerial\WiFiTelnetToSerial/WiFiTelnetToSerial.ino line 88
0x40203190: String::~String() at C:\Users\aakash\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.cpp line 66
0x40201e00: setup at C:\Users\aakash\Documents\Energia\WiFiTelnetToSerial\WiFiTelnetToSerial/WiFiTelnetToSerial.ino line 40
0x402034b0: loop_wrapper at C:\Users\aakash\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_main.cpp line 56
0x40100718: cont_norm at C:\Users\aakash\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/cont.S line 109

Can i solve the error using this decoding??

igrr commented 6 years ago

serverClients[i].write((uint8_t *)a, len);

You are casting a value obtained from analogRead to a pointer, are you sure that is what you want?

hemangjoshi37a commented 6 years ago

ohh okay. Actually I want to send my analog reading to telnet serial port. So have written it. Is it wrong thing to do? My analog reading is firlstly stored in variable a which is integer but I have to convert it into some kind of array like uint8_t type datatype. So is it wrong thing to do?

devyte commented 6 years ago

@hemangjoshi37a I think this is wrong: serverClients[i].write((uint8_t *)a, len); most likely what you meant to do is: serverClients[i].write(&a, len);

Please review your code, and debug carefully. Closing as user error.

hemangjoshi37a commented 6 years ago

@devyte Thank you for help. I will try it and let you know if it works.

hemangjoshi37a commented 6 years ago

@devyte yo man. It is working but it is giving weird character on the receiving side(on client side). Please take a look at the screenshot. Link : http://hemangjoshi.blogspot.in/2017/10/sent-and-received-data.html The square looking weird characters are sent data from esp.

And my code looks something like this :

#include <ESP8266WiFi.h>

//how many clients should be able to telnet to this ESP8266
#define MAX_SRV_CLIENTS 1

const char *ssid = "Tenda_5F19A8";
const char *password = "bhumika_301";

WiFiServer server(23);
WiFiClient serverClients[MAX_SRV_CLIENTS];

byte a, alst;
String astr;
unsigned int count = 1;

void setup() {
  a = 0;
  alst = 1;
  pinMode(A0, INPUT);
  Serial1.begin(115200);
  //Serial.begin(115200);
  WiFi.begin(ssid, password);
  Serial1.print("\nConnecting to "); Serial1.println(ssid);
  uint8_t i = 0;
  while (WiFi.status() != WL_CONNECTED && i++ < 20) delay(500);
  if (i == 21) {
    Serial1.print("Could not connect to"); Serial1.println(ssid);
    while (1) delay(500);
  }
  //start UART and the server
  Serial.begin(115200);
  server.begin();
  server.setNoDelay(true);

  Serial1.print("Ready! Use 'telnet ");
  Serial1.print(WiFi.localIP());
  Serial1.println(" 23' to connect");

  a = (byte)analogRead(A0);
  astr = String(a);
}

void loop() {
  Serial.println("ok");
  uint8_t i;
  //check if there are any new clients
  if (server.hasClient()) {
    for (i = 0; i < MAX_SRV_CLIENTS; i++) {
      //find free/disconnected spot
      if (!serverClients[i] || !serverClients[i].connected()) {
        if (serverClients[i]) serverClients[i].stop();
        serverClients[i] = server.available();
        Serial1.print("New client: "); Serial1.print(i);
        continue;
      }
    }
    //no free/disconnected spot so reject
    WiFiClient serverClient = server.available();
    serverClient.stop();
  }
  /////////////////////////////////////////////////////////////////////////////////////
  //check clients for data
  for (i = 0; i < MAX_SRV_CLIENTS; i++) {
    if (serverClients[i] && serverClients[i].connected()) {
      if (serverClients[i].available()) {
        //get data from the telnet client and push it to the UART
        while (serverClients[i].available()) Serial.write(serverClients[i].read());
      }
    }
  }
  ///////////////////////////////////////////////////////////////////////////////////
  //check UART for data
  if (Serial.available()) {
    size_t len = Serial.available();
    uint8_t sbuf[len];
    Serial.readBytes(sbuf, len);
    //push UART data to all connected telnet clients
    for (i = 0; i < MAX_SRV_CLIENTS; i++) {
      if (serverClients[i] && serverClients[i].connected()) {
        serverClients[i].write(sbuf, len);
        delay(1);
      }
    }
  }

  //////////////////////////////////////////////////////////////////////////////////////

  a = analogRead(A0);
  size_t len = 5;
  //push UART data to all connected telnet clients
  for (i = 0; i < MAX_SRV_CLIENTS; i++) {

    serverClients[i].write(&a, len);
    Serial.println(a);
    delay(100);
    delay(1);

  }
  // Serial.println(a);
  Serial.println("End");
  //  count++;

}
devyte commented 6 years ago

@hemangjoshi37a you are reading the analog value as binary, and sending it directly as binary to the clients. Then, you are looking at it with Putty, who doesn't understand binary. Most likely what you need is to convert the analog value to String, then send the string over, along the lines of:

String astr(a);
serverClients[i].write(astr.c_str(), astr.length());

Please discuss further at a forum, this is an issue tracker, not a forum for requesting help for your code.

hemangjoshi37a commented 6 years ago

ohh my god I never thought that would be the case. Let me try and I will let you know.

hemangjoshi37a commented 6 years ago

@devyte Awesome .... It works just fine... Please let me know anytime if I can help you in anyway... Thank you...

alexgrauer commented 6 years ago

Hi All, sorry to revive this thread. Im getting the same exception, and the Decoder is returning me the following:

Decoding stack results
0x4020c432: String::String(char const*) at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/WString.cpp line 36
0x4020c4e6: String::operator=(String&&) at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/WString.cpp line 228
0x4020899b: SIM5320_SendToServer(unsigned char, unsigned short) at /Users/myuser/Downloads/NODEMCU_060818_2.0_GSM/NODEMCU_060818_2.0_GSM.ino line 1308
0x402013b6: timer1_attachInterrupt at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_timer.c line 51
0x401070a6: NODEMCU_External_Interrupt_Handle() at /Users/myuser/Downloads/NODEMCU_060818_2.0_GSM/NODEMCU_060818_2.0_GSM.ino line 607
0x40107588: interrupt_handler at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_wiring_digital.c line 135
0x40107572: interrupt_handler at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_wiring_digital.c line 131
0x40107134: onTimerISR() at /Users/myuser/Downloads/NODEMCU_060818_2.0_GSM/NODEMCU_060818_2.0_GSM.ino line 589
0x401074ec: interrupt_handler at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_wiring_digital.c line 113
0x40107360: timer1_isr_handler at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_timer.c line 33
0x401073a8: timer1_isr_handler at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_timer.c line 40
0x4020a01e: SPIClass::transferBytes_(unsigned char*, unsigned char*, unsigned char) at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/SPI/SPI.cpp line 458
0x4020a082: SPIClass::transferBytes_(unsigned char*, unsigned char*, unsigned char) at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/SPI/SPI.cpp line 476
0x40107360: timer1_isr_handler at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_timer.c line 33
0x4010020c: _umm_free at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/umm_malloc/umm_malloc.c line 1287
0x402013b6: timer1_attachInterrupt at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_timer.c line 51
0x401004d8: malloc at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/umm_malloc/umm_malloc.c line 1664
0x401004d8: malloc at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/umm_malloc/umm_malloc.c line 1664
0x40107360: timer1_isr_handler at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_timer.c line 33
0x401073a8: timer1_isr_handler at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_timer.c line 40
0x4020a7ab: spiRec() at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/SD/src/utility/Sd2Card.cpp line 52
0x4020a7ab: spiRec() at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/SD/src/utility/Sd2Card.cpp line 52
0x402013b6: timer1_attachInterrupt at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_timer.c line 51
0x401004d8: malloc at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/umm_malloc/umm_malloc.c line 1664
0x401004d8: malloc at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/umm_malloc/umm_malloc.c line 1664
0x40208f3c: loop() at /Users/myuser/Downloads/NODEMCU_060818_2.0_GSM/NODEMCU_060818_2.0_GSM.ino line 730
0x40208eeb: loop() at /Users/myuser/Downloads/NODEMCU_060818_2.0_GSM/NODEMCU_060818_2.0_GSM.ino line 718
0x4020d0a8: Print::write(unsigned char const*, unsigned int) at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/Print.cpp line 38
0x4020bee9: Print::write(char const*) at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/Print.h line 60
0x4020bee9: Print::write(char const*) at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/Print.h line 60
0x4020bd12: HardwareSerial::available() at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/HardwareSerial.cpp line 118
0x4020468a: NODEMCU_checkSerial() at /Users/myuser/Downloads/NODEMCU_060818_2.0_GSM/NODEMCU_060818_2.0_GSM.ino line 973
0x40204e70: NODEMCU_Software_Serial_Print_New_Data() at /Users/myuser/Downloads/NODEMCU_060818_2.0_GSM/NODEMCU_060818_2.0_GSM.ino line 970
0x4020920c: loop() at /Users/myuser/Downloads/NODEMCU_060818_2.0_GSM/NODEMCU_060818_2.0_GSM.ino line 855
0x4020bfcc: Print::print(char const*) at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/Print.cpp line 84
0x4020cc64: loop_wrapper() at /Users/myuser/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_main.cpp line 123

The code is running fine for more than 3 hours before it crashes. I don't really understand whats going on.

If anyone could help me, or point me to the right direction, that would be great. Thanks :)

d-a-v commented 6 years ago

This looks like OOM.

Please debug your application and open a fresh new issue if you happen to find a bug in the core.

alexgrauer commented 6 years ago

Thanks @d-a-v, and sorry for writing in a closed thread. It was the same exception I was getting so I thought it was ok to write here. ESP.getFreeHeap helped me find out that there's a function reducing the memory every time it runs (once a minute). I guess after 3 hours im running out of memory, and therefore crashing. Thanks very much

sandevid commented 5 years ago

How to fix this , i use nodeMCU

Error : Exception (28): epc1=0x4020a5d4 epc2=0x00000000 epc3=0x00000000 excvaddr=0x000001bb depc=0x00000000

stack>>>

ctx: cont sp: 3ffffd90 end: 3fffffc0 offset: 01a0 3fffff30: 3fffdad0 00000000 3ffeed38 4020261b
3fffff40: 000001bb 3ffeed44 3ffe8884 3ffeeedc
3fffff50: 000001bb 3ffeed44 3ffe8884 40204a42
3fffff60: 40207ec0 dca79a95 3ffeed44 40203cbf
3fffff70: 3fffdad0 3ffeee10 3ffeed38 402057f0
3fffff80: 3fffdad0 3ffeee10 3ffeee64 402025d5
3fffff90: 40207ec0 552ba8c0 feefeffe feefeffe
3fffffa0: feefeffe 00000000 3ffeeeac 40207550
3fffffb0: feefeffe feefeffe 3ffe8558 40100a0d
<<<stack<<<

ets Jan 8 2013,rst cause:2, boot mode:(1,6)

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

wdt reset

Source Code :

include

include

include

define LED 14 //D3

const char ssid = "Telegram"; const char password = "getupdate"; const char BotToken[] = "660345429:ACGlSKhCRMmgKHNJH4pG3ut_1R_66flenqQ";

WiFiClientSecure net_ssl; TelegramBot bot (BotToken, net_ssl);

void setup() { Serial.begin(115200); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); Serial.println(WiFi.localIP());

bot.begin();

pinMode(LED, OUTPUT); }

void loop() {

message m = bot.getUpdates();

if (m.text.equals("on")){
digitalWrite(LED, HIGH);
bot.sendMessage(m.chat_id, "The Led 1 is now ON");

}else if (m.text.equals("off")){
digitalWrite(LED, LOW);
bot.sendMessage(m.chat_id, "The Led 1 is now OFF"); } }`

  1. Board : NodeMCU 1.0 (ESP-12E Module)
  2. Upload Speed : 115200
  3. Flash Size : 4M (no-SPIFFS)
  4. Debug Port : Disabled
  5. Debug level : None
  6. IwIP Variant : v2 lower memoty
  7. VTables : Flash
  8. Exceptions : Disable
  9. Erase Flash : Only Sketch
  10. Port : COM4

Please help, I have searched everywhere but there is no right solution

ariehoffman commented 4 years ago

I am suck with the same problem- any idea?

Erik Hoffman

PanwarParamveer commented 4 years ago

ESP.eraseConfig(); <--- use this before begin WiFi.begin("", "");

joctorres13 commented 3 years ago

Try a different flash_mode on your platform.ini file, by default it is "qio". Try dout mode:

board_build.flash_mode = dout

Here are some references: platform options SPI flash modes

Kos-M commented 3 years ago

https://links2004.github.io/Arduino/dc/deb/md_esp8266_doc_exception_causes.html

Duc-Nguyen1404 commented 1 year ago

Hi All, Im having the same problem with my esp8266. The Decoder is returning me the following: 0x40216dfc: HardwareSerial::write(unsigned char const*, unsigned int) at C:\Users\DellHMD\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/HardwareSerial.h line 193 0x4020df0c: UtilsClass::calCRC(char const*) at C:\Users\DellHMD\Documents\Arduino\libraries\Firebase_Arduino_Client_Library_for_ESP8266_and_ESP32\src/FB_Utils.h line 1460 0x40210b40: Firebase_Signer::authChanged(fb_esp_cfg_t*, fb_esp_auth_signin_provider_t*) at C:\Users\DellHMD\Documents\Arduino\libraries\Firebase_Arduino_Client_Library_for_ESP8266_and_ESP32\src\signer\Signer.cpp line 228 0x40204ae8: MB_String::clear() at C:\Users\DellHMD\Documents\Arduino\libraries\Firebase_Arduino_Client_Library_for_ESP8266_and_ESP32\src/json/MB_String.h line 1155 0x40206cfc: Firebase_ESP_Client::begin(fb_esp_cfg_t*, fb_esp_auth_signin_provider_t*) at C:\Users\DellHMD\Documents\Arduino\libraries\Firebase_Arduino_Client_Library_for_ESP8266_and_ESP32\src/json/MB_String.h line 474 0x40216df0: HardwareSerial::write(unsigned char const*, unsigned int) at C:\Users\DellHMD\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/HardwareSerial.h line 193 0x40216dfc: HardwareSerial::write(unsigned char const*, unsigned int) at C:\Users\DellHMD\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/HardwareSerial.h line 193 0x40216df0: HardwareSerial::write(unsigned char const*, unsigned int) at C:\Users\DellHMD\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/HardwareSerial.h line 193 0x40217070: Print::write(char const*) at C:\Users\DellHMD\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h line 59 0x40217220: Print::println() at C:\Users\DellHMD\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266/Print.h line 57 0x40204eec: setup() at C:\Users\DellHMD\Desktop\notification_sender/notification_sender.ino line 105 0x40218364: loop_wrapper() at C:\Users\DellHMD\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\cores\esp8266\core_esp8266_main.cpp line 198 Sketch

#if defined(ESP32)
#include <WiFi.h>
#elif defined(ESP8266)
#include <ESP8266WiFi.h>
#endif

#include <Firebase_ESP_Client.h>

// Provide the token generation process info.
#include <addons/TokenHelper.h>

/* 1. Define the WiFi credentials */
#define WIFI_SSID "ssid_name"
#define WIFI_PASSWORD "password"

/** 2. Define the Service Account credentials (required for token generation)
 *
 * This information can be taken from the service account JSON file.
 *
 * To download service account file, from the Firebase console, goto project settings,
 * select "Service accounts" tab and click at "Generate new private key" button
 */
#define FIREBASE_PROJECT_ID "app-xe-bus"
#define FIREBASE_CLIENT_EMAIL "firebase-adminsdk-8gsww@app-xe-bus.iam.gserviceaccount.com"
const char PRIVATE_KEY[] PROGMEM = "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC8H6UhmX17wlbg\nHAk5etx1osB4dgwu57IbmtQSRV6PXX02rLVyoCiSHHlC9Z26KIdFiVqyJw/d/W1m\n37jV5B+rWL8QGns7vSKnqAScgEaIx4m6zQSK3C9bcVjjDi0o1vBUQ4V7QbofcLxF\nUuk4X+xOjLWf/nOtcg8rHQSO5shAjHxTkSXduOceHbj8GQcHZ/SWVMMoFB17xjn5\nqLINPidJEhTPMLneV8CfeIYTTrddTPNISxX12VZCnuHwkC6FixKQGKfc8UnAZb4r\n3v76KlJb5rxkGkoLtz/s6QHmLjanTWZgNueqhsejuy2TT/lVYVlzEME++G/0DJU4\nwbe25ieZAgMBAAECggEAAnccXV/bDp5MhXxTPJ8ZDiuXVRzK6mnGjOkPArxI/HJP\nsUHl0NOQzzVd+3F84yh5JAFO9csK61r7rjTxVvrkgATWNXpQshw3kjXioEBoFuPH\n23Gor78p7wtXDFwDsyd57R4YvOBEIE8EZe4ruJLn5bGfXFzjxtqZ9fPX5Z2C80w+\nMTJX23ImCRaOv84O5Y1bE0FbTqVOR19m6j0r53AoPokFAaOzvJUC3qr8F1BFPkv2\n/HsJSLAKGpzlrXP57DtCL0mOWxa3yTmxVbLZIlcNVdDpieZMt4PXrO6dSkd4dkiL\nKQH3kuwEkymSHJPeIs0BhC5kbJ/AUSj3Ri7GpmmbWQKBgQD+H90oH14SbBVuWvoJ\nDj87gik9H2FmTq/msLBB9WFxIPoY0W2bjqqGKjQnprFAN1qfJCSyO3Hws3yx2++v\nkdT8gZls3TFwlDmlOEV1Qc7DHSX+iKWWrs+XvqpmjaKHbotXTBp8w3Zr7C4/L7V1\nmVBI6sA/u+f+h737jAwwOFdI5QKBgQC9gxSzom7bew8L+XWfjHvZVmnaY7o9W5VS\nDPstY+dWnVvVpAcqvu9qi15GMOQ9/xWqgD/lU172rZZAqykaSdoHlg0Sw9BHrWVP\niEla3ZyWfO2L4sHeSrRUowFJDuRj7klN28kt+oLSTHJ4NM+1Klz66mjeAsnQ4mky\n18Q8Euy8pQKBgHjBX2//Z85NOenUpVfEQ1vdwAbhcIETBxcSAs908La3OuCsM+9l\nXbafO2VUGoovQ4q3vBBNmxkL0UcbAcxl+dV7KBLJEQM0DChskuTjPoMMyM8o07bE\nnrS2z3Yn+4FrkB8NdNCweQdTla5E129oSPQ9SNmASv9yNV7g77HCNAfZAoGBALv6\nvNseYRYGb7tx+7GCGQtRQvhkecUJBgl4ZOH2Oe9ZcVFuPcmx0Sv/CElZj9zLHMOe\nKUMhOo43S1XkMYYpAUMLHPajEwM2RMrqJdEjB4LicoKSL7l+onddpRXB1twk7cN0\nIo8f8QoG2HjR8cIDPm2JfPHTFDrFipHrInRwVTEdAoGBAKuoZ6YPsAhAscf3PeT6\n7xrbwZvnF8AWLqRK7rpJ1hHnWzM8R52reTiatu3eZ4sINhQto4WFOMQG8FoBydCx\nn+DBPf7cVfJHQJMlvV2j96FM5Vz6DG6I4HEpDUo0tQhAgjS1N0iSi5LFXfRlf1ny\nXli/mExyC0YteQLlFkx1vkoC\n-----END PRIVATE KEY-----\n";

/* 3. Define the ID token for client or device to send the message */
#define DEVICE_REGISTRATION_ID_TOKEN "cDzjpZjfTU-YfaFec27k5b:APA91bGgujvPlsCy4LzFUYgpSSaqP1m9DOM3TxtvfouHDtBmwHu-tnUIfmN9CESGtPa3NtaGt6mZqqhLoFgAHX13FKojx9YU-xbSenN4km4833_dXgCCZR0ojPhpGrKdPA3TvvG0QT_u"

//Define the user Email and password that alreadey registerd or added in your project */

/* 4. Define the Firebase Data object */
FirebaseData fbdo;

/* 5. Define the FirebaseAuth data for authentication data */
FirebaseAuth auth;

/* 6. Define the FirebaseConfig data for config data */
FirebaseConfig config;

unsigned long lastTime = 0;

int count = 0;

void sendMessage();

void setup()
{

    Serial.begin(115200);

    WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
    Serial.print("Connecting to Wi-Fi");
    while (WiFi.status() != WL_CONNECTED)
    {
        Serial.print(".");
        delay(300);
    }
    Serial.println();
    Serial.print("Connected with IP: ");
    Serial.println(WiFi.localIP());
    Serial.println();

    Serial.printf("Firebase Client v%s\n\n", FIREBASE_CLIENT_VERSION);
    /* Assign the user sign in credentials */

    /* Assign the sevice account credentials and private key (required) */
    config.service_account.data.client_email = FIREBASE_CLIENT_EMAIL;
    config.service_account.data.project_id = FIREBASE_PROJECT_ID;
    config.service_account.data.private_key = PRIVATE_KEY;
    /* Assign the callback function for the long running token generation task */
    config.token_status_callback = tokenStatusCallback; // see addons/TokenHelper.h

    Firebase.begin(&config, &auth);           //Problem HERE

    Firebase.reconnectWiFi(true);
}

void loop()
{

    // Firebase.ready() should be called repeatedly to handle authentication tasks.

    if (Firebase.ready() && (millis() - lastTime > 60 * 1000 || lastTime == 0))
    {
        lastTime = millis();

        sendMessage();
    }
}

void sendMessage()
{

    Serial.print("Send Firebase Cloud Messaging... ");

    // Read more details about HTTP v1 API here https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages
    FCM_HTTPv1_JSON_Message msg;

    msg.token = DEVICE_REGISTRATION_ID_TOKEN;

    msg.notification.body = "Notification body";
    msg.notification.title = "Notification title";

    // For the usage of FirebaseJson, see examples/FirebaseJson/BasicUsage/Create.ino
    FirebaseJson payload;

    // all data key-values should be string
    payload.add("temp", "28");
    payload.add("unit", "celsius");
    payload.add("timestamp", "1609815454");
    msg.data = payload.raw();

    if (Firebase.FCM.send(&fbdo, &msg)) // send message to recipient
        Serial.printf("ok\n%s\n\n", Firebase.FCM.payload(&fbdo).c_str());
    else
        Serial.println(fbdo.errorReason());

    count++;
}