ESP32-S3 Not Connect to WiFi

Good Morning Everybody, i not understand wy my board non connect to WiFi
i was check some topick and tutorial but same result ...

I try to change a setup of my router without success.

i was undestud wify is connectind and after return error, i was check a value of WiFi.status() and i have read value 6 = when disconnected from a network.

i dont understud was is wrong

This is my Code

#include <WiFi.h>

// Replace with your network credentials (STATION)
const char* ssid = "Miami-Dave";
const char* password = "xxxxxxxxxx";

void initWiFi() {
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  Serial.print("Connecting to WiFi state ");
  Serial.println(WiFi.status());
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print('.');
    delay(1000);
  }
  Serial.println(WiFi.localIP());
}

void setup() {  Serial.begin(115200);
                initWiFi();
                Serial.print("RRSI: ");
                Serial.println(WiFi.RSSI());
              }

void loop() {
  // put your main code here, to run repeatedly:
}

if i use WiFiScan project example i get right data:
5 networks found
Nr | SSID                             | RSSI | CH | Encryption
 1 | Miami-Dave                 |  -36 |  4 | WPA2
 2 | TIM-52399316             |  -88 |  2 | WPA2
 3 | TP-Link_6C16               |  -88 | 10 | WPA+WPA2
 4 | TP-Link_FA98               |  -92 | 11 | WPA+WPA2
 5 | NETGEAR_EXT              |  -94 | 11 | open

Are you using an Arduino ESP32 or another ESP32-S3 board?


Please edit your post, select all code and click the <CODE/> button; next save your post.
This will apply code tags which make the code easier to read and copy and the forum software will display it correctly.

Thaks i have aupdated my message

WiFi.mode(WIFI_STA);

is not really needed, you can skip this. Check SSID and password if they are correct it should work.

The moment WiFi.status() == WL_CONNECTED your ESP32 hasn't got the IP yet. You should wait for a while or test when WiFi.localIP ().toString () is different than "0.0.0.0".

Thanks for your help, now i try to it,
this is a result

WiFi status : 6
local IP : 0.0.0.0

about my SSID and Password i'm shure, but is not clear why my router non send an IP.

i try to add a macAddress into Router for define a static ip for him and define on sketch a static ip of device

#include <WiFi.h>

// Replace with your network credentials (STATION)
const char* ssid = "Miami-Dave";
const char* password = "Matley174";
// Set your Static IP address
IPAddress local_IP(192, 168, 74, 210);
// Set your Gateway IP address
IPAddress gateway(192, 168, 74, 1);

IPAddress subnet(255, 255, 0, 0);
IPAddress primaryDNS(8, 8, 8, 8);   //optional
IPAddress secondaryDNS(8, 8, 4, 4); //optional

void initWiFi() {
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  Serial.print("Connecting to ");
  Serial.println(ssid);
  Serial.println(password);
  delay(5000);
  Serial.print("WiFi status : ");
  Serial.println(WiFi.status());
  Serial.print("local IP : ");
  Serial.println(WiFi.localIP());
  
  

  while (WiFi.status() != WL_CONNECTED) { Serial.print('.');  delay(1000);  }
  
}

void setup() {  Serial.begin(115200);
                // Configures static IP address
                if (!WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS)) {  Serial.println("STA Failed to configure");  }
                initWiFi();
                Serial.print("RRSI: ");
                Serial.println(WiFi.RSSI());
              }

void loop() {
  // put your main code here, to run repeatedly:
}

But any changed
Connecting to Miami-Dave
Matley174
WiFi status : 6
local IP : 192.168.74.210

and device is not present into network (ping or ScanIP)

i don't understood who is wrong ...
Thanks

I am so confused, what exactly is going wrong.

Recap

  1. i load example for WiFi Scan --> i view all network
  2. i load a code for made a connection to my wi-fi --> get error and IP is 0.0.0.0

Now is possible my ESP32 not work fine ? (it's new and is my first experience of this device)

there is a way to understood why not connect?

Thanks

My Device info

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce2820,len:0x1188
load:0x403c8700,len:0x4
load:0x403c8704,len:0xbf0
load:0x403cb700,len:0x30e4
entry 0x403c88ac

Hm, having 255.255.0.0 for the subnet mask for the home network is rather strange. Normally it would be 255.255.255.0 and this would also be a valid subnet mask for your address range (192.168.74.X).

If you are using DHCP the following should do.

WiFi.begin (STA_SSID, STA_PASSWORD);

while (WiFi.localIP ().toString () == "0.0.0.0") { // wait until we get IP from router's DHCP
    delay (1000); 
    Serial.printf ("   .\n"); 
} 
Serial.printf ("Got IP: %s\n", (char *) WiFi.localIP ().toString ().c_str ());

If this is not working there must be something wrong with your ESP32 or your router settings.

thaks for yous suggestion, but is not a problem of newtwork, i'ts problem of module, i buy a new ant with same code, work !

i wil use this module without network connection for other application ..
Thaks to All

I have just experienced similar problems with my ESP32 S2 mini. It seems that a capacitor between 3V3 and EN solves the problem: ESP32-S2 (S2 Mini board) can't connect to WiFi 'Auth Expired' · Issue #4368 · esphome/issues · GitHub. I tested it myself with 3,3 uF and it works.

Touch the wifi panel with your finger and try... It worked for me.
Maybe wrong series of panels.

me too, but why happen this?

If it is not a feature it is a bug. Faulty board series I guess.