glenn20/micropython-espnow-images

Can't connect to wifi with STA_IF

Closed this issue · 2 comments

When switching to your image: https://github.com/glenn20/micropython-espnow-images/blob/main/20220709_espnow-g20-v1.19.1-espnow-6-g44f65965b/firmware-esp32-GENERIC.bin
I can no longer connect to my wifi access point with the same code that is running fine with the esp32-20220618-v1.19.1.bin standard image.

I am not getting a lot of logs with this:

Trying to connect to meinwlan...
..................................................E (6576) wifi:Association refused temporarily, comeback time 1024 mSec
..................................................
Failed. Not Connected to: meinwlan

This is the code:

        self.wlan_sta = network.WLAN(network.STA_IF)
        self.wlan_sta.active(True)
        if self.wlan_sta.isconnected():
            return True
        print('Trying to connect to %s...' % self.ssid)
        self.wlan_sta.connect(self.ssid, self.password)
        for retry in range(100):
            connected = self.wlan_sta.isconnected()
            if connected:
                break
            time.sleep_ms(50)
            print('.', end='')
        if connected:
            print('\nConnected. Network config: ', self.wlan_sta.ifconfig())
        else:
            print('\nFailed. Not Connected to: ' + self.ssid)

BTW: It is also missing the umqtt library, but I added it manually.

I haven't been able to reproduce this - and I don't think this is related to anything in the espnow module PR (but mind open to the possibility). There are reports out there on the internet that this may be due to a bug in the ESP-IDF that is triggered in some circumstances (eg. maybe with some routers) when a device does not do a clean disconnect from the AP and tries to connect after restarting.

I've been waiting for a 1.20 release before building some new images. I might look into building some updated images soon using the most recent IDF versions (which may or may not include fixes for this problem).

You are right and I apologize - should have done more testing before. I have some identical ESP32 boards and had not actually tested with the default firmware on this exact board. It turns out the board is faulty and also does not work with default firmware.