Skip to content

Unable to connect to some Wi-Fi access points #2795

Closed
@simonvanderveldt

Description

@simonvanderveldt

Hardware

Hardware: ESP-01
Flash Size: 512KB
CPU Frequency: 80Mhz
Core Version: 2.3.0 (assuming this is the version of the Arduino framework for the esp8266)

Description

I'm just doing a simple thing, namely connection to an access point, which used to work fine when using lua/nodemcu with this access point, but refuses to work using this framework.
The strange thing is, it does work when I connect to my phone's Wi-Fi hotspot, but doesn't work when connecting to my regular access point (a Asus WL-500gP running Tomato).

I tried everything I could think of on the access point:

  • switch channels
  • switch mode between b and g (it doesn't support n)
  • rename SSID
  • change password
  • change encryption to WPA1/TKIP or to WPA1/WPA2 compatible TKIP or EAS

But none of them fixed the problem

Sketch

I've simplified it to just the basic steps/example code. Added the network scan so it shows that the SSID does exist and is found by the esp8266. So at the very least the debug message no SimonAP found, reconnect after 1s is wrong.

#include <ESP8266WiFi.h>

void setup() {
  Serial.begin(115200);
  Serial.setDebugOutput(true);
  Serial.println();
  Serial.println("Starting setup");

  Serial.print("Scan start ... ");
  int n = WiFi.scanNetworks();
  Serial.print(n);
  Serial.println(" network(s) found");
  for (int i = 0; i < n; i++)
  {
    Serial.println(WiFi.SSID(i));
  }
  Serial.println();

  WiFi.disconnect(true);
  WiFi.setAutoConnect(false);
  WiFi.setPhyMode(WIFI_PHY_MODE_11G);
  WiFi.begin("SimonAP", "thisisapassword");
  WiFi.printDiag(Serial);
  Serial.println(WiFi.getPhyMode());

  Serial.print("Connecting");
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println();
  Serial.print("Connected, IP address: ");
  Serial.println(WiFi.localIP());

  delay(2000);
}

Debug Messages

setup
Scan start ... scandone
f r0, scandone
14 network(s) found
SimonAP
... (<other 13 APs redacted>)

del if0
usl
mode : null
mode : sta(18:fe:34:9d:2b:d6)
add if0
f r0, Mode: STA
PHY mode: G
Channel: 1
AP id: 0
Status: 1
Auto connect: 1
SSID (7): SimonAP
Passphrase (15): thisisapassword
BSSID set: 0
2
Connecting....scandone
state: 0 -> 2 (b0)
.state: 2 -> 3 (0)
state: 3 -> 0 (19)
..reconnect
f 0, ....scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 0 (19)
..reconnect
f -180, ....scandone
no SimonAP found, reconnect after 1s
reconnect
f r0, ....scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 0 (19)
..reconnect
f 0, .....scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 0 (19)
..reconnect
f -180, ....scandone
no SimonAP found, reconnect after 1s
reconnect
f r0, ....scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 0 (19)
..reconnect
f 0, ..

Metadata

Metadata

Assignees

No one assigned

    Labels

    waiting for feedbackWaiting on additional info. If it's not received, the issue may be closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions