However, it just continuously reports STAT_CONNECTING and it's only in the log output that I see that something is wrong - I continuously see:
Code: Select all
I (101375) wifi: STA_DISCONNECTED, reason:15
I (103435) wifi: STA_DISCONNECTED, reason:205
The following example demonstrates the issue:
Code: Select all
import network
ssid = "George Hawkins AC"
password = "My incorrect password"
sta = network.WLAN(network.STA_IF)
sta.active(True)
sta.connect(ssid, password)
status = -1
while not sta.isconnected():
new_status = sta.status()
if new_status != status:
status = new_status
print('Status', status)
print("Connected to {} with address {}".format(ssid, sta.ifconfig()[0]))
Here's the complete output from my REPL session:
Code: Select all
>>>
paste mode; Ctrl-C to cancel, Ctrl-D to finish
=== import network
===
=== ssid = "George Hawkins AC"
=== password = "My incorrect password"
===
=== sta = network.WLAN(network.STA_IF)
=== sta.active(True)
=== sta.connect(ssid, password)
===
=== status = -1
=== while not sta.isconnected():
=== new_status = sta.status()
=== if new_status != status:
=== status = new_status
=== print('Status', status)
===
=== print("Connected to {} with address {}".format(ssid, sta.ifconfig()[0]))
I (68420) wifi: wifi driver task: 3ffd2bcc, prio:23, stack:3584, core=0
I (83795) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (83805) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (83825) wifi: wifi firmware version: 10f4364
I (83825) wifi: config NVS flash: enabled
I (83825) wifi: config nano formating: disabled
I (83835) wifi: Init dynamic tx buffer num: 32
I (83835) wifi: Init data frame dynamic rx buffer num: 32
I (83845) wifi: Init management frame dynamic rx buffer num: 32
I (83845) wifi: Init management short buffer num: 32
I (83855) wifi: Init static rx buffer size: 1600
I (83855) wifi: Init static rx buffer num: 10
I (83855) wifi: Init dynamic rx buffer num: 32
I (83955) phy: phy_version: 4102, 2fa7a43, Jul 15 2019, 13:06:06, 0, 0
I (83955) wifi: mode : sta (a4:cf:12:62:12:24)
True
I (83955) wifi: STA_START
Status 1001
I (84085) wifi: new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1
I (84925) wifi: state: init -> auth (b0)
I (84935) wifi: state: auth -> assoc (0)
I (84945) wifi: state: assoc -> run (10)
I (88955) wifi: state: run -> init (2c0)
I (88955) wifi: new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1
I (88955) wifi: new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1
I (88955) wifi: STA_DISCONNECTED, reason:15
I (91015) wifi: STA_DISCONNECTED, reason:205
I (91135) wifi: new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1
I (91135) wifi: state: init -> auth (b0)
I (91145) wifi: state: auth -> assoc (0)
I (91155) wifi: state: assoc -> run (10)
I (95155) wifi: state: run -> init (2c0)
I (95155) wifi: new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1
I (95155) wifi: new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1
I (95165) wifi: STA_DISCONNECTED, reason:15
I (97225) wifi: STA_DISCONNECTED, reason:205
...