Instability due to AP reconnection loops

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
User avatar
ernitron
Posts: 89
Joined: Fri Jun 03, 2016 5:53 pm
Location: The Netherlands

Instability due to AP reconnection loops

Post by ernitron » Wed Nov 23, 2016 4:59 pm

I think I have found a major source of instability in my applications. The problem is related to WiFi reconnections.

This is the test that leads to the problem:
1. Plug USB cable to the esp device and see the output from console (e.g. using picocom)
2. Get the device connected to your AP (suppose sid is YOURSSID) with sta_if.active(True) and sta_if.connect(ssid, pwd)
3. Disconnect the AP and reconnect after 1 minute and then after 5 minutes or more

You will se a loop of:

Code: Select all

scandone
no YOURSSID found, reconnect after 1s
reconnect
The device reconnects real slowly after few minutes of disconnection (<5 min).
If you keep the AP disconnected for more than 5 minutes the device hangs. I have seen some seldom (and inexplicable) resurrections and probably was a hard reboot. From the application pow it is stuck.

The lines above (correct me if I'm wrong) are debug lines from Espressif SDK and not from micropython. I guess it is the persistent behaviour of the SDK that we have discussed in other threads. The esp8266 tries to keep connected and waits 1 sec before retrying reconnection. Almost transparently to application and I guess also to micropython VM.

Now the even more upsetting part. I did the same test with NodeMCU software which does at the wifi level the same things of micropython I guess. The reconnection, even after 5 minutes is always ok and instantaneous.

I think this issue is also related to the following threads:
http://forum.micropython.org/viewtopic.php?f=16&t=2631 : probably using non stored credential to reconnect will be better as the reconnection will always be done from scratch

http://forum.micropython.org/viewtopic.php?f=16&t=2593 : this is the issue of stability of micropython vs esp8266 sdk.

What do you think? Can you make the same test at least on micropython+esp8266 to confirm the results?

Thanks

(*) All tests were done with WeMos D1 mini and micropython 1.8.6 (fresh build)

Post Reply