-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Router connection: 50% failure (50% success) #234
Comments
I have no such problem here. What you describe is rather strange. The only time I have had issues like this is when I turn wifi on/off repeatedly while booted. Maybe your router has some sort of protection? |
I did the test again, both with ESP8266 and ESP32 ESP8266 connects every time, not a single glitch:
ESP32 connects only half the case
The board is only connected to the serial cable
My router is not supposed to know which board I am using :) Thanks for your help |
Are you using the latest version? I also had this problem before when using an Android phone as the access point (hot spot) but that seems to work now. |
Hrm, or rather not. It works as long as you do call ESP.restart() to reboot but when doing a hard reset, it still fails every second time. |
Thanks plerup, Edit: using latest version |
More testing using this sketch
just added ...
... to initial sketch. If I wait 5 seconds before rebooting (allow WiFi.disconnect), ESP32 will connect each time I think I remember ESP8266 had this beheaviour in the early development time Any thought ?? |
More testing using the WiFiClientEvents.ino ESP32 example
This was tried with two different routers
Now, if I only request a soft reset after connection
Board will connect each time
Same conclusion as plerup |
here is my log with the above sketch without wifi off and doing 3 resets
|
For me it also always works with my ASUS router but when using an Android phone as access point I get the same result as @kas2 |
@ me-no-dev Let me sum up my findings sofar:
There is definitely something different in my setup Do you have any added pullup/pulldown resistors ?? Thanks again for your help |
@kas2 are you saying that the "connect every other time" problem occurs regardless of the WiFi access point? I have not tried Android (I do not have one), but have no problems using my computer or iPhone as AP. |
@me-no-dev
I saw your comment in an other thread |
if you wrap a bit of tape, even one that is somewhat made for antenna shielding, you are changing te properties of it. Did they at least remove the shielding of the board around the antenna? If you look at how Espressif boards are made, the antenna is outside of the board. |
OK me-no-dev , I will consider my board as defective Thanks again for your help |
Please do not consider it defective so soon :) if it connects every other time, then the module on the board actually works. I wonder if you should maybe fill an issue over at espressif/esp-idf repo and see if core engineers will be able to decipher what is going wrong. You can forward to this conversation so they know what we have tried so far. |
@me-no-dev Same behaviour, no change :( |
More testing using the WiFiClientEvents.ino ESP32 example if I add "WiFi.begin()" in the "SYSTEM_EVENT_STA_DISCONNECTED" event:
The board will connect every time:
Here is ESP-IDF code for the event handler
I strongly suspect that the Arduino IDE issue is related to Please let me have your comments |
Up ;-) Please confirm that this simple sketch connects every time with your own board:
I tested with
Thanks |
@kas2 really sorry for not answering sooner. I think I got a clue on how to fix this now :) |
@kas2 please select the ESP32 dev board in ArduinoIDE and select debug level to "Verbose" then post the log from failed disconnect again. I tried all APs here at home and none gave me this issue. New connect should not be started in all cases, so let's figure out which one you end up in. |
@me-no-dev My current work around is to add WiFi.begin() in the event handler
|
Yes, but that would attempt reconnect at any disconnect reason (like if you want to disconnect it will connect again) |
This is the verbose log for two resets (official Espessif board)
Thanks for your help
|
Try the latest master please :) |
Thanks me-no-dev, it works :) using
versus
is definitly smarter, but... it's still looks like a work around ;) This is the new debug Log with fix applied:
Strangely enough, the board now apparently disconnects and reconnects each time Anycase, you solved the problem, thanks again me-no-dev |
I don't have access to that part of the source so I have no idea why it does not automatically reconnect on auth expiration. What I patched though will reconnect only in that case and not in cases where you want to actually disconnect ;) |
Hello, I have repeated problems connecting to my WIFI and this is my configuration: Scenario 1: DHCP
---> Result: sometimes connect OK, sometimes "Connecting to WIFI ..................[ infinite ]" Scenario 2: Fixed IP
---> Result: Other times: After fighting with the router and the code for several days, I found this issue and after reading it I decided to activate the "Core Debug Level --- Debug" and curiously after activating it the connection is always OK. I do not have enough knowledge to solve it, but I think the problem is that if the "Debug" level is not activated, the SYSTEM_EVENT_STA_DISCONNECTED event can never reach the WIFI_REASON_AUTH_EXPIRE reason in "WiFiGeneric.cpp" I would greatly appreciate a solution without having to activate Debug. On the other hand, why when using fixed IP this condition WL_CONNECTED is "true" if it is not actually connected? Greetings and thank you. |
please set the debug level in the board settings to verbose and run again. It should tell you what happened |
As I said: if I active debug everything goes OK. Only very occasionally fails in Debug mode and in those cases is because it crashes. I will check that I do not have any hardware problems. If I do not solve it I will ask again and try to explain myself better. Any suggestions for hardware check? Regards. |
I am using an ESP32 and espruino and see the exact same issue:
|
I'm having the same issue, currently working around it by timing out the initial connect and doing an ESP.restart() if it doesn't connect within a certain time. |
I'm having the same issue as well. I'm using the ESP32-WROOM module from Espressif. I also currently have to work around it by timing out the initial connect and doing an ESP.restart() if it doesn't connect within a certain time. |
@me-no-dev I suggest re-opening this issue, as I am still getting this problem. I am using the MH-ET LIVE MiniKit for ESP32, which uses the ESP-WROOM-32 as its base. I have the latest master of both the esp-idf and arduino-esp32 and I am using the arduino-esp32 as an idf component. My code: #include <Arduino.h>
#include <WiFi.h>
#include <HTTPClient.h>
#define USE_SERIAL Serial
void setup() {
USE_SERIAL.begin(115200);
USE_SERIAL.println();
USE_SERIAL.println();
USE_SERIAL.println();
for(uint8_t t = 4; t > 0; t--) {
USE_SERIAL.printf("[SETUP] WAIT %d...\n", t);
USE_SERIAL.flush();
delay(1000);
}
WiFi.begin("ssid", "pwrd");
Serial.println(WiFi.getAutoReconnect());
wl_status_t status = WiFi.status();
while (status != WL_CONNECTED) {
Serial.print("Status: ");
Serial.println(status);
delay(500);
status = WiFi.status();
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
} This works exactly every other time. Here is the verbose output when it fails:
And when it succeeds:
|
I had same problem. It was connecting to Wifi once and failed the next time and then worked and then failed. I was unplugging usb cable or hard resetting with button. I then enabled 'core debug level' to verbose and it started working each time. I then went back to 'core debug level' to none and now it works each time. This is clearly not a fix but may provide some information to find root cause. hardware: ADAFRUIT HUZZAH32 – ESP32 FEATHER BOARD Happy to run more tests if that helps. |
We just gave up and accepted it as a fact of life for now. Just built-in a restart when it fails to connect every other time. It works but it’s not right.
…Sent from my iPhone
On Jan 21, 2018, at 3:12 PM, Gaston Dombiak ***@***.***> wrote:
I had same problem. It was connecting to Wifi once and failed the next time and then worked and then failed. I was unplugging usb cable or hard resetting with button.
I then enabled 'core debug level' to verbose and it started working each time. I then went back to 'core debug level' to none and now it works each time. This is clearly not a fix but may provide some information to find root cause.
hardware: ADAFRUIT HUZZAH32 – ESP32 FEATHER BOARD
framework: Arduino (had esp-idf before)
app: was using example ESP32 -> Time --> SimpleTest
Happy to run more tests if that helps.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@gdombiak My core debug level is verbose and I still have the issue, are you sure your didn't change anything else? It doesn't make sense that the debug level fixes it, and especially that it stays fixed. |
FYI this hack
causes some auth failures (using waitformconnectionresult) to return It also runs forever until mode is changed this might be better at least for now
unless this reason is being sent wrongly from sdk... For example on my IOS hotspot, wrong password throws AUTH_EXPIRE |
This is an ugly workaround for the issue where every other attempt to connect to a wifi network fails. This patch just tries tries to connect for a second time if the first time fails. Workaround for: espressif/arduino-esp32#234
* Enable FreeRTOS Trace Facility * Enable more statistics
Hi,
I use this standard sketch to connect to Internet
ESP8266 connects after each reboot
ESP32 only connects exactly half the case:
Any clue ??
Thanks
The text was updated successfully, but these errors were encountered: