WiPy broadcasts AP when in STA mode



  • Problem
    When connecting to a WiFi in STA mode the WiPy sometimes broadcasts its own AP for some time.

    Reproducing the issue
    I use just basic example code to reproduce the issue, however this behavior seems to be non-deterministic. Sometimes the AP appears, sometimes it doesn't.

    from network import WLAN
    import machine
    
    wlan = WLAN(mode=WLAN.STA)
    wlan.connect("**SSID**", auth=(WLAN.WPA2, "**PW**"), timeout=5000)
    
    while True:  
        machine.idle()
    

    Discussion
    I searched the github issues and forums and found this report:
    https://github.com/espressif/arduino-esp32/issues/1718
    It is in the arduino section but sounds very similar to the behavior I'm experiencing.

    Can anybody confirm this issue? Any ideas how to fix it or where the apparent bug might be located and what would be the best place to ask?



  • @jcaron
    Thank you very much for your reply. Turning off WiFi on boot seems to fix the issue. Apparently it was related to the PyCom starting in AP mode for telnet.



  • Is it actually broadcasting after you switch to STA mode, or do you just see it in "available networks" lists on other devices? If the latter, those usually have a cache and keep displaying a network after the last received advertisement.

    You may want to use pycom.wifi_on_boot(false);. This way the firmware won't configure Wi-Fi as an AP before you switch to STA. Note that you will probably need to start Server yourself if you need it.



Pycom on Twitter