Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32-C3 can not connect to WiFi AP (AUTH_EXPIRE) #6767

Closed
1 task done
XFer012 opened this issue May 17, 2022 · 21 comments
Closed
1 task done

ESP32-C3 can not connect to WiFi AP (AUTH_EXPIRE) #6767

XFer012 opened this issue May 17, 2022 · 21 comments
Assignees
Milestone

Comments

@XFer012
Copy link

XFer012 commented May 17, 2022

Board

Lolin C3-Mini

Device Description

Lolin C3-Mini alone, nothing connected

Hardware Configuration

Nothing

Version

v2.0.3

IDE Name

Arduino IDE 1.8.19

Operating System

Windows 10 Pro 64 bit

Flash frequency

80 MHz

PSRAM enabled

no

Upload speed

921600

Description

ESP32-C3 can not connect to my AccessPoint, while ESP32 "stock" (ESP32 Devkit board) connects without issues

C3 reports continously "[W][WiFiGeneric.cpp:873] _eventCallback(): Reason: 2 - AUTH_EXPIRE"

Sketch

/*
 *  This sketch sends data via HTTP GET requests to data.sparkfun.com service.
 *
 *  You need to get streamId and privateKey at data.sparkfun.com and paste them
 *  below. Or just customize this script to talk to other HTTP servers.
 *
 */

#include <WiFi.h>

const char* ssid     = "[my SSID]";
const char* password = "[my WPA2 password]";

const char* host = "data.sparkfun.com";
const char* streamId   = "....................";
const char* privateKey = "....................";

void setup()
{
    Serial.begin(115200);
    delay(10);

    // We start by connecting to a WiFi network

    Serial.println();
    Serial.println();
    Serial.print("Connecting to ");
    Serial.println(ssid);

    WiFi.begin(ssid, password);

    while (WiFi.status() != WL_CONNECTED) {
        delay(2000);
        Serial.print("Not connected. Status="); Serial.println(WiFi.status());
    }

    Serial.println("");
    Serial.println("WiFi connected");
    Serial.println("IP address: ");
    Serial.println(WiFi.localIP());
    delay(5000);
}

int value = 0;

void loop()
{
    delay(5000);
    ++value;

    Serial.print("connecting to ");
    Serial.println(host);

    // Use WiFiClient class to create TCP connections
    WiFiClient client;
    const int httpPort = 80;
    if (!client.connect(host, httpPort)) {
        Serial.println("connection failed");
        return;
    }

    // We now create a URI for the request
    String url = "/input/";
    url += streamId;
    url += "?private_key=";
    url += privateKey;
    url += "&value=";
    url += value;

    Serial.print("Requesting URL: ");
    Serial.println(url);

    // This will send the request to the server
    client.print(String("GET ") + url + " HTTP/1.1\r\n" +
                 "Host: " + host + "\r\n" +
                 "Connection: close\r\n\r\n");
    unsigned long timeout = millis();
    while (client.available() == 0) {
        if (millis() - timeout > 5000) {
            Serial.println(">>> Client Timeout !");
            client.stop();
            return;
        }
    }

    // Read all the lines of the reply from server and print them to Serial
    while(client.available()) {
        String line = client.readStringUntil('\r');
        Serial.print(line);
    }

    Serial.println();
    Serial.println("closing connection");
}

Debug Message

[W][WiFiGeneric.cpp:873] _eventCallback(): Reason: 2 - AUTH_EXPIRE

Other Steps to Reproduce

I also tried ESP32 Devkit board, same AP, same parameters, same position; works without issues

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@XFer012 XFer012 added the Status: Awaiting triage Issue is waiting for triage label May 17, 2022
@XFer012
Copy link
Author

XFer012 commented May 17, 2022

Full output from serial monitor:

Connecting to [my SSID]
[ 1503][W][WiFiGeneric.cpp:873] _eventCallback(): Reason: 2 - AUTH_EXPIRE
Not connected. Status=6
[ 2528][W][WiFiGeneric.cpp:873] _eventCallback(): Reason: 2 - AUTH_EXPIRE
[ 3550][W][WiFiGeneric.cpp:873] _eventCallback(): Reason: 2 - AUTH_EXPIRE
Not connected. Status=6
[ 4574][W][WiFiGeneric.cpp:873] _eventCallback(): Reason: 2 - AUTH_EXPIRE
[ 5600][W][WiFiGeneric.cpp:873] _eventCallback(): Reason: 2 - AUTH_EXPIRE
Not connected. Status=6
[ 6624][W][WiFiGeneric.cpp:873] _eventCallback(): Reason: 2 - AUTH_EXPIRE
[ 7648][W][WiFiGeneric.cpp:873] _eventCallback(): Reason: 2 - AUTH_EXPIRE
Not connected. Status=6
[ 8672][W][WiFiGeneric.cpp:873] _eventCallback(): Reason: 2 - AUTH_EXPIRE
[ 9696][W][WiFiGeneric.cpp:873] _eventCallback(): Reason: 2 - AUTH_EXPIRE
Not connected. Status=6
[ 10720][W][WiFiGeneric.cpp:873] _eventCallback(): Reason: 2 - AUTH_EXPIRE
[ 11744][W][WiFiGeneric.cpp:873] _eventCallback(): Reason: 2 - AUTH_EXPIRE

[...]

@SuGlider SuGlider added Status: Test needed Issue needs testing Status: Needs investigation We need to do some research before taking next steps on this issue labels May 17, 2022
@SuGlider
Copy link
Collaborator

@PilnyTomas, PTAL - Thanks!

@PilnyTomas
Copy link
Contributor

Hi @XFer012, could you please get the signal strength of the AP you are trying to connect to?
You can use WiFiScan example. You can also find it in Arduino IDE under File > Examples > WiFi > WiFiScan

@XFer012
Copy link
Author

XFer012 commented May 19, 2022

Sure, here it's the output from WiFiScan:

scan done
10 networks found
1: [My SSID] (-36)* <--- this is mine
2: TP-Link_xxxx (-67)*
3: Vodafone-xxxx (-77)*
4: Vodafone-xxxx (-79)*
5: Vodafone-xxxx (-79)
6: Vodafone-xxxx (-80)
7: Vodafone-xxxx (-85)
8: Vodafone-xxxx (-86)
9: Vodafone-xxxx (-87)*
10: Vodafone-xxxx (-87)*

@VojtechBartoska VojtechBartoska moved this from Todo to Under investigation in Arduino ESP32 Core Project Roadmap May 19, 2022
@Jason2866
Copy link
Collaborator

Jason2866 commented May 19, 2022

@PilnyTomas @XFer012 We have only troubles with the Lolin C3-Mini and Tasmota. Every! other C3 board does work well. After we modified the HF part of the board we got it going more or less good. There is "somewhere" a bug in the HF board design.
Arduino core is NOT the problem!

@XFer012
Copy link
Author

XFer012 commented May 19, 2022

You mean all Lolin-C3 you tested scan OK, correctly detect RSSI, but cannot connect with an "AUTH_EXPIRE" error?

@Jason2866
Copy link
Collaborator

Jason2866 commented May 24, 2022

@XFer012 Either this or some even did not found a AP.
I trashed all. Just a time waster.

@Sys64736
Copy link

Sys64736 commented Jun 3, 2022

@Jason2866 is right, there is a flaw in the design. You need to set the transmit power to -8.5db right after wifi.begin then it will connect. If using the softAP, you need to set it after starting also.

     WiFi.begin(ssid_char, password_char); 
     WiFi.setTxPower(WIFI_POWER_8_5dBm);

@Jason2866
Copy link
Collaborator

The antenna matching is not correct. So the HF signal gets reflected. A really bad workaround is to reduce transmit power so the reflecting is reduced and does not eliminate the (weak) signal completly. A real fix needs changes in the HF matching network.

@Sys64736
Copy link

Sys64736 commented Jun 3, 2022

Yes, it's a bad workaround and although it eliminates the AUTH_EXPIRE response it's deceiving because the board's RX'd signal will be much greater than the TX range. I bought a bunch of these boards when they first came out and have used many successfully but only within ~10 meters of the AP, after that RX strength is still pretty good but too many dropped packets on the TX end. I only use them now with SoftAP as it only needs to transmit to a mobile phone which is usually within a few meters of the device. Hoping they improve the design and release an updated version of the board.

@XFer012
Copy link
Author

XFer012 commented Jun 3, 2022

@Jason2866 is right, there is a flaw in the design. You need to set the transmit power to -8.5db right after wifi.begin then it will connect. If using the softAP, you need to set it after starting also.

     WiFi.begin(ssid_char, password_char); 
     WiFi.setTxPower(WIFI_POWER_8_5dBm);

Thank you, I will try this workaround. Better than nothing!

@XFer012
Copy link
Author

XFer012 commented Jun 5, 2022

Confirmed working. Thanks!

@collin80 collin80 mentioned this issue Jun 8, 2022
1 task
@VojtechBartoska
Copy link
Contributor

Closing as solved, if needed, you can reopen the issue.

Repository owner moved this from Under investigation to Done in Arduino ESP32 Core Project Roadmap Jun 14, 2022
@VojtechBartoska VojtechBartoska added Status: Solved and removed Status: Test needed Issue needs testing Status: Awaiting triage Issue is waiting for triage Status: Needs investigation We need to do some research before taking next steps on this issue labels Jun 14, 2022
@gauthier12
Copy link

Hi.
If someone somewhere search it, same problem with the "banana pi BPI-Centi-S3" and the same workaround works
Thanks @Sys64736

@fbernaly
Copy link

@Jason2866 is right, there is a flaw in the design. You need to set the transmit power to -8.5db right after wifi.begin then it will connect. If using the softAP, you need to set it after starting also.

     WiFi.begin(ssid_char, password_char); 
     WiFi.setTxPower(WIFI_POWER_8_5dBm);

That workaround also worked for me!

@unmateria
Copy link

@Jason2866 is right, there is a flaw in the design. You need to set the transmit power to -8.5db right after wifi.begin then it will connect. If using the softAP, you need to set it after starting also.

     WiFi.begin(ssid_char, password_char); 
     WiFi.setTxPower(WIFI_POWER_8_5dBm);

Thank you, I will try this workaround. Better than nothing!

Thank you! it worked perfectly :)

@totial
Copy link

totial commented Sep 25, 2024

Had the same problem and after trying MULTIPLE HW changes like adding capacitors, diodes to boost 3.3v to 3.4v, and modifying the smd wifi antenna I decided to try all esp32c3 super mini boards from a batch of 10 I bought and found out that 4 out of 10 where unable to connect to wifi reporting error AUTH_EXPIRE. Exactly the same sketch (wifi tx power 8.5db) for all of them. My conclusion is the manufacturer doesnt chack for defectives and sells all of them. Dont know what other issues can arise. Hope this helps (to discard the broken ones).

@Jason2866
Copy link
Collaborator

@totial You are right. There are bad designed (defective) C3 out there and sold.
Even well known names had problematic C3 boards design. Just to mention one.
Lolin. The did not really inform the users. Just the "fix" to lower the TX power was published.
The did a redesign of the C3 enhancing rev. number. The new rev. does not need the "fix" anymore.
To be 100% clear. Every C3 board which does need lowering TX power is a defective board!!

@Slayingripper
Copy link

@Jason2866 is right, there is a flaw in the design. You need to set the transmit power to -8.5db right after wifi.begin then it will connect. If using the softAP, you need to set it after starting also.

     WiFi.begin(ssid_char, password_char); 
     WiFi.setTxPower(WIFI_POWER_8_5dBm);

This solved my issue! I was going at it for hours and could not for the life of me figure out why it wasn't connecting!

jblanked added a commit to jblanked/FlipperHTTP that referenced this issue Feb 16, 2025
@DansDesigns
Copy link

@Jason2866 is right, there is a flaw in the design. You need to set the transmit power to -8.5db right after wifi.begin then it will connect. If using the softAP, you need to set it after starting also.

     WiFi.begin(ssid_char, password_char); 
     WiFi.setTxPower(WIFI_POWER_8_5dBm);

Thank you so much, this solved a weeks worth of useless messing around in code!

Confirmed working on ESP32-S3 Devkit with ESP32-S3-WROOM-1

@Jason2866
Copy link
Collaborator

@DansDesigns First time i hear about issues with S3 in "classic" devkit form factor.
Good to know there are bad build clones here too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests