Skip to content

WiFi Association Failure with Multiple Error Codes (203, 205, etc.) on ESP32-S3 (IDFGH-17015) #18061

@mansteve159-oss

Description

@mansteve159-oss

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v5.3.4

Espressif SoC revision.

ESP32-S3

Operating System used.

Windows

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

PowerShell

Development Kit.

Custom Board (ESP32-S3)

Power Supply used.

External 3.3V

What is the expected behavior?

WiFi Connection Failure on ESP32-S3 with WPA2-PSK Network
Environment
Board: Custom ESP32-S3 board
ESP-IDF Version: v5.3.4
WiFi Mode: Station (STA)
Target AP: HUAWEI-Shum (WPA2-PSK, Channel 1, RSSI: -28dBm)
Network Configuration: Dynamic IP, Dynamic DNS
Problem Description
WiFi connection consistently fails after authentication/association with multiple error codes. The device successfully scans and finds the target AP with strong signal (-28dBm), but cannot establish a stable connection.

Observed Disconnection Error Codes
During extensive testing, the following WiFi disconnection reasons have been observed:

Error 2: Early beacon timeout / No AP found
Error 15: 4-Way handshake timeout
Error 201: Unspecified failure reason
Error 203: Association leave (most frequent)
Error 204: Disassociation due to inactivity
Error 205: Disassociation because AP is unable to handle all currently associated STAs (most frequent)
Error 206: Class 2 frame received from non-authenticated STA
The most common errors are 203 (Association leave) and 205 (AP capacity/handling issue), but the variety of error codes suggests unstable association behavior.

Observed Behavior
Connection Sequence

  1. Scan completes successfully - AP found with RSSI -28dBm
  2. WiFi state transitions: init -> auth -> assoc
  3. Connection fails during association phase
  4. Error 203: "Association leave" or Error 205: "Authentication timeout"
  5. Retry attempts also fail with same errors
    Sample Log
    I MAIN: Scanning for SSID: HUAWEI-Shum ...
    I wifi:mode : sta (d8:3b:da:46:c5:68)
    I wifi:enable tsf
    I MAIN: WiFi Scan Done
    I MAIN: Found: SSID=HUAWEI-Shum RSSI=-28 Ch=1 Auth=3
    I MAIN: BSSID: c2:bb:19:d4:b5:14
    I MAIN: === WiFi Connection Attempt ===
    I MAIN: SSID: [HUAWEI-Shum] BSSID_set: 1
    I MAIN: Starting connection...
    I wifi:new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1, snd_ch_cfg:0x0
    I wifi:state: init -> auth (0xb0)
    I wifi:state: auth -> assoc (0x0)
    I wifi:state: assoc -> init (0x2c0)
    I wifi:new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1, snd_ch_cfg:0x0
    E MAIN: WiFi Disconnected. Reason: 203
    I MAIN: Retrying connection (1/5)...
    E MAIN: WiFi Disconnected. Reason: 205
    I MAIN: Retrying connection (2/5)...
    I wifi:new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1, snd_ch_cfg:0x0
    I wifi:state: init -> auth (0xb0)
    I wifi:state: auth -> assoc (0x0)
    I wifi:state: assoc -> init (0x2c0)
    Configuration
    WiFi Initialization
    wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
    ESP_ERROR_CHECK(esp_wifi_init(&cfg));
    ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
    ESP_ERROR_CHECK(esp_wifi_set_ps(WIFI_PS_NONE)); // Power save disabled
    esp_wifi_set_max_tx_power(84); // Maximum TX power (21dBm)
    ESP_ERROR_CHECK(esp_wifi_start());
    Connection Process
    // Scan for specific SSID first
    wifi_scan_config_t scan_conf = {0};
    scan_conf.ssid = (uint8_t *)ssid;
    scan_conf.show_hidden = true;
    esp_wifi_scan_start(&scan_conf, true); // Blocking scan
    // Get BSSID from scan results
    wifi_ap_record_t ap_info;
    uint16_t ap_count = 1;
    esp_wifi_scan_get_ap_records(&ap_count, &ap_info);
    // Configure connection with BSSID
    wifi_config_t wifi_config = {0};
    strncpy((char *)wifi_config.sta.ssid, ssid, sizeof(wifi_config.sta.ssid) - 1);
    strncpy((char *)wifi_config.sta.password, password, sizeof(wifi_config.sta.password) - 1);
    memcpy(wifi_config.sta.bssid, ap_info.bssid, 6);
    wifi_config.sta.bssid_set = true;
    wifi_config.sta.channel = ap_info.primary;
    wifi_config.sta.threshold.authmode = WIFI_AUTH_OPEN;
    ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config));
    ESP_ERROR_CHECK(esp_wifi_connect());
    Things Already Tried
    ✅ BSSID-based connection - Explicitly set BSSID from scan results
    ✅ Channel specification - Set channel to match AP
    ✅ Power save disabled - esp_wifi_set_ps(WIFI_PS_NONE)
    ✅ Maximum TX power - Set to 84 (21dBm)
    ✅ Stop/restart WiFi - Complete WiFi stop before reconfiguration
    ✅ Delay before connect - Added delays between operations
    ✅ Scan before connect - Pre-scan to verify AP presence
    ✅ Retry mechanism - Up to 5 retry attempts
    ✅ NVS flash erase - Clean NVS to eliminate cached data
    Additional Observations
    Signal strength is excellent: RSSI -28dBm (very strong)
    AP is visible and responding: Successful scan and authentication
    Failure occurs during association: State transitions to
    init
    from assoc
    Consistent failure pattern: Same error codes (203, 205) on all attempts
    Other devices connect successfully: Same AP works fine with phones/laptops
    Questions
    What could cause consistent association failure (error 203/205) despite strong signal and successful authentication?
    Are there any ESP32-S3 specific WiFi stack settings that might affect WPA2-PSK association?
    Could there be timing issues in the association handshake that need adjustment?
    Are there any known compatibility issues with HUAWEI APs or specific WPA2 implementations?
    Request
    Any guidance on additional debugging steps, configuration parameters, or known workarounds for this issue would be greatly appreciated.

Hardware: ESP32-S3 custom board
ESP-IDF: v5.3.4
Issue: WiFi association fails with errors 203/205 despite strong signal

What is the actual behavior?

WiFi connection fails consistently after authentication/association phase with various disconnection error codes.
Actual behavior:

  • Device successfully scans and finds the target AP (HUAWEI-Shum) with strong signal (-28dBm)
  • Authentication completes successfully (wifi:state: init -> auth)
  • Association starts but immediately fails (wifi:state: assoc -> init)
  • Multiple disconnection errors observed: 2, 15, 201, 203, 204, 205, 206
  • Most frequent errors: 203 (Association leave) and 205 (AP unable to handle STA)
  • Retry attempts also fail with same pattern
  • Connection never reaches IP assignment phase
    Despite excellent signal strength and successful authentication, the device cannot maintain association with the AP long enough to complete the WiFi handshake and obtain an IP address.
    Other devices (phones, laptops) connect to the same AP successfully without issues.

Steps to reproduce.

  1. Initialize WiFi in Station mode with following configuration:

    • Power save: WIFI_PS_NONE (disabled)
    • TX power: 84 (21dBm, maximum)
    • Mode: WIFI_MODE_STA
  2. Scan for target SSID:

    wifi_scan_config_t scan_conf = {0};
    scan_conf.ssid = (uint8_t *)ssid;
    scan_conf.show_hidden = true;
    esp_wifi_scan_start(&scan_conf, true);
  3. Get BSSID from scan results and configure connection:
    wifi_config_t wifi_config = {0};
    strncpy((char *)wifi_config.sta.ssid, ssid, sizeof(wifi_config.sta.ssid) - 1);
    strncpy((char *)wifi_config.sta.password, password, sizeof(wifi_config.sta.password) - 1);
    memcpy(wifi_config.sta.bssid, ap_info.bssid, 6);
    wifi_config.sta.bssid_set = true;
    wifi_config.sta.channel = ap_info.primary;
    wifi_config.sta.threshold.authmode = WIFI_AUTH_OPEN;
    esp_wifi_set_config(WIFI_IF_STA, &wifi_config);

  4. Attempt connection:
    esp_wifi_connect();

  5. Observe: Connection fails during association phase with error 203 or 205

  6. Retry: Same failure pattern repeats

Notes:

Target AP: HUAWEI router, WPA2-PSK, Channel 1
Signal strength: Excellent (-28dBm)
Other devices connect successfully to same AP
Issue is 100% reproducible

Debug Logs.

I MAIN: Scanning for SSID: HUAWEI-Shum ... I wifi:mode : sta (d8:3b:da:46:c5:68) I wifi:enable tsf I MAIN: WiFi Scan Done I MAIN: Found: SSID=HUAWEI-Shum RSSI=-28 Ch=1 Auth=3 I MAIN: BSSID: c2:bb:19:d4:b5:14 I MAIN: === WiFi Connection Attempt === I MAIN: SSID: [HUAWEI-Shum] BSSID_set: 1 I MAIN: Starting connection... I wifi:new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1, snd_ch_cfg:0x0 I wifi:state: init -> auth (0xb0) I wifi:state: auth -> assoc (0x0) I wifi:state: assoc -> init (0x2c0) I wifi:new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1, snd_ch_cfg:0x0 E MAIN: WiFi Disconnected. Reason: 203 I MAIN: Retrying connection (1/5)... E MAIN: WiFi Disconnected. Reason: 205 I MAIN: Retrying connection (2/5)... I wifi:new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1, snd_ch_cfg:0x0 I wifi:state: init -> auth (0xb0) I wifi:state: auth -> assoc (0x0) I wifi:state: assoc -> init (0x2c0) I wifi:new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1, snd_ch_cfg:0x0 E MAIN: WiFi Disconnected. Reason: 203 I MAIN: Retrying connection (3/5)...

--- Multiple retry attempts show same pattern ---

WiFi event handler logs show various disconnection reasons during different attempts:

Error 2: Early beacon timeout
Error 15: 4-Way handshake timeout
Error 201: Unspecified failure
Error 203: Association leave (most common)
Error 204: Disassociation due to inactivity
Error 205: AP unable to handle STA (most common)
Error 206: Class 2 frame from non-authenticated STA
Configuration verification:

Power save: Disabled (WIFI_PS_NONE)
TX power: 84 (maximum)
BSSID: Explicitly set from scan results
Channel: Explicitly set to match AP
Multiple stop/start cycles attempted
NVS erased to clear any cached data

Diagnostic report archive.

No response

More Information.

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions