Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ESP32-WROOM-32 fails to connect WiFi. Error "E (xxxx) wifi:Set status to INIT" #7996

DespyZx started this conversation in General
Discussion options

I have an ESP32-WROOM-32 module which I was trying to connect it with WiFi, but couldn't. Reading and writing data to a device (sensor, etc) has no problem. But only connecting to WiFi, it didn't work.

E (xxxx) wifi:Set status to INIT
The error above only is shown when I tried to connect the ESP32 with Hotspot. At the other hand, when I tried to connect it with WiFi router, it didn't show any error yet connect successfully.

I had tried to add WiFi STA mode on the code, and also try to figure out the error. But all I could find are only: WL_DISCONNECT (on Router's WiFi and Hotspot) and WL_CONNECT_FAILED (on Hotspot).

Anybody has an idea on this?

You must be logged in to vote

Replies: 5 comments 6 replies

Comment options

@DespyZx The "Hotspot" is generated from? Can you provide a short example code, where the problem can be reproduced?

You must be logged in to vote
3 replies
Comment options

The hotspot is generated from Mobile Phone.

The problem was found using usual code to connect to WiFi.
This is the code that I was using.

#include <WiFi.h>
#define LED_BUILTIN 2
// Set the IP address, gateway, and subnet mask
IPAddress ip(192, 168, 100, 100); // Replace with your desired static IP address
IPAddress gateway(192, 168, 100, 1); // Replace with your gateway address
IPAddress subnet(255, 255, 255, 0); // Replace with your subnet mask
void setup() {
 WiFi.disconnect(true);
 WiFi.mode(WIFI_STA);
 pinMode(LED_BUILTIN, OUTPUT);
 digitalWrite(LED_BUILTIN, LOW);
 Serial.begin(115200);
 Serial.println("Scanning available networks...");
 int numOfNetworks = WiFi.scanNetworks();
 Serial.print("Number of available networks: ");
 Serial.println(numOfNetworks);
 for (int i = 0; i < numOfNetworks; i++) {
 Serial.print(i + 1);
 Serial.print(": ");
 Serial.println(WiFi.SSID(i));
 }
 // Set the static IP address, gateway, and subnet mask
 if (!WiFi.config(ip, gateway, subnet)) {
 Serial.println("Failed to configure static IP address.");
 }
 // Wait for connection
 int wait = 0;
 while (WiFi.status() != WL_CONNECTED) {
 // Connect to WiFi
 WiFi.begin("SSID", "Password");
 wait++;
 digitalWrite(LED_BUILTIN, HIGH);
 delay(100);
 digitalWrite(LED_BUILTIN, LOW);
 delay(100);
 delay(5000);
 Serial.println("Connecting to WiFi...");
 if(wait == 5)
 {
 WiFi.disconnect(true);
 Serial.println("Reconnecting...");
 wait = 0;
 ESP.restart();
 }
 }
}
void loop() {
 // Your code goes here
 digitalWrite(LED_BUILTIN, HIGH);
 Serial.println("Test!");
}

These are all the Libraries that I was using:

  • WiFi101 by Arduino Version 0.16.1
  • EspSoftwareSerial by Dirk Kaar, Peter Lerup
  • LiquidCrystal by Arduino, Adafruit
  • ATtinySerialOut by Armin Joachimsmeyer
  • Adafruit FONA Library by Adafruit
  • Adafruit MQTT Library by Adafruit
  • Adafruit SleepyDog Library by Adafruit
  • Adafruit Unified Sensor by Adafruit
  • DHT sensor library by Adafruit
  • LiquidCrystal I2C by Frank de Brabander
  • ThingSpeak by MathWorks support@thingspeak.com
  • arduino-display-lcdkeypad by dieter.niklaus@gmx.net
  • spin-timer by Dieter Niklaus dieter.niklaus@gmx.net

These libraries might not be responsible for the error happened. ( I tried to reproduce the error on another device with different libraries, but the error still occurs )

Fyi, if I remove the 'IPAddress' codes on the codes above, the error still happens.

These are the URL I use for the additional board.
"http://arduino.esp8266.com/stable/package_esp8266com_index.json,https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json"
The board I was using was "ESP32 Dev Module"

Hope this could answer your question.

Comment options

Which phone Exactly? Had this problem in the past. Using a different phone from an other brand solved.

Comment options

I used POCO and Realme, both had the same issue. Which brand were you using?

Comment options

No problem with Samsung A52.

You must be logged in to vote
1 reply
Comment options

I had tried with iPhone and Vivo (if I'm not mistaken), the error "INIT" doesn't appear, but it couldn't be connected to the WiFi anyway.

Comment options

Using WiFi.config(ip, gateway, subnet) to set a static IP might make some APs unhappy. I'm not familiar with WF101 library. Can you try your project without it? Your code example should work with #include <WiFi.h>.

You must be logged in to vote
1 reply
Comment options

It couldn't work either.

Comment options

I am also getting the same problem. Did you find any solution?

You must be logged in to vote
1 reply
Comment options

Nope, it still occurs.

Comment options

I am too facing the similar issue. It connects to phone hotspot but not when the hotspot is generated by another ESP8266 module.

Kindly suggest some solution.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /