-
-
Notifications
You must be signed in to change notification settings - Fork 220
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
crash on connect #110
Comments
Hi, I had the same issue. Not sure what is causing it but I managed to get round the issue by changing line 1020 to esp_wifi_scan_start returns -1 or ESP_FAIL so the error check fails. The API does not give any reasons why esp_wifi_scan_stat should return -1. The code ignores errors which works as a quick fix until something more meaningful comes along. MPC |
@MPC-BlackBox I tried that but my esp just started crashing after with some heap error |
The problem is that ESP_FAIL isn't a value that is documented for esp_wifi_scan_start. I'm wondering if this is something going on with 4.3 since noone ever reported this kind of issues and now I have two in a row. Also is the sourcecode for esp_wifi.h not public? I wanted to look at what esp_wifi_scan_start but I cannot find the definition anywhere! |
Also @perigoso just for context esp32-nixie-clock was last compiled on a 4.2 beta master from esp-idf and I can switch networks without issues. I'll have to update my repos and try to get this to crash on a dev board. Everytime esp-idf is updated it seems like something breaks... |
I also tried to look for the function and couldn't find anything, so it's hard to know what is really going for it to return -1. I know you made that project with 4.2 and intended to test with esp-idf 4.2beta1 and see if it works. |
Edited to remove since unrelated issue. |
@tonyp7 ok, the heap crash was indeed fixed on the master branch, but I am still unable to connect even with esp-idf |
@tonyp7 hey, have you had any time to try and reproduce this issue? I got around it for now by having the credentials hard-coded once, further reprograms work by fetching from memory as long as i don't erase flash. |
Found the reason for crash: Scan cannot be started when simultaneously trying to connect to station (esp_wifi_scan_start returns ESP_ERR_WIFI_STATE, which ESP_ERROR_CHECK doesn't handle well). I first tried to check additional flags (WIFI_MANAGER_REQUEST_STA_CONNECT_BIT and WIFI_MANAGER_REQUEST_RESTORE_STA_BIT) but I still got occasional race conditions, so I check for ESP_ERR_WIFI_STATE separately anyway and let ESP_ERROR_CHECK() handle the rest.
|
... Wait you mean the -1 reported by ESP_ERROR_CHECK is wrong? That's a great find! |
I think I had solved a similar issue a many months ago and I just briefly read through this thread and it seems to be a similar issue. I solved by adjusting based on the below:
There are two important bits there. First: I added the "WIFI_MANAGER_REQUEST_ORDER_CONNECT_STA_BIT", which I set under the "ORDER_CONNECT_STA" case and clear under the "EVENT_STA_DISCONNECTED" case. Second: I added ESP_ERROR_CHECK(esp_wifi_disconnect()); as per an Espressif recommendation I found somewhere (I can't remember where, it's been a very long time since solving this). I hope that relates to your issue and helps out - if not, my mistake! |
Tried the above changes and the wifi_manager reliability has improved alot. The only issue I get is errno 23. This persists for about 60 seconds then all is okay once errno 113 happens. Changes which are not shown above are:
wifi_manager.c: case WIFI_EVENT_STA_DISCONNECTED:
wifi_manager.c: case WM_ORDER_CONNECT_STA:
|
Thanks, @MPC-BlackBox. I've incorporated this into a patch at xobs@a0bc1bc for those of you who are maintaining your own forks now. |
Prerequisites
Description
I'm not sure if this is a bug, or just something i did wrong.
When the esp boots it goes to the wi-fi manager just fine, but when i try to add a connection it seems to crash, the culprit for the error seems to be
esp_wifi_scan_start(&scan_config, false)
at line 1020 (in master branch, 981 on the commit the project is using, but i have tried both versions without success), but I am not sure what to make from it.Steps to Reproduce
System Configuration
I am trying to use the code from esp32-nixie-clock (I know it's a different project but the problem seems to be the wi-fi manager), with custom hardware I made here, I don't see a reason to suspect hardware.
Log:
The text was updated successfully, but these errors were encountered: