-
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
Debug output says wifi connected, but WiFi.status() keeps returning 7 #9060
Comments
I've added a |
Ok I think the apparent inconsistency actually has an explanation. It seems that DHCP is taking forever. So that makes sense. The issue is why does DHCP take so long in the first place. I increased the timeout and still can't connect most of the times (sometimes it does). It's not an issue with the router, no other devices have problems connecting and the router is very close. |
Do you mean other esp8266 boards or simply other wifi-enabled devices?
WiFi connection status here means exactly that - either netif has IP, or does not. I suppose you could also try to set up static IP and check whether network layer is functional. There are several issues mentioning (e.g. #8950 (comment)) G mode as a solution, but so far I don't really see a pattern. Without being able to reproduce it is quite difficult to understand the issue here; is it something wrong with DHCP client, something incorrectly done in lwip1 <-> lwip2 layer, or something bad happening in lwip1 SDK itself, or the SDK WiFi driver is to blame. We simply don't know. |
Simply other wifi-enabled devices, such as smartphones, a tablet, and laptops. BTW I reproduced the issue with two distinct (but identical) ESP8266's .
Technicolor aghp. Unfortunately this is at my mother's home where I am only for a few days, far from where I live, so unless I can get a router of the same model for myself (which I'm willing to purchase if I can find it), I won't be able to do any further tests. |
I have changed the router's configuration from "b/g/n" to "b/g" (no changes on the client) and it's gone from almost never connecting to so far always successfully connecting several times in a row. It could be just a coincidence, as I had already observed the issue coming and going randomly. If it's not a coincidence, this, combined with the fact that WiFi.setPhyMode(WIFI_PHY_MODE_11G) has been reported to help, raises so many questions: 1It has been said that the ESP8266 only supports modes B and G, not N. If so, why on earth is there also a 2Certainly the ESP8266 knows that it only supports modes B and G, right? Certainly, whatever modes it supports, it tells the AP that during negotiation, right? So, there's no way the AP decides to use mode N (or whatever mode that the ESP doesn't support) and that prevents the connection from going well. Righty? 3Maybe, because of a bug, if you don't call
That seems weird: I would expect it to be unable to reach "connected with...". 4If 5Should |
1&2&3 ESP8266 for sure supports mode N. I have a lot running happily. The fact (suspicion) that there are some AP's trying to steer devices from 2.4N to 5G causing issues doesn't change that. AFAIK the dialog on connection is just the oposite. The AP informs about supported modes, the client (the ESP) chooses one. Recently added, you can get that information (supported modes) when scanning for wifis. Then you can pick one to connect. 4 AFAIK there is no WiFi.setPhyMode(WIFI_PHY_MODE_AUTO). I was looking for that. Lacking that, I simply cycle PhyMode. Each time I get a connection error or strange behaviour, I try the next mode. So a remote device settles on B, others on N, who cares. 5-Before |
One can also check and understand network packets exchange including DHCP from the ESP pov with the provided netdump library. |
Did you find a solution. A have a similar Isuee. All works fine, but sometimes neves connects until reset the router. |
Unfortunately, no. |
Hi, you can try to adjust the connection part of the code -
It waits for the esp8266 to connect to the wifi without the for loop, fixed a similar problem for me . |
This seems to happen randomly (but often) on some networks. I'm seeing this on a particular wifi network almost systematically (but not quite) while the same code on the same board had worked for ages on other networks.
This is my code (simplified):
Note where it says "Connected to ... channel 6": that's not from my println()s, that's some internal output.
It was able to connect once or twice on the very same network, which is working fine and the password is correct, obviously.
I'm reporting it here because there's internal debug output that says "connected" and yet
status()
is returningWL_DISCONNECTED
, so that's an inconsistency that is obviously in software. Either the debug output that says "connected" is bogus, orstatus()
is returning the wrong value (or it connects and immediately loses connection, and there's no debug output for that which would be a bug too - but that seems pretty unlikely).The text was updated successfully, but these errors were encountered: