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

Reconnecting in ESP8266 fails with exception #95

Closed
giannoug opened this issue Jan 28, 2018 · 1 comment
Closed

Reconnecting in ESP8266 fails with exception #95

giannoug opened this issue Jan 28, 2018 · 1 comment

Comments

@giannoug
Copy link

If WiFi is disconnected (long enough) an exception is thrown and the MCU halts. I'm not really sure if this is an issue with arduino-mqtt or the ESP8266 core for Arduino. I'm using a NodeMCU ESP-12 Development Kit V1.0 board.

In order to simulate the WiFi disconnect I used Android's "Mobile Hotspot" functionality and had ESP8266 connected on it. Then I could easily turn it on and off.

Steps to reproduce

  1. Upload AdafruitHuzzahESP8266 to an ESP8266
  2. Turn off the WiFi so ESP8266 tries to reconnect
  3. Wait for a couple of seconds
  4. Get exception through Serial monitor

Sample exception

Trace (through Serial)

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

ctx: cont 
sp: 3ffefd00 end: 3ffeffe0 offset: 01a0

>>>stack>>>
3ffefea0:  3ffeed3c 00000000 3fff0ebc 40203f3e  
3ffefeb0:  f0cd9a36 00000000 3ffe88b4 40204f38  
3ffefec0:  4010502c 00e7c89d 3ffeeda4 3ffeecf0  
3ffefed0:  3ffeef84 0000075b 3ffeed3c 40203b00  
3ffefee0:  3ffe8c38 f0cd9a36 3ffe8c38 f0cd9a36  
3ffefef0:  3ffe88e8 000003e8 000003e8 40204d41  
3ffeff00:  0000000f 3ffeec9c 3ffeec9c 4020335f  
3ffeff10:  3ffe0007 3ffe88c8 0001000a 3ffe0003  
3ffeff20:  3ffe88d0 3ffe0003 3ffe88d0 00000000  
3ffeff30:  3ffeed34 000003e8 3ffeeda4 00000000  
3ffeff40:  3ffe0007 3ffe88c8 0001000a 3ffe0003  
3ffeff50:  3ffe88d0 3ffe0003 3ffe88d0 3ffeefc0  
3ffeff60:  402021a6 0000000a 0000000a 3ffeefb0  
3ffeff70:  3fffdad0 00000000 3ffeec9c 40203524  
3ffeff80:  00000000 00000000 3ffe88fc 00000005  
3ffeff90:  000003e8 3ffe0003 3ffe88d0 40204380  
3ffeffa0:  00000000 00000000 3ffe88fc 00000005  
3ffeffb0:  00000000 00000000 00000001 40204b45  
3ffeffc0:  3fffdad0 00000000 3ffeefa8 40204b70  
3ffeffd0:  feefeffe feefeffe 3ffeefc0 40100710  
<<<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

Decoded (using me-no-dev/EspExceptionDecoder)

Decoding 12 results
0x40203f3e: WiFiClient::connect(IPAddress, unsigned short) at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\libraries\ESP8266WiFi\src/WiFiClient.cpp line 329
0x40204f38: Print::write(unsigned char const*, unsigned int) at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266/Print.cpp line 99
0x4010502c: ets_timer_arm_new at ?? line ?
0x40203b00: WiFiClient::connect(char const*, unsigned short) at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\libraries\ESP8266WiFi\src/WiFiClient.cpp line 329
0x40204d41: MQTTClient::connected() at C:\Users\user\Documents\Arduino\libraries\MQTT\src/MQTTClient.h line 327 (discriminator 1)
0x4020335f: MQTTClient::connect(char const*, char const*, char const*) at C:\Users\user\Documents\Arduino\libraries\MQTT\src/MQTTClient.h line 173
:  (inlined by) connect() at C:\Users\user\AppData\Local\Temp\arduino_modified_sketch_969978/AdafruitHuzzahESP8266.ino line 43
0x402021a6: delay at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266/core_esp8266_wiring.c line 54
0x40203524: loop at C:\Users\user\AppData\Local\Temp\arduino_modified_sketch_969978/AdafruitHuzzahESP8266.ino line 63
0x40204380: lwmqtt_arduino_timer_set(void*, unsigned int) at C:\Users\user\Documents\Arduino\libraries\MQTT\src/system.cpp line 11
0x40204b45: esp_schedule at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266/core_esp8266_main.cpp line 57
0x40204b70: loop_wrapper at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266/core_esp8266_main.cpp line 57
0x40100710: cont_norm at C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\cores\esp8266/cont.S line 109
@giannoug giannoug changed the title Reconnecting in ESP8266 fails Reconnecting in ESP8266 fails with exception Jan 28, 2018
@giannoug
Copy link
Author

Turned out to be a bug in the ESP8266 core! It's a known bug and a milestone for version 2.4.1. Setting LwIP variant to 1.4 Prebuild (Tools > lwIP Variant) eliminates the issue in the meantime.

More information: esp8266/Arduino#4078

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

No branches or pull requests

1 participant