简体   繁体   中英

ESP8266 (Adafruit Huzzah) disconnects immediately from WiFi, STA disconnect: 203

I have a PM sensor, made for the initiative "sensor community", outside the window, attached to an ESP8266 which connected to a repeater that repeats my home network. Yesterday morning I noticed that suddenly it wasn't publishing the values anymore.

Today I reflashed the board, which is an Adafruit Huzzah with an ESP8266 on board, with the basic example WiFiClientBasic from the ESP82666 library switching on the serial debug of the WiFi.

    void setup() {
        Serial.begin(115200);
        // We start by connecting to a WiFi network
        WiFi.mode(WIFI_STA);
        WiFiMulti.addAP(ssid, password);
        Serial.println();
        Serial.println();
        Serial.print("Wait for WiFi... ");
        while (WiFiMulti.run() != WL_CONNECTED) {
            Serial.print(".");
            delay(500);
        }
        Serial.println("");
        Serial.println("WiFi connected");
        Serial.println("IP address: ");
        Serial.println(WiFi.localIP());
        delay(500);
    }

The debug yields continuously this error:

[WIFI] Connecting BSSID: SSID: Channel: 6 (-39)
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 0 (12)
wifi evt: 1
STA disconnect: 203
reconnect
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 0 (12)
wifi evt: 1
STA disconnect: 203
reconnect

Another ESP8266 board (a LOLIN Wemos) that had the same configuration refuses to connect. Other devices connected to the same network (my 2 laptops, an Android tablet, a Raspberry Pi) don't have any troubles.

The repeater has a DHCP running and has no problem in releasing IP to other devices. Assigning the ESP8266 a static IP, both on the board and/or on the repeater, has no effect.

I'm not a network expert, but those are the main configs of the repeater (a rather old Digicom REW300).

WLAN STATUS Infrastructure Client --- (Connected)
Signal Strenght 54%
Channel-Band 2.4GHz (G+N) channel 6
Rate 13Mbps (MCS1)
Encryption WPA2-PSK
Repeater Status
WLAN STATUS AP --- (Enabled)
Rate auto
Encryption WPA2-PSK

I also looked at the log on the repeater:

Mar 19 16:01:12 DIGICOM-REW300-Z01 user.warn kernel: wlan0-vxd: A wireless client is deauthenticated - "MAC address of the ESP8266"
Mar 19 16:01:13 DIGICOM-REW300-Z01 user.warn kernel: wlan0-vxd: A wireless client is deauthenticated - "MAC address of the ESP8266"
Mar 19 16:01:15 DIGICOM-REW300-Z01 user.warn kernel: wlan0-vxd: A wireless client is deauthenticated - "MAC address of the ESP8266"

I didn't change the settings of the repeater recently, however yesterday morning the ISP changed the main router with a newer one. I think that could be the problem, but anyway the ESP8266 isn't connecting directly to it (it's too far away) but to the repeater which didn't change at all. Moreover: if I take the ESP8266 inside, it can connect to the main router without any troubles. It seems that the combination of new router and old repeater caused the problem, and just only for the ESP8266s. The only thing that changed from the old router is that the new one has only band G+N only, while the old one had B+G+N, I don't think it matters anyway, as it can be connected directly, and the old repeater is B+G+N.

The official docs from Espressif says that error 203 is ASSOC_FAIL, which is a rather generic error.

Further test I did: if the repeater is tethered with my mobile, the ESP8266 connects. So:

ESP8266 to repeater to WAN (broken)
ESP8266 to WAN (OK)
ESP8266 to repeater to Mobile Phone to WAN (OK)

Maybe add these lines can help...

WiFi.setAutoReconnect(true);
WiFi.persistent(true);

Here an example with reconection and status connection

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM