-
Notifications
You must be signed in to change notification settings - Fork 7.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
WiFi.softAPIP() causes Core 0 panic'ed (InstrFetchProhibited) #2025
Comments
Please try decoding again. This is not a valid decode. |
Just tried again, (ESP32 DEV MODULE) same identic error. I attached my build files. Wat arduino version are you using? maybe the difference lies in the included toolchain.. |
I removed the call to Serial.println(WiFi.softAPIP()); and also to Serial.Begin(), and the system crash anyway. Edit: i run the test form an external powered HUB, just run the test powering directly from a LIPO, same results. |
getting a similar error:
Decoding backtrace results
|
Getting a similar error as well (with release 1.0.2). The call to soft AP succeeds then, when trying to connect to the AP from a separate device, the ESP32 crashes. From callstack, the ESP32 seems to be trying to handle incoming DHCP request from the external device.
Which decodes to:
|
FYI, my application is not exactly the same as the one in this thread as it is calling |
I can confirm that not calling WiFi.softAPConfig(ip, ip, netmask); does(can??) stop the reset upon WiFi connecting. It can however work perfectly with the call active, so there is something strange going on. In my case: |
I get the same error:
which decodes to:
Somehow this error does not occur when setting the flag Edit: I've captured the network traffic using Wireshark and the ESP reboots after the Client sent the DHCP request as response to the DHCP offer. |
very similar error...
translates to
ps: i have a |
Hi, rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) Free heap in esp32 (bytes): 311924 I (13860) wifi: n:1 1, o:1 0, ap:1 1, sta:255 255, prof:1 Backtrace: 0x00000000:0x3ffc5790 0x40153c07:0x3ffc5800 0x40159b2d:0x3ffc5850 0x4015f64e:0x3ffc5880 0x40151fb9:0x3ffc58a0 Rebooting... Parsed backtrace |
anyone tried this? #issuecomment-453956975. Just putting |
For me erasing the flash and setting |
I also got the same problem. When removing the
the problem goes away. Anyone know how to fix it or what the problem is? |
Invalid Gateway address, review IP protocol rules. Chuck. |
Ah, @stickbreaker I didn't see that one coming; thank's for the assist. I removed the code, however. Can you suggest me some materials from where I can master the concept of gateways, subnets, localIP and how I can play with these values in ESP32 / ESP8266? ( like can I use the local IP as the gateway ... and etc...) |
ipv4 is really simple:
With these rules everybody in the group(net) can both be identified and is unique. The Mask value is used to verify whether an address is part of the group(net) or exists in another group(net). The Mask is just a bit-wise "AND" filter. In your example mask=255.255.255.0 is also 0xFFFFFF00 this says that any member of this group(net) has to have the same first three octets (i.e. 192.168.1 ). IPAddress ip1,ip2,mask;
uint32_t test;
mask =IPAddress(255,255,255,0);
ip1 = IPAddress(192,168,1,23);
ip2 = IPAddress(192,168,2,23);
// are ip1 and ip2 members of the same group (subnet)?
if( (ip1 & mask) == (ip2 & mask)){
Serial.printf(" ip1(%s) and ip2(%s) are both members of subnet %s.",ip1.toString().c_str(), (),ip2.toString().c_str(), mask.toString().c_str());
}
else {
Serial.printf(" ip1(%s) and ip2(%s) are NOT members of subnet %s.",ip1.toString().c_str(), (),ip2.toString().c_str(), mask.toString().c_str());
}; The all-call(broadcast) address is the mask address AND 0xFFFFFFFF, so for your example 192.168.1.255. Address 0 of any group(subnet) is reserved(unused). The gateway address is the address of the computer (gatekeeper) through which to access any address outside this group. To access a computer outside this local network, the request is encapsulated into a packet addressed to the gateway. The gateway receives this packet, opens it up and reads the destination address, It then compares this destination to a routing table inside the gateway, finds either the exact network that contains the destination or the next higher gateway, repacks the request with the newly found destination, and sends the packet. In a simple home network, your "router" is the single gateway to the wider world. The standard home network uses one of of "C" class private networks. i.e 192.168.x.x usually 192.168.1.x. Which is usually masked down 192.168.1.0/8 (192.168.1.1 to 192.168.1.254) This allows 254 devices to communicate with each other. I would recommend actually spending some time learning TCP/IP Joe Casad has written a good reference TCP/IP in 24 Hours Chuck. |
@stickbreaker Wow that was very much insightful. Thank you for the head start. Some 5 years ago I used to read " Data Communications and Networking" Book by Behrouz A. Forouzan, however, this was the first time I was coming into practical sides of things. I will take it from here; thank you for your kind understanding and time. I will be here for a while with https://github.com/ThinkalVB/AirMesh |
I noticed that setting up a WIFI_AP or WIFI_AP_STA mode with a given SSID works fine the first time you flash the chip. The second time you flash it, there is an issue where a crash occurs any time a client tries to connect to it. I am not able to tell what is going on, but this patch below to WiFiAP.cpp works for me in softAP()
This unconditionally sets the config each time softAP() is called. This has no explanation as to why this fixes things. I can also confirm that setting Log level to 5 (CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE) avoids the problem too. In WifiGeneric.cpp This is the logging line that 'fixes everything'. If I comment out this log while set to VERBOSE, the crash comes back. If I put any log message at all in this event handler, in any location within the event handler, the issue goes away.
The below sketch is the bare minimum to reproduce this problem. Note that you have to upload the sketch twice before it will start to fail. It is just the CaptivePortal.ino sketch. Anyone else with this behavior see this pattern or can test with the below sketch?
|
The bug seems to get primed in WiFIGenericClass::mode(). Adding a small delay between espWiFiStart() and esp_wifi_set_mode() in WiFiGeneric.cpp gets the softAP() working reliably every time. The log message in _eventCallback was providing this delay, working around the issue. The below code snippet also works around this issue.
I don't think this is a fix, just posting observations. |
What you’re calling the all-call address is really the broadcast address. Probably better to call it what it is. I wrote a great white paper on supernetting and subnetting when I first got my mcse.
Sent from my iPhone Xs!
Charley Jones, PMP
… On Aug 4, 2019, at 8:38 AM, reapzor ***@***.***> wrote:
The bug seems to get primed in WiFIGenericClass::mode(). Adding a small delay between espWiFiStart() and esp_wifi_set_mode() in WiFiGeneric.cpp gets the softAP() working reliably every time. The log message in _eventCallback was providing this delay, working around the issue. The below code snippet also works around this issue.
bool WiFiGenericClass::mode(wifi_mode_t m)
{
wifi_mode_t cm = getMode();
if(cm == m) {
return true;
}
if(!cm && m){
if(!espWiFiStart(_persistent)){
return false;
}
} else if(cm && !m){
return espWiFiStop();
}
sleep(1); // Delay between espWiFiStart() and esp_wifi_set_mode()
esp_err_t err;
err = esp_wifi_set_mode(m);
if(err){
log_e("Could not set mode! %d", err);
return false;
}
return true;
}
I don't think this is a fix, just posting observations.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@reapzor Can you check the result of |
@reapzor Quite an interesting find. Spend hours troubleshooting an out of the blue panic error crash which kept happening after all was well. Came across your post, and realized that I had changed core debug level from Verbose to Error only. With verbose, board is holding up ok. |
Is this still happening in 1.0.3 where EEPROM was moved to NVS? |
@reapzor I noticed that there is something not right with handling and closing requests via captive portal, which I see that you are using. I removed the captive portal, and the crashes went away. In a related issue, requests weren't being handled correctly if a browser was left open, and/or a connection was dropped and reconnected, which is fixed with the latest builds of AsyncTCP and ESPAsyncWebServer. |
…reset after a client connected to the access point. espressif/arduino-esp32#2025 (comment) Additional force starting the wifi low level part, via setting the necessary wifi mode first.
It's a bit magic, but in my case, it is working as WiFi.softAP(ssid, password); |
Bug was reported by different users, this delay solved it. espressif/arduino-esp32#2025 (comment)
Hey Mr. Stale Bot. Nothing got fixed in the Esp32 code. Can we leave it open? AlphaLima put a workaround in some other code. The rest of us trying to use esp32 as an access point have this crash. |
Para poder indicar explícitamente la IP del softAP es necesario indicar WiFi.persistent(false) debido a un bug en el código IDF que de no incluirlo hace caer el sketch al momento de asignar una IP vía DHCP por el softAP. espressif/arduino-esp32#2025 espressif/arduino-esp32#2283
So we found a problem, identified a workaround, but didn't fix anything in the core and it's impacting lots of other users. Is there not a better solution here? |
@igrr please reopen this |
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future. |
Is there any real working solution for this issue? |
Have you tried WiFi.persistent(false); I have as this pretty near the front of any ESP8266 or ESP32 project's setup() function: Then I set WiFi client or access mode, and this seems not to leave stuff lying around in persistent storage. I can now create an access point just fine, and it no longer crashes when a client connects. |
Thank you! Based on your input the following sequence seems to work, but important task before upload the sketch:
With delay-timers I have to test what I can reduce without impact to functionality |
I was getting the same error. I can confirm that the above mentioned workaround helped me to make it work again. |
This workaround worked for me too, although I didn't have to flash my device, simply reuploading the sketch using the arduino ide was enough. It seems like the big secret is the 2000ms delay Code for the lost soul: #include <WiFi.h> /* Put IP Address details */ WebServer server(80); //Then put this inside your void setup() function: |
Have you tried to do the following
|
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions. |
This library has serious issues |
Struggled too with this issue, none of the tips above regarding the delay helped me. What did do the trick was to set the correct "FlashFreq" to 40Mhz. And I also reduced the CPUFreq from 240MHZ to 80mhz. Seems like its a lot more stable for mye now. |
I've got identical problem on the some board. After reading this thread, my solution was:
Vscode+Platformio. LOLIN32. No erasing flash.
Working part of the code:
|
Hardware:
Board: LOLIN32
Core Installation/update date: 2018/11/06
IDE name: Arduino IDE 1.8.7
Flash Frequency: 80Mhz
PSRAM enabled: no? (not sure what is this)
Upload Speed: 115200
Computer OS: Arch linux 64 bit
Description:
I want to write a little sketch that make the ESP32 (LOLIN32) run in AP mode, and get its slef-assigned IP so i can print it on the serial; I need it because later i want to implement a TCP server
Sketch: (leave the backquotes for code formatting)
Debug Messages:
i selected the ESP dev module and then set the core debug level to debug, unfortunately the exception does not change and seems it cant be decoded:
trying to decode return:
The text was updated successfully, but these errors were encountered: