← index #5261Issue #5326
Related · high · value 1.863
QUERY · ISSUE

ESP8266 stuck in network.STAT_CONNECTING although connected

openby kevinkk525opened 2019-10-26updated 2019-10-27
port-esp8266

Somehow between multiple soft resets I was able to get the esp8266 stuck in a state where sta.isconnect() returns False and s.status() returns network.STAT_CONNECTING forever.
However it was perfectly connected and I could use the webrepl.
Only a disconnect followed by a connect fixed that.

I know that without a reproducable testcase this issue might be worthless, in which case feel free to close it. But maybe someone familiar with the esp8266 network code can see a possibility for this to happen now that he has the information.

(Well I can "reproduce" it by doing multiple resets in a wdt interrupt routine and repl reconnects but I can't provide a real testcase at the moment)

CANDIDATE · ISSUE

ESP32 never reaches status()==network.STAT_NO_AP_FOUND

closedby goatchurchprimeopened 2019-11-12updated 2023-11-10
port-esp32

This issue was originally reported as micropython-mqtt/issues/34 when I discovered an inconsistent behavour between the ESP8266 and the ESP32.

Basically, when you call network.WLAN.connect() for a wifi access point that is not active the status() function on the ESP8266 gives network.STAT_NO_AP_FOUND after a certain number of seconds when it is clear the access point is not available, while the ESP32 sticks on network.STAT_CONNECTING forever.

>>> import network, time
>>> w = network.WLAN()
[junk omitted]
>>> w.active(1)
>>> w.connect("BV6000", "password")
>>> time.sleep(60)   # give it a minute
... [lots of the following message]
I (108937) wifi: STA_DISCONNECTED, reason:201
no AP found
>>> w.status(), network.STAT_CONNECTING, network.STAT_NO_AP_FOUND 
(1000, 1001, 201)    # <--- ESP32 case
(3,1,3)       # <--- ESP8266 case

Note that the unsolicited green error messages on the command line include "reason:201", so the condition is must be known; it's just not getting through.

Here's the same code as above, but without the outputs so it is easier to cut-and-paste onto the command line and reproduce the issue.

import network, time
w = network.WLAN()
w.active(1)
w.connect("BV6000", "password")
print(w.status())
time.sleep(60)   # give it a minute
w.status(), network.STAT_CONNECTING, network.STAT_NO_AP_FOUND 

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied