zenkdev / SonoffBoilerplate

Custom Sonoff firmware (BLYNK, MQTT, HTTP)
MIT License
10 stars 2 forks source link

esp8266 prog crashed upon whatever connection established #2

Open croisez opened 6 years ago

croisez commented 6 years ago

However I connect to SonOff with this version of SonoffBoilerplate, the prog keeps crashing:

Did you encounter the same behavior?

Exception (3): epc1=0x4000bf64 epc2=0x00000000 epc3=0x00000000 excvaddr=0x4024f26f depc=0x00000000

ctx: cont sp: 3fff15d0 end: 3fff1960 offset: 01a0

stack>>> 3fff1770: 00000001 4024db23 3fff17ac 4020f9e8
3fff1780: 4024f26f 3fff02a0 3fff1840 4020fa10
3fff1790: 000007e2 00000001 3fff1840 40203659
3fff17a0: 00000000 00000000 00000000 3fff3c1c
3fff17b0: 0000000f 00000004 3fff374c 4020ac24
3fff17c0: 00000001 3fff02a0 3fff02f5 40206607
3fff17d0: 00000000 00000000 00000000 4023c589
3fff17e0: 3fff3c34 3fff1850 3fff1850 3ffe9b06
3fff17f0: 00000010 3fff1850 3fff1850 3fff0854
3fff1800: 00000010 3fff1890 00000000 4010053d
3fff1810: 3fff0854 00000356 00000356 3fff0854
3fff1820: 00000010 3fff18b0 00000000 4020ac24
3fff1830: 00000010 00000000 00000000 00000000
3fff1840: 3fff4024 000007ef 000007e2 4020f747
3fff1850: 3fff0854 00000346 00000346 4020ac24
3fff1860: 00000001 00000001 3fff374c 4021041a
3fff1870: 00000000 00000001 3fff374c 4020ac1a
3fff1880: 3fff374c 3fff2eac 3fff374c 4020ac56
3fff1890: 00000000 00000000 00000000 4020f8a8
3fff18a0: 3fff374c 3fff2eac 3fff2e6c 4020ace9
3fff18b0: 3fff3fe4 0000000f 00000001 40208e0c
3fff18c0: 3fff2eac 3fff18d0 00000008 00000001
3fff18d0: 00000001 4020a170 0000000f 0000007e
3fff18e0: 00000000 00000000 3fff2e6c 3fff0938
3fff18f0: 00000001 3fff2e90 3fff2e6c 4020ae73
3fff1900: 3ffe9470 00000000 000003e8 00028e17
3fff1910: 00000000 3fff3f04 3fff0350 4020621a
3fff1920: 3fffdad0 00000000 3fff0300 4020356a
3fff1930: 3fffdad0 00000000 3fff0300 402062c6
3fff1940: 3fffdad0 00000000 3fff0930 40210198
3fff1950: feefeffe feefeffe 3fff0940 40100718
<<<stack<<<

zenkdev commented 6 years ago

Hi. Sorry for the delay. You can try this firmware https://github.com/arendst/Sonoff-Tasmota. If the problem does not happen again, I'll try to fix my code. If the problem persists, most likely the problem is in the device.

zenkdev commented 6 years ago

Hi @croisez. I found the big and fixed it. Please download latest version and try.

croisez commented 6 years ago

cool! thx. Will try it asap

croisez commented 6 years ago

Hello, I tried with your latest version 3b14180 on my Sonoff basic. but it continues to crash when I connect my wifi to sonoff-wxyz access point for configuring wifi

WIF: Checking connection... WIF: Attempting connection... WIF: Sonoff-Tasmota Patch issue 2186 WIF: Connecting to AP1 WirelessNet in mode 11N as sonoff-3030... WIF: Checking connection... WIF: Attempting connection... WIF: Checking connection... WIF: Attempting connection... WIF: Checking connection... WIF: Attempting connection... WIF: Checking connection... WIF: Attempting connection... WIF: Checking connection... WIF: Attempting connection... WIF: Checking connection... WIF: Attempting connection... WIF: Checking connection... WIF: Connect failed as AP cannot be reached WIF: Sonoff-Tasmota Patch issue 2186 WIF: Connecting to AP2 WirelessNet2 in mode 11N as sonoff-3030... WIF: Checking connection... WIF: Attempting connection... WIF: Checking connection... WIF: Attempting connection... WIF: Checking connection... WIF: Attempting connection... WIF: Checking connection... WIF: Attempting connection... WIF: Checking connection... WIF: Attempting connection... WIF: Checking connection... WIF: Attempting connection...

WIF: Checking connection... WIF: Attempting connection... WIF: Checking connection... WIF: Connect failed as AP cannot be reached WIF: WifiManager active for 1 minute WIF: Wifimanager set AccessPoint HTP: Web server active on sonoff-3030 with IP address 192.168.4.1

Exception (3): epc1=0x4000bf64 epc2=0x00000000 epc3=0x00000000 excvaddr=0x4024f929 depc=0x00000000

ctx: cont sp: 3fff1560 end: 3fff19a0 offset: 01a0

stack>>> 3fff1700: 00000001 4024e020 3fff173c 4020fe58
3fff1710: 4024f929 3fff02e0 3fff1790 4020fe80
3fff1720: 00000ac5 00000001 3fff1790 40203707
3fff1730: 00000000 00000000 00000000 3fff23e4
3fff1740: 0000000f 00000004 00000000 3fff1760
3fff1750: 00000001 3fff02e0 00000000 40203f32
3fff1760: 00000000 00000000 00000000 00000000
3fff1770: 00000000 00000000 3fff17a0 4010068c
3fff1780: 3ffea958 401012f5 00000002 4020fb0c
3fff1790: 3fff40fc 00000acf 00000ac5 402069c0
3fff17a0: 00000000 00000000 00000000 4010020c
3fff17b0: 00000030 3fff40fc 3fff23e4 40100668
3fff17c0: 00000014 000001b8 00000037 4020b12c
3fff17d0: 00000001 3fff02e0 00000000 40207922
3fff17e0: 00000000 3ffe9b4e 3fff25bc 4020794c
3fff17f0: 00000010 00000001 3fff25bc 40206acb
3fff1800: 4023c9da 00000000 3fff1880 4023c9f1
3fff1810: 3fff3b7c 3fff1880 3fff1880 3ffe9b4e
3fff1820: 00000010 3fff1880 3fff1880 3fff0894
3fff1830: 00000010 3fff18c0 00000000 4010053d
3fff1840: 3fff0894 000003a5 000003a5 3fff0894
3fff1850: 00000010 3fff18e0 00000000 4020b12c
3fff1860: 00000010 3fff18c0 3fff18c0 4020fb68
3fff1870: 3fff3b2c 00000001 3fff18c0 4020fbb7
3fff1880: 3fff0894 00000037 00000037 4020b12c
3fff1890: 00000001 00000001 3fff25bc 4021088a
3fff18a0: 00000000 3fffdad0 3fff25bc 4020b122
3fff18b0: 3fff25bc 3fff2ecc 3fff25bc 4020b15e
3fff18c0: 00000000 00000000 00000000 4020fd18
3fff18d0: 3fff25bc 3fff2ecc 3fff2e8c 4020b1f1
3fff18e0: 3fff3b2c 0000000f 00000001 40209314
3fff18f0: 3fff2ecc 3fff2460 3fff0980 00000001
3fff1900: 00000001 4020a678 0000000a 3fff0980
3fff1910: 00000000 00000000 3fff2e8c 3fff0978
3fff1920: 00000001 3fff2eb0 3fff2e8c 4020b37b
3fff1930: 3fffdad0 00000000 3fff2444 4020c8f9
3fff1940: 3fffdad0 3fff0978 402105bc 3fff0980
3fff1950: 3fffdad0 00000000 3fff032c 4020360e
3fff1960: 3fff032a 00000000 3fff0970 4020688a
3fff1970: 00000000 00000000 00000001 3fff0978
3fff1980: 3fffdad0 00000000 3fff0970 40210608
3fff1990: feefeffe feefeffe 3fff0980 40100718
<<<stack<<<

ets Jan 8 2013,rst cause:1, boot mode:(3,7)

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

zenkdev commented 6 years ago

Hi. I couldn't reproduce this bug. You powen on sonoff, wait unlit led is blinking, when connect to wifi sonoff-xxxx and entered your network credentials. After clicking the save button, the device reboots. Did I understand correctly? Please decode you stack trace with the Esp exception decoder tool and send me becouse your stack on my computer not decoded perfectly.

croisez commented 6 years ago

hello. The crash occurs as soon as I connect to wifi sonoff-xxxx. I have not any time to enter my network credentials and save it. [edit] as soon as I am connected to Sonoff AP wifi, I suppose that macos opens a system browser window, containing the configuration web page from the Sonoff.

croisez commented 6 years ago

Hi, please find here under my stack trace:

Decoding 36 results 0x4024e020: init_cal_dcoffset at ?? line ? 0x4020fe58: Print::println(char const) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/Print.cpp line 205 0x4024f929: ram_rfcal_pwrctrl at ?? line ? 0x4020fe80: Print::printNumber(unsigned long, unsigned char) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/Print.cpp line 205 0x40203707: showPage(String&) at ?? line ? 0x40203f32: _Z10handleWifih$part$62 at SonoffBoilerplate.ino.cpp line ? 0x4010068c: free at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/umm_malloc/umm_malloc.c line 1722 0x401012f5: rcUpdateTxDone at ?? line ? 0x4020fb0c: IPAddress::IPAddress(unsigned int) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/IPAddress.cpp line 87 0x402069c0: _GLOBALsub_I__Z15blynk_dbg_printPKcz at /Users/lmc/SonoffBoilerplate/webserver.ino line 911 0x4010020c: _umm_free at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/umm_malloc/umm_malloc.c line 1291 0x40100668: _umm_realloc at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/umm_malloc/umm_malloc.c line 1634 : (inlined by) realloc at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/umm_malloc/umm_malloc.c line 1713 0x4020b12c: ESP8266WebServer::_responseCodeToString(int) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp line 214 0x40207922: String::operator+=(FlashStringHelper const) at /Users/lmc/SonoffBoilerplate/webserver.ino line 911 : (inlined by) handleSave at /Users/lmc/SonoffBoilerplate/webserver.ino line 816 0x4020794c: String::operator+=(__FlashStringHelper const) at /Users/lmc/SonoffBoilerplate/webserver.ino line 911 : (inlined by) handleSave at /Users/lmc/SonoffBoilerplate/webserver.ino line 819 0x40206acb: captivePortal() at /Users/lmc/SonoffBoilerplate/webserver.ino line 911 0x4023c9da: fpm_do_sleep at ?? line ? 0x4023c9f1: fpm_do_sleep at ?? line ? 0x4010053d: _umm_realloc at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/umm_malloc/umm_malloc.c line 1495 : (inlined by) realloc at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/umm_malloc/umm_malloc.c line 1713 0x4020b12c: ESP8266WebServer::_responseCodeToString(int) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp line 214 0x4020fb68: IPAddress::toString() const at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/IPAddress.cpp line 87 0x4020fbb7: MD5Builder::begin() at ?? line ? 0x4020b12c: ESP8266WebServer::_responseCodeToString(int) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp line 214 0x4021088a: String::operator=(String&&) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/WString.cpp line 545 0x4020b122: ESP8266WebServer::_responseCodeToString(int) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp line 214 0x4020b15e: ESP8266WebServer::_responseCodeToString(int) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp line 214 0x4020fd18: Print::printf(char const, ...) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/Print.cpp line 205 0x4020b1f1: ESP8266WebServer::_responseCodeToString(int) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp line 214 0x40209314: ClientContext::_connected(tcp_pcb, long) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/libraries/ESP8266WiFi/src/WiFiClient.cpp line 329 : (inlined by) ClientContext::_s_connected(void, tcp_pcb, long) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/libraries/ESP8266WiFi/src/include/ClientContext.h line 540 0x4020a678: PubSubClient::publish(char const, char const) at /Users/lmc/Dropbox/arduino/libraries/PubSubClient/src/PubSubClient.cpp line 588 0x4020b37b: ESP8266WebServer::_prepareHeader(String&, int, char const, unsigned int) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp line 214 0x4020c8f9: ESP8266WebServer::_parseRequest(WiFiClient&) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/libraries/ESP8266WebServer/src/Parsing.cpp line 169 0x402105bc: UpdaterClass::printError(Stream&) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/Updater.cpp line 393 0x4020360e: showPage(String&) at /Users/lmc/SonoffBoilerplate/webserver.ino line 911 0x4020688a: every_second() at /Users/lmc/SonoffBoilerplate/webserver.ino line 911 0x40210608: UpdaterClass::printError(Stream&) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/Updater.cpp line 398

zenkdev commented 6 years ago

Hi @croisez. I'm really has no ideas what is happening with your Sonoff. Can you send me a zip archive with your SonoffBoilerplate sketch folder?

croisez commented 6 years ago

SonoffBoilerplate.zip

zenkdev commented 6 years ago

I checked your sketch, it's fine. Please check the compiler settings in the tools menu in the Arduino IDE. they should look like the following: image

You can get more info here Arduino IDE

croisez commented 6 years ago

interesting to get accurate settings. For example, I was using Flash size 1M (64K SPIFFS). And lwIP Variant v2 and reset method ck. But even with your settings, I got a crash.

WIF: Connecting to AP2 ESPACE DEMO CETIC in mode 11N as sonoff-4189... WIF: Checking connection... WIF: Attempting connection... WIF: Checking connection... WIF: Attempting connection... WIF: Checking connection... WIF: Connected DNS: Initialized HTP: Web server active on sonoff-4189.local with IP address 10.16.2.187 MQT: disconnected with state -1 MQT: Attempting connection... MQT: Connect failed

Exception (3): epc1=0x4021319c epc2=0x00000000 epc3=0x00000000 excvaddr=0x402549ca depc=0x00000000

Decoding 28 results 0x402530b9: lwip_init at ?? line ? 0x402105bd: String::copy(char const, unsigned int) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/WString.cpp line 545 0x4021060a: String::String(char const) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/WString.cpp line 545 0x402549ca: lwip_init at ?? line ? 0x4021084c: String::String(__FlashStringHelper const) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/WString.cpp line 545 0x402034f3: showPage(String&) at /Users/lmc/SonoffBoilerplate/webserver.ino line 911 0x4020b468: FunctionRequestHandler::handle(ESP8266WebServer&, HTTPMethod, String) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp line 214 0x40206b57: handleRoot() at /Users/lmc/SonoffBoilerplate/webserver.ino line 911 0x4020b9c0: ESP8266WebServer::_parseArguments(String) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/libraries/ESP8266WebServer/src/Parsing.cpp line 278 0x4021058b: String::reserve(unsigned int) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/WString.cpp line 545 0x4010053d: _umm_realloc at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/umm_malloc/umm_malloc.c line 1495 : (inlined by) realloc at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/umm_malloc/umm_malloc.c line 1713 0x4020b468: FunctionRequestHandler::handle(ESP8266WebServer&, HTTPMethod, String) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp line 214 0x4021058b: String::reserve(unsigned int) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/WString.cpp line 545 0x4020b468: FunctionRequestHandler::handle(ESP8266WebServer&, HTTPMethod, String) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp line 214 0x402113a2: std::_Function_handler ::_M_invoke(std::_Any_data const&) at /Users/lmc/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/functional line 2073 0x4020b45e: std::function ::operator()() const at /Users/lmc/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/functional line 2331 0x4020b49a: FunctionRequestHandler::handle(ESP8266WebServer&, HTTPMethod, String) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp line 214 0x402106e8: String::String(String const&) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/WString.cpp line 545 0x4020b521: ESP8266WebServer::_handleRequest() at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp line 214 0x40209488: WiFiClient::~WiFiClient() at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/libraries/ESP8266WiFi/src/WiFiClient.cpp line 329 0x40209abc: WiFiServer::available(unsigned char) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/libraries/ESP8266WiFi/src/WiFiServer.cpp line 106 0x4020a8cc: FunctionRequestHandler::canHandle(HTTPMethod, String) at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp line 214 0x4020b678: ESP8266WebServer::handleClient() at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp line 214 0x402066e2: every_second() at /Users/lmc/SonoffBoilerplate/webserver.ino line 911 0x402033fa: pollDnsWeb() at /Users/lmc/SonoffBoilerplate/webserver.ino line 911 0x4020681a: loop at /Users/lmc/SonoffBoilerplate/webserver.ino line 911 0x40211040: loop_wrapper at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/core_esp8266_main.cpp line 57 0x40100710: cont_norm at /Users/lmc/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0/cores/esp8266/cont.S line 109