-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
2.2.0 Exception (3): #1997
Comments
And testing similar code ( a PR 157 on the wifimanager repo )
Decoding 30 results
0x40100255: _umm_free at AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\cores\esp8266\umm_malloc/umm_malloc.c line 1298
0x4010020c: _umm_free at AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\cores\esp8266\umm_malloc/umm_malloc.c line 1285
0x402441c0: bignum_exptmod at ?? line ?
0x4010068c: free at AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\cores\esp8266\umm_malloc/umm_malloc.c line 1731
0x40105b32: spi_flash_read at ?? line ?
0x401075c0: vPortFree at AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\cores\esp8266/heap.c line 18
0x40221a2a: wifi_param_save_protect_with_check at ?? line ?
0x402441c0: bignum_exptmod at ?? line ?
0x40221a47: wifi_param_save_protect_with_check at ?? line ?
0x40221aad: system_param_save_with_protect at ?? line ?
0x40221e9c: wifi_station_ap_number_set at ?? line ?
0x40221ff7: wifi_station_ap_number_set at ?? line ?
0x40222084: wifi_station_ap_number_set at ?? line ?
0x402220c0: wifi_station_set_config at ?? line ?
0x40202888: ESP8266WiFiSTAClass::disconnect(bool) at AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\libraries\ESP8266WiFi\src/ESP8266WiFiSTA.cpp line 505
0x4010053d: _umm_realloc at AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\cores\esp8266\umm_malloc/umm_malloc.c line 1489
: (inlined by) realloc at AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\cores\esp8266\umm_malloc/umm_malloc.c line 1707
0x4010053d: _umm_realloc at AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\cores\esp8266\umm_malloc/umm_malloc.c line 1489
: (inlined by) realloc at AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\cores\esp8266\umm_malloc/umm_malloc.c line 1707
0x40221712: wifi_get_opmode at ?? line ?
0x4022253b: wifi_station_get_connect_status at ?? line ?
0x40202990: ESP8266WiFiSTAClass::status() at AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\libraries\ESP8266WiFi\src/ESP8266WiFiSTA.cpp line 505
0x40209338: String::changeBuffer(unsigned int) at AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\cores\esp8266/WString.cpp line 519
0x402083bc: WiFiManager::startConfigPortal(char const*, char const*) at Documents\projects\arduino\sketches\libraries\WiFiManager/WiFiManager.cpp line 839
0x4010020c: _umm_free at AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\cores\esp8266\umm_malloc/umm_malloc.c line 1285
0x4010068c: free at AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\cores\esp8266\umm_malloc/umm_malloc.c line 1731
0x40208528: WiFiManager::startConfigPortal() at Documents\projects\arduino\sketches\libraries\WiFiManager/WiFiManager.cpp line 839
0x4020703f: WiFiManager::WiFiManager() at Documents\projects\arduino\sketches\libraries\WiFiManager/WiFiManager.cpp line 839
0x40201fc4: setup at Documents\projects\arduino\sketches\libraries\WiFiManager\examples\ConfigOnSwitch/ConfigOnSwitch.ino line 35
0x40209d90: loop_wrapper at AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\cores\esp8266/core_esp8266_main.cpp line 43
0x40100718: cont_norm at AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.2.0\cores\esp8266/cont.S line 109 |
I got the same exception with the program below:
Hopefully this helps in solving the issue. |
@marwijn you are missing |
@igrr Thanks a lot never realised I needed it. This fixes my problem. So the original problem is probably not related. |
I turned debugging on full
|
Seems like the same problems over and over #1856 #1699 #1675 can reproduce similar problem with that #1699 (comment) sketch, but my flash seems ok
|
I had to install esptool.py again and use it for erasing flash to fix this. It works for a second and then does this ( the checkflash sketch again )
|
Reproduced this, thanks for detailed report. Looks like an out-of-bound write in SDK code. Will dig deeper on Monday. |
@tablatronix tested WifiManager, found it to fail, provided the trace and @igrr was able to reproduce it. I believe this is the same problem that led me to finding WiFiManager flaky and which further led to @tablatronix provides a trace of my version failing as well but the memory corruption could have occurred when running tzapu/WiFiManager and still have been there when later testing with https://github.com/kentaylor/WiFiManager/. I haven't had my version fail during testing and the fix I think was calling WiFi.disconnect(true) before calling WiFi.begin(new SSID, new password) as shown at kentaylor/WiFiManager@3bb5fad#diff-bfe0a2d15de63f0ead6d59ff54dd518eR241 . I found that calling Wifi.begin(existing SSID, existing password) never failed but calling WiFi.begin(new SSID, new password) or WiFi.begin() will occasionally cause the ESP8266 to fail to connect to WiFi until rebooted and rarely put it into a state that requires reflashing to fix the corrupted memory. Usually rebooting was enough. It was never repeatable for me but the probability of failure did seem to depend on where it was up to in connecting to the access point. Most people hard code Wifi.begin(SSID, password) into their sketch so are effectively calling Wifi.begin(existing SSID, existing password) which never causes a problem. In this case the Espressif SDK functions wifi_station_set_config, wifi_station_set_config_current and wifi_station_connect are not called. See
The ESP8266 will autoconnect to WiFi at startup using the stored SSID and password. Currently if Wifi.begin(new SSID, new password) is called while already connecting to WiFi then wifi_station_set_config or wifi_station_set_config_current will be called at an indeterminate time in the WiFi connection sequence. Wifi.begin(new SSID, new password) and WiFi.begin() call the Espressif SDK function wifi_station_connect() when it is already connecting. Mostly it doesn't matter but it seems that if wifi_station_connect() is called when it is at a particular point in the WiFi connection process it causes problems. Therefore the solution for Arduino is to call wifi_station_disconnect() prior to calling wifi_station_set_config or wifi_station_set_config_current and to not call wifi_station_connect() when it is already connecting to WiFi. The problem is occurring because wifi_station_connect() is being called when it is not required and can be fixed in Arduino by only calling wifi_station_connect() when required. However, the Espressif SDK should also be modified so that calling wifi_station_connect() is never harmful even if called when not required. |
Another issue I referenced above had succesfully workaround by setting persistant to false avoiding the saves i am assuming. |
@tablatronix Yes, if persistent is false wifi_station_set_config_current is called which doesn't write data to flash according to @igrr in #1054. If persistent is true wifi_station_set_config is called which does write data to flash. So it seems setting persistent to false is likely to avoid corrupting the flash. But WiFi also fails sometimes for me when calling WiFi.begin() and persistent is irrelevant in that case. WiFi.begin() calls the Espressif SDK function wifi_station_connect() see
|
Okay, the issue in SDK code has been found and will be fixed in the next release. In the meantime I will push a workaround which prevents buffer overrun. |
I encountered this bug using version 2.3.0 of the esp8266 core with the Eclipse Arduino Plugin on an ESP-12 module (via Adafruit). I could not reproduce it on a Sparkfun Thing Dev. I noted the error when calling the I implemented the |
This sketch fixed my bricked devices. It writes NULL to the whole flash including wiping itself from flash, so it can only run once after uploading. I wiped the whole of flash because I didn't know where the WiFi credentials are stored. If I knew that I could read out that area and look at the nature of the corruption. I'm confused where @tablatronix says "so the corruption has nothing to do with wifi credentials flash probably". It must be corrupted flash because it persists over rebooting and uploading new sketches. I understood the effect of the buffer overrun to be writing stuff to flash from memory that is beyond the intended memory buffer. This can happen when you rely on identifying the end of a string by a NULL character and that NULL character has been overwritten. I guess the end of the SSID string and password string in flash is identified by a NULL character and the absence of that character means extra stuff is read in when loading the WiFi credentials from flash. When we overwrite the whole flash with NULLs we put that terminating NULL character back. This post and the previous contains a lot of speculation so I will not be surprised if someone points out where they are wrong. |
You said the wifi credentials delete function, i did not realize there was a full flash erase sketch. Either way credentials cant fix the problem only full erase. |
@engrziarehman you might be interested in this from the Espressif SDK 1.4
It isn't used by Arduino yet. |
Thank you for your reply! I had been thinking that this version of sdk is incorporated in arduino, it shows 1.5.4_16_05_20. If it is not, then yes! it may be! |
@igrr I noticed this workaround is still in master , was this not fixed in SDK yet? |
@igrr bump
|
If you are getting fatal error exception like this: Exception (3): then goto this link download the software and follow the procedure and erase the flash memory to solve the error. This does not solve fatal error that occurs due to your program but in case your device goes in such condition that it can’t be able to access program memory then it will work and try atleast one time to solve the problem. This is the procedure to hard reset the nodemcu ( https://www.youtube.com/watch?v=MHrm7axsImI&t=146s ) Step : Note : you can see your port no. into the device manager . |
@igrr , I saw a comment you made more than a year ago about (!!!!) about ICACHE_RAM_ATTR. I must say, I don't understan what to do with it or where to place it :-( I need som assistance for sure :-) My code below is quite a dirty one, and beside the crash problem I would like to put as muck of the web server code in the setup to aviod lagging the processor. The connection to the Wemos is made one time upon a start/restart. If I didn't give all the needed information, don't hestita to ask. `// Including the ESP8266 WiFi library #include <TimeLib.h> // Replace with your network details // Web Server on port 80 //OLED MicroOLED oled(PIN_RESET, DC_JUMPER); // I2C Example const int interruptPin = D7; // the number of the interrupt pin volatile unsigned long startTime = 0; // timer for interruptpin int countISR = 0; bool startUp = false; unsigned int temperature; // 22 - 88 ms //int LEDone = 31; /float levelRange[15] = {31.65,33.81,35.97,38.14,40.30,42.46,44.62,46.78,48.95,51.11,53.27,55.43,57.59,59.76}; //Level in [ms] WiFiClient client = server.available(); // only runs once on boot pinMode(interruptPin, INPUT); // Connecting to WiFi network //WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { // Starting the web server // Printing the ESP IP address if (client) //OLED } // runs over and over again //if (client) {
//}
} /*
/*
/*
/*
temperature = msTime[0]; /*
void ShowValuesOnDisplay()
//} void ReWriteScreen() |
Hi, I just read somewhere to test the I must be doing this wrong...? |
@rippe void Rising() => ICACHE_RAM_ATTR void Rising() |
@devyte, ooops, I'm so sorry... Don't use to post questions at all. Will do this in the future. Best regards Richard |
I'm still getting this problem after wiping settings through resetSettings or using arduino IDE to erase all flash: *WM: WiFi save *WM: Sent wifi save page *WM: Connecting to new AP *WM: Connecting as wifi client... *WM: Connection result: *WM: 3 Exception (3): epc1=0x4010010e epc2=0x00000000 epc3=0x00000000 excvaddr=0x40007221 depc=0x00000000 ctx: cont sp: 3fff1e00 end: 3fff2120 offset: 01a0 Decoding 13 results 0x40211601: Print::write(char const*) at C:\Users\username\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/Print.cpp line 87 0x4010020c: _umm_free at C:\Users\username\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266\umm_malloc/umm_malloc.c line 1291 0x40100690: free at C:\Users\username\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266\umm_malloc/umm_malloc.c line 1739 0x40211d18: String::~String() at C:\Users\username\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/WString.cpp line 545 0x40207224: onWifiPortalStart(WiFiManager*) at E:\_ARDUINO_\_INU DEVICES_\Temperature/Temperature.ino line 19 0x4020b971: Inu::init(String, String (*)(WiFiManager*)) at C:\Users\username\Documents\Arduino\libraries\inuLib/inuLib.cpp line 297 0x40209d20: dummyString(WiFiManager*) at C:\Users\username\Documents\Arduino\libraries\inuLib/inuLib.cpp line 297 0x40213cb0: std::_Function_base::_Base_manager ::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation) at c:\users\username\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2\xtensa-lx106-elf\include\c++\4.8.2/functional line 1934 0x40213c94: std::_Function_handler ::_M_invoke(std::_Any_data const&, WiFiManager*) at c:\users\username\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2\xtensa-lx106-elf\include\c++\4.8.2/functional line 2054 0x40211e3e: String::String(char const*) at C:\Users\username\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/WString.cpp line 545 0x40207376: setup at E:\_ARDUINO_\_INU DEVICES_\Temperature/Temperature.ino line 38 0x40212a3c: loop_wrapper at C:\Users\username\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/core_esp8266_main.cpp line 57 0x40100710: cont_norm at C:\Users\username\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\cores\esp8266/cont.S line 109 I don't get it when I update existing credentials though. |
I got exception when connecting to Wi-Fi that turned off =(
PLATFORM: Espressif 8266 > Espressif Generic ESP8266 ESP-01 1M |
For those still struggling with this issue in 2018, this did the trick: WiFi.persistent(false); source: http://blog.flynnmetrics.com/uncategorized/esp8266-exception-3/ |
THX! thank you so much! That's working! |
Wow this is old, Probably need to look at this again |
old yes, but helped me! Thanks, seinecle! |
It is strange. I have bare ESP8266MOD and ESP-12F (Huzzah dev board) and first one works and the other one doesn't. And it worked before (with less code I had before). Mode: AP Exception (3):
EDIT: |
@dzid26 can you try with latest git version of this core ? |
I had this error, among others. I succeeded with installing the older version of the ESP8266 board manager, 2.1.0 to be exact, and also chose a lower baud rate to flash it and it worked flawlessly after that. |
I got the same problem with my Di Mini Pro. FIX: I did it with upload speed 57600 but it should work with other speeds as well. |
Begin wifi after disconnecting, to solve a weird bug reported at - esp8266/Arduino#1997 (comment) - http://blog.flynnmetrics.com/uncategorized/esp8266-exception-3/
Begin wifi after disconnecting, to solve a weird bug reported at - esp8266/Arduino#1997 (comment) - http://blog.flynnmetrics.com/uncategorized/esp8266-exception-3/
I have run in to a similar issue with most of my esp8266 devices in my house. stack trace mostly points to pm_send_nullfunc, somthing with dhcp, wifi or dns. if i do a erase_flash with esptool.exe the problem seams to goes away. (i have done this with a few devices and they seem to be ok) But i have more than 70-80 devices in my house. They control everything. heatpumps, water heater, floor heating. ventilation, water valves and more. I recently changed my wifi to Unifi and with that i changed my ssid and password. That is when it all started. I have tried implementing ota firmware upload with kentaylor s sketch (https://github.com/kentaylor/EraseEsp8266Flash) Has there been any progress on this topic since it was started? i'm currently using espressif8266@4.0.1 arduino core v3.0.2 checkFlashCRC and checkFlashConfig returns true; i see in ESP.cpp that there is a function called rtcUserMemoryWrite. |
Basic Infos
Using wifimanager library, on credential save, I get exceptions
Hardware
Hardware: nodemcu v1 12e
Core Version: 2.2.0 stable
Description
Need help deciphering this stack
Settings in IDE
ide 1.6.8
Module: nodemcu v1 12e
Flash Size: 4MB/1MB
CPU Frequency: 80Mhz
Flash Mode: qio
Flash Frequency: 80Mhz
Upload Using: SERIAL
Reset Method: nodemcu
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: