Skip to content

STA+STATION mode unconnectable to other esp8266 if SSID is hidden #3625

Closed
@Alasknnj

Description

@Alasknnj

Basic Infos

Hardware

Hardware: esp8266
Core Version: 2.3.0

Description

I have two nodeMCUs, one of them connects to a router network in WIFI_STA mode, then goes to WIFI_AP_STA mode and opens a hidden AP. The other nodeMCU then should connect to the hidden AP the first node created.

The problem is, the second node cannot connect to the first node's hidden AP.

I observed that if the first node doesn't connect to the router network, and open the hidden AP in WIFI_STA_MODE, the second nodes manages to connect. I also observed that even if the first node connects to the router network and opens the AP, if the AP is not hidden, the second node can connect.

However the combination: first node connects to router network + opens hidden AP doesn't result in a successful connection for the second node, it just keeps trying to connect.

I have also been able to connect to the first node's hidden AP through my PC without any issue.

Settings in IDE

Module: NodeMCU 1.0(ESP-12E Module)
Flash Size: 4MB/3MB
CPU Frequency: 80MHz
Upload Speed: 115200
Upload Using: Serial

Sketch

I used the HTTPRequest example as a base to test this issue.

For the first node:

#include <ESP8266WiFi.h>

const char* ssid = "ROUTER_SSID";
const char* password = "ROUTER_PASSWORD";

void setup() {
  Serial.begin(115200);
  //Serial.println();
  Serial.print("connecting to ");
  
  Serial.println(ssid);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
    Serial.println(WiFi.status());
 }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
  Serial.println("Setting AP");
  WiFi.mode(WIFI_AP_STA);
  Serial.println(WiFi.softAP("AP_SSID", "AP_PASSWORD", WiFi.channel(), 1));


}

void loop() {

}

For the second node:

#include <ESP8266WiFi.h>

const char* ssid = "AP_SSID";
const char* password = "AP_PASSWORD";

void setup() {
  Serial.begin(115200);
  Serial.println();
  Serial.print("connecting to ");
  Serial.println(ssid);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
    Serial.println(WiFi.status());
  }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());

}

void loop() {

}

output

First node:

connecting to ROUTER_SSID
.6
.3

WiFi connected
IP address: 
192.168.1.101
Setting AP
1

Second node:

connecting to AP_SSID
.6
.6
.6
.6
.6
.6
.6
.6
.6
.6
.6
.6
.6
.1
.1
.1
.1
.1
.1

...

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