WiFiNINA returns reasonCode 204 which doesn't exist

I'm trying to connect my Arduino Uno WiFi Rev 2 with my Network which has both 2,4 and 5 GHz, but I can only connect sometimes. I modified the default connect code from the WiFiNINA examples to also send the status- and reason code with Serial.

My code:

while (status != WL_CONNECTED) {
        Serial.print("Attempting to connect to SSID: ");
        Serial.println(ssid);

        status = WiFi.begin(ssid, pass);

        Serial.print("Statuscodes: ");
        Serial.print(status);
        Serial.print(" ");
        Serial.println(WiFi.reasonCode());
    }

Sometimes the Arduino directly connects with status 3 and reason 0.
But other times it randomly disconnects while connecting (status 6) and returns 2 different reason codes. Sometimes the reason code is 8, which means "Disassociated because sending station is leaving (or has left) basic service set (BSS)", but most of the time the reason code is 204 - which doesn't even exist. (Looking at this list)

So.. what does 204 mean and how can I reliably connect to the wifi?

The ESP doc lists the reason codes

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/wifi.html#wi-fi-reason-code

The ones above 200 are espressif specific

204 HANDSHAKE_TIMEOUT
Espressif-specific Wi-Fi reason-code: the handshake fails for the same reason as that in WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT.

Thank you. I somehow didn't find the list you linked..

Do you know, how I might be able to fix this issue?

I’ve seen either WIFI_REASON_AUTH_FAIL or WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT when you enter an invalid password. Otherwise no idea…

Sometimes the arduino does connect. So it can't be an invalid password. :thinking:
Aparently the arduino is too slow for the handshake.. I'll try to fix this somehow.

yeah - more likely a network timeout somewhere

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.