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

Cant' connect to network. OK in release 1.0.6 #6485

Closed
1 task done
fanfanlatulipe26 opened this issue Mar 27, 2022 · 7 comments · Fixed by #6651
Closed
1 task done

Cant' connect to network. OK in release 1.0.6 #6485

fanfanlatulipe26 opened this issue Mar 27, 2022 · 7 comments · Fixed by #6651
Assignees

Comments

@fanfanlatulipe26
Copy link

Board

ESP32 Dev Kit

Device Description

nothing

Hardware Configuration

nothing

Version

v2.0.2

IDE Name

Arduino IDE 1.8.19

Operating System

Windows 10

Flash frequency

80

PSRAM enabled

no

Upload speed

921600

Description

Can't connect to a wifi network. STA mode.
Standard example HelloServer in for the library WebServer fails.

Exactly the same code compiled with 1.0.6 works perfectly.

But it seems that the results depend on the network itself. I have a demo working perfectly on an other network at home and this demo fails on the network I use this day.(of course after updating ssid and password ;-=)
Network uses WPA (TKIP + AES)
.

Sketch

#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>
#include <ESPmDNS.h>

const char* ssid = "Alice_Maman";
const char* password = "xxxxxxxxxxxxxxxx";

WebServer server(80);

const int led = 2;

void handleRoot() {
  digitalWrite(led, 1);
  server.send(200, "text/plain", "hello from esp32!");
  digitalWrite(led, 0);
}

void handleNotFound() {
  digitalWrite(led, 1);
  String message = "File Not Found\n\n";
  message += "URI: ";
  message += server.uri();
  message += "\nMethod: ";
  message += (server.method() == HTTP_GET) ? "GET" : "POST";
  message += "\nArguments: ";
  message += server.args();
  message += "\n";
  for (uint8_t i = 0; i < server.args(); i++) {
    message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
  }
  server.send(404, "text/plain", message);
  digitalWrite(led, 0);
}

void setup(void) {
  pinMode(led, OUTPUT);
  digitalWrite(led, 0);
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  Serial.println("");

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  if (MDNS.begin("esp32")) {
    Serial.println("MDNS responder started");
  }

  server.on("/", handleRoot);

  server.on("/inline", []() {
    server.send(200, "text/plain", "this works as well");
  });

  server.onNotFound(handleNotFound);

  server.begin();
  Serial.println("HTTP server started");
}

void loop(void) {
  server.handleClient();
  delay(2);//allow the cpu to switch to other tasks
}

Debug Message

Print debug when example is compiles with 2.0.2:
rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2))
waiting for download

[   165][V][WiFiGeneric.cpp:272] _arduino_event_cb(): STA Started
[   167][V][WiFiGeneric.cpp:96] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
[   167][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 2 - STA_START

....[  2236][V][WiFiGeneric.cpp:289] _arduino_event_cb(): STA Disconnected: SSID: Alice_Maman, BSSID: 00:00:00:00:00:00, Reason: 201
[  2236][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
[  2244][W][WiFiGeneric.cpp:852] _eventCallback(): Reason: 201 - NO_AP_FOUND
[  2252][V][WiFiGeneric.cpp:96] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
....[  4317][V][WiFiGeneric.cpp:289] _arduino_event_cb(): STA Disconnected: SSID: Alice_Maman, BSSID: 00:00:00:00:00:00, Reason: 201
[  4317][D][WiFiGeneric.cpp:831] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
[  4325][W][WiFiGeneric.cpp:852] _eventCallback(): Reason: 201 - NO_AP_FOUND
[  4333][V][WiFiGeneric.cpp:96] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0

======================
Print debug when example is compiles with 1.0.6

rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2))
waiting for download
[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 2 - STA_START

......[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 4 - STA_CONNECTED
[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 7 - STA_GOT_IP
[D][WiFiGeneric.cpp:419] _eventCallback(): STA IP: 192.168.0.16, MASK: 255.255.255.0, GW: 192.168.0.254
.
Connected to Alice_Maman
IP address: 192.168.0.16
MDNS responder started
HTTP server started

Other Steps to Reproduce

In the IDE I select the board "ESP32 Dev Module"

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

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@fanfanlatulipe26 fanfanlatulipe26 added the Status: Awaiting triage Issue is waiting for triage label Mar 27, 2022
@Jason2866
Copy link
Collaborator

WPA really? Not WPA2. WPA is highly insecure. Do not use anymore.

@fanfanlatulipe26
Copy link
Author

WPA is at least more secure than WEP.
The box from my internet provider does not offer WPA2.

@Jason2866
Copy link
Collaborator

Jason2866 commented Mar 27, 2022

Open a ticket to get the box changed. It is a high security risk
Probably this setting CONFIG_MBEDTLS_RC4_DISABLED=y in sdkconfig is responsible for not working WPA anymore. WPA uses the insecure RC4.
To disable is a good decision!

@pipi61
Copy link

pipi61 commented Mar 27, 2022

Try change to wpa2 on your router

@Jason2866
Copy link
Collaborator

WPA is at least more secure than WEP. The box from my internet provider does not offer WPA2.

@pipi61

@fanfanlatulipe26
Copy link
Author

Back home, I ran some tests with my usual internet box where I have more choice with the authentication scheme and I confirm that It appears that WPA is no longer supported in 2.0.2.
In my opinion this choice is more than questionable:

  • First of all it introduces incompatibility / regression with 1. 0.6
  • It is up to the user to choose the level of security. It is his own responsibility.
  • It introduces more discrepencies with the latest documentations

Even the latest doc from Espressif states "Various security modes for the above (WPA, WPA2, WEP, etc.)" and from arduino-esp32 support documentation "Security modes (WPA, WPA2, WEP, etc.)"

@me-no-dev
Copy link
Member

"fix" is coming. More of an option to allow WPA actually :)

@VojtechBartoska VojtechBartoska added Status: Opened and removed Status: Awaiting triage Issue is waiting for triage labels Mar 29, 2022
@VojtechBartoska VojtechBartoska moved this to Under investigation in Arduino ESP32 Core Project Roadmap Mar 29, 2022
Repository owner moved this from Under investigation to Done in Arduino ESP32 Core Project Roadmap Apr 28, 2022
me-no-dev added a commit that referenced this issue Apr 28, 2022
Added options to WiFi STA for connect:
- setMinSecurity: default WIFI_AUTH_WPA2_PSK
- setScanMethod: default WIFI_FAST_SCAN
- setSortMethod: default WIFI_CONNECT_AP_BY_SIGNAL (required all channels scan method)

Added parameters for SSID and BSSID to WiFi.scanNetworks()

Fixes: #6485
Fixes: Any issue about WiFi connecting slower now than in 1.0.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

5 participants