firebase-arduino icon indicating copy to clipboard operation
firebase-arduino copied to clipboard

System does a watch dog reset and outputs a stack Exception (28) after iterating void loop() 100 times, irrespective of any delays added.

Open trelelelel02 opened this issue 5 years ago • 3 comments
trafficstars

I am trying to connect my ESP-12E NodeMCU v1.0 to a firebase realtime database, whose values are controlled by a simple app I created in MIT App inventor.

My code is quite simple, and I've searched everywhere for the solution but according to the stack my getString("FB"+Number).toInt() seems to be the issue but only on the 100th iteration of void loop. Below is my code and the error.

I am currently using the latest firebase-arduino library, and I'm using ArduinoJson v5 library. I've tried adding yield() around the line but it doesn't do anything.

Any suggestions?

CODE: `#include <ESP8266WiFi.h> // 1 #include <pgmspace.h> #include <FirebaseArduino.h> #define FIREBASE_HOST "XXXXXXXXXX" //Your Firebase Project URL goes here without "http:" , "" and "/" #define FIREBASE_AUTH "XXXXXXXXXXXXXXXXX"

const char* ssid = "XXXXXXXX";//type your ssid const char* password = "XXXXXXXXX";//type your password int i = 1; int rel; int relayPin [9] = {12345, 5, 4, 0, 2, 14, 12, 13, 15}; int previousVal [9] ; int count = 0;

WiFiServer ESPserver(9080);//Service Port void setup() { Serial.begin(115200); ESP.wdtDisable(); for (int i = 1; i < 9; ++i) { pinMode(relayPin[i], OUTPUT); digitalWrite(relayPin[i], HIGH); } // 20 Serial.println(); Serial.println(); Serial.print("Connecting to: "); Serial.println(ssid); WiFi.begin(ssid, password); Serial.println(); delay(5000); while (WiFi.status() != WL_CONNECTED) { delay(100);
Serial.print("*"); } Serial.println(""); Serial.println("WiFi connected"); ESPserver.begin(); Serial.println("Server started"); Serial.println("Connecting to Firebase Database ... "); Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH); Serial.println("Connected"); } void firebasereconnect() { Serial.println("Trying to reconnect"); Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH); }

void loop() { ++count; Serial.println(count); if ((i == 0) || (i == 9)) { i = 1; //50 }

String Number = String(i);

yield(); rel = Firebase.getString("FB" + Number).toInt(); yield();

if (rel == 1) { digitalWrite(relayPin[i], LOW); ++i; return; }

yield(); if (rel == 0) { digitalWrite(relayPin[i], HIGH); ++i; return; } }`

ERROR: `Exception (28): epc1=0x40210e10 epc2=0x00000000 epc3=0x00000000 excvaddr=0x028a02ac depc=0x00000000

stack>>>

ctx: cont sp: 3ffffaf0 end: 3fffffc0 offset: 01a0 3ffffc90: 00000001 00000003 3fff0700 40204440
3ffffca0: 3ffffcf0 3fffff70 3fff0700 40205310
3ffffcb0: 3fffdad0 3fffff70 3fffff20 40203d78
3ffffcc0: 3fffdad0 3ffffcf0 3ffffcf0 40202b38
3ffffcd0: 00000002 3fffff70 3fffff20 40202ba8
3ffffce0: 3fffdad0 3fffff70 3ffe8803 40203c48
3ffffcf0: 00220000 40103b3e 80fed640 40211530
3ffffd00: 00000000 a0000000 00000000 0000001c
3ffffd10: 00004000 00000000 00004000 00000000
3ffffd20: 3ffffe80 00000000 3ffffe80 40217f0a
3ffffd30: 0000a000 3ffffe23 3ffecd70 3ffed89c
3ffffd40: 40102940 00080000 40213cfd 00000001
3ffffd50: 3ffffe80 00000001 3ffffe80 40217f0a
3ffffd60: 3ffffde0 3ffffe22 3ffffd90 00000000
3ffffd70: 40102628 3fffc200 00000022 40217e40
3ffffd80: 3ffffe80 3ffffe22 3ffffde0 40213dfc
3ffffd90: 00000001 00000000 6000001c 3ffffeff
3ffffda0: 3ffe8300 00000000 0000000a 40256570
3ffffdb0: 3ffffe23 00000004 00000000 00000000
3ffffdc0: 00000038 0000007e 00000002 3ffe8ac5
3ffffdd0: 00000000 3ffe8ac4 3ffffe80 4021831b
3ffffde0: 00000000 ffffffff ffffffff 00000000
3ffffdf0: 00000001 00000001 40302064 00000100
3ffffe00: 40103873 00040000 00000000 00040000
3ffffe10: 00000200 40103870 00040000 00000030
3ffffe20: 0034d640 401027d7 3ffed640 017c6520
3ffffe30: 3ffe9d70 2c9f0300 00000000 3fffc278
3ffffe40: 3fffff10 3fffff00 0000000c 3ffe8300
3ffffe50: 00000001 00000009 00000001 ffffffff
3ffffe60: 40207083 00000030 0000001e 3ffeee88
3ffffe70: 0000000a 00000004 3fffff88 402144c8
3ffffe80: 3fffff31 00000000 7ffffffe ffff0208
3ffffe90: 3fffff30 7fffffff 00000001 3ffe8528
3ffffea0: 3ffeecc0 3fffdad0 3ffeee88 3ffeed58
3ffffeb0: 4020590c 3ffeed58 3ffffefd 40205918
3ffffec0: 4020590c 3ffeed58 3ffffefd 40205be1
3ffffed0: 00000031 0000000a 3ffffefc 40205cc5
3ffffee0: 00000001 3fffc6fc 3fffff10 3fffff00
3ffffef0: 00000008 00000001 3fffff88 40206288
3fffff00: 0000000a 00000004 00000000 00000002
3fffff10: 3ffffcf0 00000000 64657463 80feee88
3fffff20: 402114e0 3fff06fc 00000000 3ffeed20
3fffff30: 3fff0890 402114b8 00000001 00000000
3fffff40: 00000100 3ffeed20 3fffff00 3ffeee88
3fffff50: 80ffff88 3fffff88 3fffff7c 402067c5
3fffff60: 3fffdad0 00000000 3ffe8528 40201234
3fffff70: 00000030 3ffeecc4 81feed58 00344246
3fffff80: 00000000 83000000 00000034 4010017c
3fffff90: 81ffdad0 00000000 3ffeee48 4020705d
3fffffa0: 3fffdad0 00000000 3ffeee48 4020716c
3fffffb0: feefeffe feefeffe 3ffe8580 40100ddd
<<<stack<<<

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

load 0x4010f000, len 1384, room 16 tail 8 chksum 0x2d csum 0x2d v482516e3 ~ld ⸮cl s⸮ndph `

trelelelel02 avatar Jan 08 '20 17:01 trelelelel02

Me pasa igual

Damian-Mora avatar May 20 '20 13:05 Damian-Mora

I am trying to connect my ESP-12E NodeMCU v1.0 to a firebase realtime database, whose values are controlled by a simple app I created in MIT App inventor.

My code is quite simple, and I've searched everywhere for the solution but according to the stack my getString("FB"+Number).toInt() seems to be the issue but only on the 100th iteration of void loop. Below is my code and the error.

I am currently using the latest firebase-arduino library, and I'm using ArduinoJson v5 library. I've tried adding yield() around the line but it doesn't do anything.

Any suggestions?

CODE: `#include <ESP8266WiFi.h> // 1 #include <pgmspace.h> #include <FirebaseArduino.h> #define FIREBASE_HOST "XXXXXXXXXX" //Your Firebase Project URL goes here without "http:" , "" and "/" #define FIREBASE_AUTH "XXXXXXXXXXXXXXXXX"

const char* ssid = "XXXXXXXX";//type your ssid const char* password = "XXXXXXXXX";//type your password int i = 1; int rel; int relayPin [9] = {12345, 5, 4, 0, 2, 14, 12, 13, 15}; int previousVal [9] ; int count = 0;

WiFiServer ESPserver(9080);//Service Port void setup() { Serial.begin(115200); ESP.wdtDisable(); for (int i = 1; i < 9; ++i) { pinMode(relayPin[i], OUTPUT); digitalWrite(relayPin[i], HIGH); } // 20 Serial.println(); Serial.println(); Serial.print("Connecting to: "); Serial.println(ssid); WiFi.begin(ssid, password); Serial.println(); delay(5000); while (WiFi.status() != WL_CONNECTED) { delay(100); Serial.print("*"); } Serial.println(""); Serial.println("WiFi connected"); ESPserver.begin(); Serial.println("Server started"); Serial.println("Connecting to Firebase Database ... "); Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH); Serial.println("Connected"); } void firebasereconnect() { Serial.println("Trying to reconnect"); Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH); }

void loop() { ++count; Serial.println(count); if ((i == 0) || (i == 9)) { i = 1; //50 }

String Number = String(i);

yield(); rel = Firebase.getString("FB" + Number).toInt(); yield();

if (rel == 1) { digitalWrite(relayPin[i], LOW); ++i; return; }

yield(); if (rel == 0) { digitalWrite(relayPin[i], HIGH); ++i; return; } }`

ERROR: `Exception (28): epc1=0x40210e10 epc2=0x00000000 epc3=0x00000000 excvaddr=0x028a02ac depc=0x00000000

stack>>>

ctx: cont sp: 3ffffaf0 end: 3fffffc0 offset: 01a0 3ffffc90: 00000001 00000003 3fff0700 40204440 3ffffca0: 3ffffcf0 3fffff70 3fff0700 40205310 3ffffcb0: 3fffdad0 3fffff70 3fffff20 40203d78 3ffffcc0: 3fffdad0 3ffffcf0 3ffffcf0 40202b38 3ffffcd0: 00000002 3fffff70 3fffff20 40202ba8 3ffffce0: 3fffdad0 3fffff70 3ffe8803 40203c48 3ffffcf0: 00220000 40103b3e 80fed640 40211530 3ffffd00: 00000000 a0000000 00000000 0000001c 3ffffd10: 00004000 00000000 00004000 00000000 3ffffd20: 3ffffe80 00000000 3ffffe80 40217f0a 3ffffd30: 0000a000 3ffffe23 3ffecd70 3ffed89c 3ffffd40: 40102940 00080000 40213cfd 00000001 3ffffd50: 3ffffe80 00000001 3ffffe80 40217f0a 3ffffd60: 3ffffde0 3ffffe22 3ffffd90 00000000 3ffffd70: 40102628 3fffc200 00000022 40217e40 3ffffd80: 3ffffe80 3ffffe22 3ffffde0 40213dfc 3ffffd90: 00000001 00000000 6000001c 3ffffeff 3ffffda0: 3ffe8300 00000000 0000000a 40256570 3ffffdb0: 3ffffe23 00000004 00000000 00000000 3ffffdc0: 00000038 0000007e 00000002 3ffe8ac5 3ffffdd0: 00000000 3ffe8ac4 3ffffe80 4021831b 3ffffde0: 00000000 ffffffff ffffffff 00000000 3ffffdf0: 00000001 00000001 40302064 00000100 3ffffe00: 40103873 00040000 00000000 00040000 3ffffe10: 00000200 40103870 00040000 00000030 3ffffe20: 0034d640 401027d7 3ffed640 017c6520 3ffffe30: 3ffe9d70 2c9f0300 00000000 3fffc278 3ffffe40: 3fffff10 3fffff00 0000000c 3ffe8300 3ffffe50: 00000001 00000009 00000001 ffffffff 3ffffe60: 40207083 00000030 0000001e 3ffeee88 3ffffe70: 0000000a 00000004 3fffff88 402144c8 3ffffe80: 3fffff31 00000000 7ffffffe ffff0208 3ffffe90: 3fffff30 7fffffff 00000001 3ffe8528 3ffffea0: 3ffeecc0 3fffdad0 3ffeee88 3ffeed58 3ffffeb0: 4020590c 3ffeed58 3ffffefd 40205918 3ffffec0: 4020590c 3ffeed58 3ffffefd 40205be1 3ffffed0: 00000031 0000000a 3ffffefc 40205cc5 3ffffee0: 00000001 3fffc6fc 3fffff10 3fffff00 3ffffef0: 00000008 00000001 3fffff88 40206288 3fffff00: 0000000a 00000004 00000000 00000002 3fffff10: 3ffffcf0 00000000 64657463 80feee88 3fffff20: 402114e0 3fff06fc 00000000 3ffeed20 3fffff30: 3fff0890 402114b8 00000001 00000000 3fffff40: 00000100 3ffeed20 3fffff00 3ffeee88 3fffff50: 80ffff88 3fffff88 3fffff7c 402067c5 3fffff60: 3fffdad0 00000000 3ffe8528 40201234 3fffff70: 00000030 3ffeecc4 81feed58 00344246 3fffff80: 00000000 83000000 00000034 4010017c 3fffff90: 81ffdad0 00000000 3ffeee48 4020705d 3fffffa0: 3fffdad0 00000000 3ffeee48 4020716c 3fffffb0: feefeffe feefeffe 3ffe8580 40100ddd <<<stack<<<

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

load 0x4010f000, len 1384, room 16 tail 8 chksum 0x2d csum 0x2d v482516e3 ~ld ⸮cl �s⸮n�dph `

Try to add [ while { } ] loop instead of [ if { } ] loop. It will not solve the problem but you would not get any stack error for next 5 muinites or more.. and after the error the wifi will be connected quickly that no lag will be deected on your device... Hope this help you

Sakib6813 avatar Apr 10 '21 03:04 Sakib6813

I am trying to connect my ESP-12E NodeMCU v1.0 to a firebase realtime database, whose values are controlled by a simple app I created in MIT App inventor. My code is quite simple, and I've searched everywhere for the solution but according to the stack my getString("FB"+Number).toInt() seems to be the issue but only on the 100th iteration of void loop. Below is my code and the error. I am currently using the latest firebase-arduino library, and I'm using ArduinoJson v5 library. I've tried adding yield() around the line but it doesn't do anything. Any suggestions? CODE: #include <ESP8266WiFi.h> // 1 #include <pgmspace.h> #include <FirebaseArduino.h> #define FIREBASE_HOST "XXXXXXXXXX" //Your Firebase Project URL goes here without "http:" , "" and "/" #define FIREBASE_AUTH "XXXXXXXXXXXXXXXXX" const char* ssid = "XXXXXXXX";//type your ssid const char* password = "XXXXXXXXX";//type your password int i = 1; int rel; int relayPin [9] = {12345, 5, 4, 0, 2, 14, 12, 13, 15}; int previousVal [9] ; int count = 0; WiFiServer ESPserver(9080);//Service Port void setup() { Serial.begin(115200); ESP.wdtDisable(); for (int i = 1; i < 9; ++i) { pinMode(relayPin[i], OUTPUT); digitalWrite(relayPin[i], HIGH); } // 20 Serial.println(); Serial.println(); Serial.print("Connecting to: "); Serial.println(ssid); WiFi.begin(ssid, password); Serial.println(); delay(5000); while (WiFi.status() != WL_CONNECTED) { delay(100); Serial.print("*"); } Serial.println(""); Serial.println("WiFi connected"); ESPserver.begin(); Serial.println("Server started"); Serial.println("Connecting to Firebase Database ... "); Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH); Serial.println("Connected"); } void firebasereconnect() { Serial.println("Trying to reconnect"); Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH); } void loop() { ++count; Serial.println(count); if ((i == 0) || (i == 9)) { i = 1; //50 } String Number = String(i); yield(); rel = Firebase.getString("FB" + Number).toInt(); yield(); if (rel == 1) { digitalWrite(relayPin[i], LOW); ++i; return; } yield(); if (rel == 0) { digitalWrite(relayPin[i], HIGH); ++i; return; } } ERROR: `Exception (28): epc1=0x40210e10 epc2=0x00000000 epc3=0x00000000 excvaddr=0x028a02ac depc=0x00000000

stack>>>

ctx: cont sp: 3ffffaf0 end: 3fffffc0 offset: 01a0 3ffffc90: 00000001 00000003 3fff0700 40204440 3ffffca0: 3ffffcf0 3fffff70 3fff0700 40205310 3ffffcb0: 3fffdad0 3fffff70 3fffff20 40203d78 3ffffcc0: 3fffdad0 3ffffcf0 3ffffcf0 40202b38 3ffffcd0: 00000002 3fffff70 3fffff20 40202ba8 3ffffce0: 3fffdad0 3fffff70 3ffe8803 40203c48 3ffffcf0: 00220000 40103b3e 80fed640 40211530 3ffffd00: 00000000 a0000000 00000000 0000001c 3ffffd10: 00004000 00000000 00004000 00000000 3ffffd20: 3ffffe80 00000000 3ffffe80 40217f0a 3ffffd30: 0000a000 3ffffe23 3ffecd70 3ffed89c 3ffffd40: 40102940 00080000 40213cfd 00000001 3ffffd50: 3ffffe80 00000001 3ffffe80 40217f0a 3ffffd60: 3ffffde0 3ffffe22 3ffffd90 00000000 3ffffd70: 40102628 3fffc200 00000022 40217e40 3ffffd80: 3ffffe80 3ffffe22 3ffffde0 40213dfc 3ffffd90: 00000001 00000000 6000001c 3ffffeff 3ffffda0: 3ffe8300 00000000 0000000a 40256570 3ffffdb0: 3ffffe23 00000004 00000000 00000000 3ffffdc0: 00000038 0000007e 00000002 3ffe8ac5 3ffffdd0: 00000000 3ffe8ac4 3ffffe80 4021831b 3ffffde0: 00000000 ffffffff ffffffff 00000000 3ffffdf0: 00000001 00000001 40302064 00000100 3ffffe00: 40103873 00040000 00000000 00040000 3ffffe10: 00000200 40103870 00040000 00000030 3ffffe20: 0034d640 401027d7 3ffed640 017c6520 3ffffe30: 3ffe9d70 2c9f0300 00000000 3fffc278 3ffffe40: 3fffff10 3fffff00 0000000c 3ffe8300 3ffffe50: 00000001 00000009 00000001 ffffffff 3ffffe60: 40207083 00000030 0000001e 3ffeee88 3ffffe70: 0000000a 00000004 3fffff88 402144c8 3ffffe80: 3fffff31 00000000 7ffffffe ffff0208 3ffffe90: 3fffff30 7fffffff 00000001 3ffe8528 3ffffea0: 3ffeecc0 3fffdad0 3ffeee88 3ffeed58 3ffffeb0: 4020590c 3ffeed58 3ffffefd 40205918 3ffffec0: 4020590c 3ffeed58 3ffffefd 40205be1 3ffffed0: 00000031 0000000a 3ffffefc 40205cc5 3ffffee0: 00000001 3fffc6fc 3fffff10 3fffff00 3ffffef0: 00000008 00000001 3fffff88 40206288 3fffff00: 0000000a 00000004 00000000 00000002 3fffff10: 3ffffcf0 00000000 64657463 80feee88 3fffff20: 402114e0 3fff06fc 00000000 3ffeed20 3fffff30: 3fff0890 402114b8 00000001 00000000 3fffff40: 00000100 3ffeed20 3fffff00 3ffeee88 3fffff50: 80ffff88 3fffff88 3fffff7c 402067c5 3fffff60: 3fffdad0 00000000 3ffe8528 40201234 3fffff70: 00000030 3ffeecc4 81feed58 00344246 3fffff80: 00000000 83000000 00000034 4010017c 3fffff90: 81ffdad0 00000000 3ffeee48 4020705d 3fffffa0: 3fffdad0 00000000 3ffeee48 4020716c 3fffffb0: feefeffe feefeffe 3ffe8580 40100ddd <<<stack<<< ets Jan 8 2013,rst cause:2, boot mode:(3,6) load 0x4010f000, len 1384, room 16 tail 8 chksum 0x2d csum 0x2d v482516e3 ~ld ⸮cl �s⸮n�dph `

Try to add [ while { } ] loop instead of [ if { } ] loop. It will not solve the problem but you would not get any stack error for next 5 muinites or more.. and after the error the wifi will be connected quickly that no lag will be deected on your device... Hope this help you

sorry my fault... I tried you problem today. and it is solved now. Downgrade your ESP Board manager to 2.5.2 ( By this you will not get any error and no compiling error also )

Sakib6813 avatar Apr 10 '21 04:04 Sakib6813