[GH-ISSUE #329] Crash when using WiFiManagerParameter #274

Closed
opened 2026-02-28 01:24:27 +03:00 by kerem · 8 comments
Owner

Originally created by @daniftodi on GitHub (Mar 5, 2017).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/329

Hi,

When using WiFiManager with custom parameters, when connecting to AP and trying to access configuration page, my devices restarts ( ESP-12-F ), here is the serial output:

*WM: BM29
*WM: -93
 
Exception (28):
epc1=0x4000bf64 epc2=0x00000000 epc3=0x00000000 excvaddr=0x0000014d depc=0x00000000
 
ctx: cont
sp: 3ffefe10 end: 3fff01a0 offset: 01a0

BM29 is the last Wifi network indentified by WiFiManager and I think before this, custom parameters are rendered.

Here is the source code that I'm using:

    char mqtt_server[40] = "mqtt server";
    char mqtt_port[6] = "8080";
    char mqtt_topic[63] = "mqtt/topic";

    WiFiManagerParameter custom_mqtt_server("server", "mqtt server", mqtt_server, 40);
    WiFiManagerParameter custom_mqtt_port("port", "mqtt port", mqtt_port, 6);
    WiFiManagerParameter custom_mqtt_topic("topic", "mqtt topic", mqtt_topic, 63);

    wifiManager.addParameter(&custom_mqtt_server);
    wifiManager.addParameter(&custom_mqtt_port);
    wifiManager.addParameter(&custom_mqtt_topic);
    wifiManager.setSaveConfigCallback(saveConfigCallback);
    if(!this->wifiManager.autoConnect(WIFI_SSID, WIFI_PASS)){
      ESP.reset();
      delay(5000);
    }

Help me please figure what is wrong with my code and what should I do.

Originally created by @daniftodi on GitHub (Mar 5, 2017). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/329 Hi, When using WiFiManager with custom parameters, when connecting to AP and trying to access configuration page, my devices restarts ( ESP-12-F ), here is the serial output: ``` *WM: BM29 *WM: -93   Exception (28): epc1=0x4000bf64 epc2=0x00000000 epc3=0x00000000 excvaddr=0x0000014d depc=0x00000000   ctx: cont sp: 3ffefe10 end: 3fff01a0 offset: 01a0 ``` BM29 is the last Wifi network indentified by WiFiManager and I think before this, custom parameters are rendered. Here is the source code that I'm using: ``` char mqtt_server[40] = "mqtt server"; char mqtt_port[6] = "8080"; char mqtt_topic[63] = "mqtt/topic"; WiFiManagerParameter custom_mqtt_server("server", "mqtt server", mqtt_server, 40); WiFiManagerParameter custom_mqtt_port("port", "mqtt port", mqtt_port, 6); WiFiManagerParameter custom_mqtt_topic("topic", "mqtt topic", mqtt_topic, 63); wifiManager.addParameter(&custom_mqtt_server); wifiManager.addParameter(&custom_mqtt_port); wifiManager.addParameter(&custom_mqtt_topic); wifiManager.setSaveConfigCallback(saveConfigCallback); if(!this->wifiManager.autoConnect(WIFI_SSID, WIFI_PASS)){ ESP.reset(); delay(5000); } ``` Help me please figure what is wrong with my code and what should I do.
kerem closed this issue 2026-02-28 01:24:27 +03:00
Author
Owner

@rkoptev commented on GitHub (Sep 9, 2017):

Having the same issue.
Here is my code:

  // Configure Wi-Fi manager portal and start it
  WiFiManagerParameter custom_device_id("device_id", "Device ID", device_id, PARAM_SIZE_DEVICE_ID);
  WiFiManagerParameter custom_oauth_token("oauth_token", "Oauth token", oauth_token, PARAM_SIZE_OAUTH_TOKEN);
  wifiManager.addParameter(&custom_device_id);
  wifiManager.addParameter(&custom_oauth_token);
  wifiManager.setSaveConfigCallback(saveConfigCallback);
  wifiManager.autoConnect(WIFI_AP_NAME);

It lloks like WiFiManagr consumes too much RAM:

Fatal exception 29(StoreProhibitedCause):
epc1=0x4000e1c3, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000018, depc=0x00000000

Exception (29):
epc1=0x4000e1c3 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000018 depc=0x00000000

ctx: sys
sp: 3ffffc80 end: 3fffffb0 offset: 01a0

stack>>>
3ffffe20: ffffff80 3ffef190 00000000 00000001
3ffffe30: 4021dc5d 4021db9a 3fff2dbc e0031035
3ffffe40: 00000018 3ffefb40 3ffefabc 00000000
3ffffe50: 4021dcf8 3ff20a00 3fff2dbc 3ffecc7e
3ffffe60: 3ffecc64 0000000e 00000000 3ffecc64
3ffffe70: 3ffecc7e 0000002c 00000008 401004f4
3ffffe80: 3ffecc6e 3fff3344 4021aa4f 3ff20a00
3ffffe90: 3fff2dbc 3fff4e54 00000015 4021a921
3ffffea0: 402113a1 00000030 0000001a ffffffff
3ffffeb0: 40211393 3fff13b0 40211418 3fffd9d0
3ffffec0: 00000000 00000000 00000000 fffffffe
3ffffed0: ffffffff 3fffc6fc 00000001 3fff13b0
3ffffee0: 00000000 3fffdad0 3fff13a8 00000030
3ffffef0: 00000000 3fffdad0 3fff13a8 00000030
3fffff00: 401068c4 00000000 00000007 401004d8
3fffff10: 40221eb9 ffffffa7 00000000 00000000
3fffff20: 4021a1b9 3ffecc64 3ffef190 3fff2dbc
3fffff30: 00000000 3ffecc6e 3ffecc84 3ffeb534
3fffff40: 40215624 00000000 3ffecc6e 3ffecc64
3fffff50: 00000058 3ffeb534 3fff3344 3ffecc58
3fffff60: 00000000 00000007 40215256 3ffef190
3fffff70: 3ffecc58 3fffdcc0 3ffeb7f8 3fff3064
3fffff80: 3ffecc74 00000040 00000000 3fff13b0
3fffff90: 40214ba3 3fffdab0 00000000 402113a7
3fffffa0: 3ffeb7f8 40000f49 3fffdab0 40000f49
<<<stack<<<

Here is the output from ESP exception decoder:
Decoding 19 results
0x4021dc5d: wpa_receive at ?? line ?
0x4021db9a: wpa_receive at ?? line ?
0x4021dcf8: wpa_receive at ?? line ?
0x401004f4: calloc at C:\Users\Ruslan\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266\umm_malloc/umm_malloc.c line 1684
0x4021aa4f: chm_end_op at ?? line ?
0x4021a921: chm_init at ?? line ?
0x402113a1: esf_buf_setup at ?? line ?
0x40211393: esf_buf_setup at ?? line ?
0x40211418: esf_buf_setup at ?? line ?
0x401068c4: __divsf3_aux at d:\ivan\projects\arduinoesp\toolchain\dl\gcc-xtensa\build-2\xtensa-lx106-elf\libgcc/../../../libgcc/config/xtensa/ieee754-sf.S line 915
0x401004d8: malloc at C:\Users\Ruslan\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266\umm_malloc/umm_malloc.c line 1664
0x40221eb9: rijndaelEncrypt at ?? line ?
0x4021a1b9: sta_input at ?? line ?
0x40215624: ieee80211_setup_basic_htrates at ?? line ?
0x40215256: ieee80211_ht_node_cleanup at ?? line ?
0x40214ba3: hostap_input at ?? line ?
0x402113a7: esf_buf_setup at ?? line ?

<!-- gh-comment-id:328273492 --> @rkoptev commented on GitHub (Sep 9, 2017): Having the same issue. Here is my code: ``` // Configure Wi-Fi manager portal and start it WiFiManagerParameter custom_device_id("device_id", "Device ID", device_id, PARAM_SIZE_DEVICE_ID); WiFiManagerParameter custom_oauth_token("oauth_token", "Oauth token", oauth_token, PARAM_SIZE_OAUTH_TOKEN); wifiManager.addParameter(&custom_device_id); wifiManager.addParameter(&custom_oauth_token); wifiManager.setSaveConfigCallback(saveConfigCallback); wifiManager.autoConnect(WIFI_AP_NAME); ``` It lloks like WiFiManagr consumes too much RAM: Fatal exception 29(StoreProhibitedCause): epc1=0x4000e1c3, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000018, depc=0x00000000 Exception (29): epc1=0x4000e1c3 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000018 depc=0x00000000 ctx: sys sp: 3ffffc80 end: 3fffffb0 offset: 01a0 >>>stack>>> 3ffffe20: ffffff80 3ffef190 00000000 00000001 3ffffe30: 4021dc5d 4021db9a 3fff2dbc e0031035 3ffffe40: 00000018 3ffefb40 3ffefabc 00000000 3ffffe50: 4021dcf8 3ff20a00 3fff2dbc 3ffecc7e 3ffffe60: 3ffecc64 0000000e 00000000 3ffecc64 3ffffe70: 3ffecc7e 0000002c 00000008 401004f4 3ffffe80: 3ffecc6e 3fff3344 4021aa4f 3ff20a00 3ffffe90: 3fff2dbc 3fff4e54 00000015 4021a921 3ffffea0: 402113a1 00000030 0000001a ffffffff 3ffffeb0: 40211393 3fff13b0 40211418 3fffd9d0 3ffffec0: 00000000 00000000 00000000 fffffffe 3ffffed0: ffffffff 3fffc6fc 00000001 3fff13b0 3ffffee0: 00000000 3fffdad0 3fff13a8 00000030 3ffffef0: 00000000 3fffdad0 3fff13a8 00000030 3fffff00: 401068c4 00000000 00000007 401004d8 3fffff10: 40221eb9 ffffffa7 00000000 00000000 3fffff20: 4021a1b9 3ffecc64 3ffef190 3fff2dbc 3fffff30: 00000000 3ffecc6e 3ffecc84 3ffeb534 3fffff40: 40215624 00000000 3ffecc6e 3ffecc64 3fffff50: 00000058 3ffeb534 3fff3344 3ffecc58 3fffff60: 00000000 00000007 40215256 3ffef190 3fffff70: 3ffecc58 3fffdcc0 3ffeb7f8 3fff3064 3fffff80: 3ffecc74 00000040 00000000 3fff13b0 3fffff90: 40214ba3 3fffdab0 00000000 402113a7 3fffffa0: 3ffeb7f8 40000f49 3fffdab0 40000f49 <<<stack<<< Here is the output from ESP exception decoder: Decoding 19 results 0x4021dc5d: wpa_receive at ?? line ? 0x4021db9a: wpa_receive at ?? line ? 0x4021dcf8: wpa_receive at ?? line ? 0x401004f4: calloc at C:\Users\Ruslan\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266\umm_malloc/umm_malloc.c line 1684 0x4021aa4f: chm_end_op at ?? line ? 0x4021a921: chm_init at ?? line ? 0x402113a1: esf_buf_setup at ?? line ? 0x40211393: esf_buf_setup at ?? line ? 0x40211418: esf_buf_setup at ?? line ? 0x401068c4: __divsf3_aux at d:\ivan\projects\arduinoesp\toolchain\dl\gcc-xtensa\build-2\xtensa-lx106-elf\libgcc/../../../libgcc/config/xtensa/ieee754-sf.S line 915 0x401004d8: malloc at C:\Users\Ruslan\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266\umm_malloc/umm_malloc.c line 1664 0x40221eb9: rijndaelEncrypt at ?? line ? 0x4021a1b9: sta_input at ?? line ? 0x40215624: ieee80211_setup_basic_htrates at ?? line ? 0x40215256: ieee80211_ht_node_cleanup at ?? line ? 0x40214ba3: hostap_input at ?? line ? 0x402113a7: esf_buf_setup at ?? line ?
Author
Owner

@tablatronix commented on GitHub (Sep 9, 2017):

what branch ?
which esp core?

<!-- gh-comment-id:328276102 --> @tablatronix commented on GitHub (Sep 9, 2017): what branch ? which esp core?
Author
Owner

@rkoptev commented on GitHub (Sep 9, 2017):

I'm using ESP12E module from AI-Thinker. In Arduino IDE I selected NodeMCU 1.0(ESP-12E module)

What wifimanager branch or release?

<!-- gh-comment-id:328279756 --> @rkoptev commented on GitHub (Sep 9, 2017): I'm using ESP12E module from AI-Thinker. In Arduino IDE I selected NodeMCU 1.0(ESP-12E module) What wifimanager branch or release?
Author
Owner

@tablatronix commented on GitHub (Sep 9, 2017):

Oops I edited your post
What version branch of wifimanager?

<!-- gh-comment-id:328291076 --> @tablatronix commented on GitHub (Sep 9, 2017): Oops I edited your post What version branch of wifimanager?
Author
Owner

@rkoptev commented on GitHub (Sep 9, 2017):

As mentioned in library.properties file: version=0.12
Basically, the last version

<!-- gh-comment-id:328294887 --> @rkoptev commented on GitHub (Sep 9, 2017): As mentioned in library.properties file: version=0.12 Basically, the last version
Author
Owner

@tablatronix commented on GitHub (Sep 9, 2017):

Ok cause I think they all say the same
Making sure you are not using dev or kentaylor branch forks

Ill see if i can reproduce

<!-- gh-comment-id:328295257 --> @tablatronix commented on GitHub (Sep 9, 2017): Ok cause I think they all say the same Making sure you are not using dev or kentaylor branch forks Ill see if i can reproduce
Author
Owner

@rkoptev commented on GitHub (Sep 13, 2017):

It seems that I managed to make some progress in solving this problem. I began to disable the libraries in my sketch in turn. WiFiManager started working correctly after I disabled SoftwareSerial library that I use to recieve data from GPS sensor.

I assumed that the matter is in timers or interrupts. Perhaps interrupts that are used in esp SoftwareSerial library to get data from the sensor prevent the work of the WiFiManager. I analyzed this library, and found out that when creating an softserial object, constructor calls enableRx() method that calls this:
attachInterrupt(m_rxPin, ISRList[m_rxPin], m_invert ? RISING : FALLING);

I can not be sure, but it seems to me that this was the main problem. In any case, I managed to solve this problem by calling enableRx(0) before starting WiFiManager.

<!-- gh-comment-id:329112904 --> @rkoptev commented on GitHub (Sep 13, 2017): It seems that I managed to make some progress in solving this problem. I began to disable the libraries in my sketch in turn. WiFiManager started working correctly after I disabled SoftwareSerial library that I use to recieve data from GPS sensor. I assumed that the matter is in timers or interrupts. Perhaps interrupts that are used in esp SoftwareSerial library to get data from the sensor prevent the work of the WiFiManager. I analyzed this library, and found out that when creating an softserial object, constructor calls enableRx() method that calls this: `attachInterrupt(m_rxPin, ISRList[m_rxPin], m_invert ? RISING : FALLING);` I can not be sure, but it seems to me that this was the main problem. In any case, I managed to solve this problem by calling enableRx(0) before starting WiFiManager.
Author
Owner

@tablatronix commented on GitHub (Sep 13, 2017):

Also make sure you are never doing work inside an interrupt, instead use flag states or some other way,

<!-- gh-comment-id:329165977 --> @tablatronix commented on GitHub (Sep 13, 2017): Also make sure you are never doing work inside an interrupt, instead use flag states or some other way,
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#274
No description provided.