I have some ESP32u modules working OK in different projects. However occasionally one will refuse to connect any more. No amount of resetting, reloading, restarting etc will get it going again.
The only way I know of resurrecting the now useless module is to do a Flash erase (using esptool.py)
Then reload the sketch and everything works again (for weeks at a time !)
I have managed to simulate the problem at will by issuing a second connect whilst already connected. I am sure there are other possible causes.
I have loaded the latest firmware but problem still remains. Not sure if there is a resolution but any suggestions may help..
This is a sketch that can intentionally KILL's my ESP32's ..... but be prepared to use a Flash Erase !!!
#include <WiFi.h>
#include <esp_wifi.h>
const char* ssid = "xxxxx";
const char* password = "xxxxx";
float kattempt = 0;
float strength = 0;
int kill=0; // Change this to kill=1 to issue 2nd connect and kill the ESP32
void setup() {
// FIRST CONNECT
Serial.begin(9600); delay(500);
Serial.println("Start Konnect 1");
esp_wifi_set_protocol( WIFI_IF_STA, WIFI_PROTOCOL_LR );
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(400);
Serial.println("...");
kattempt++;
if (kattempt>20) {kattempt=0;WiFi.disconnect();
Serial.print("Connect 1 FAILED");
return; }
}
Serial.print("#1 WiFi connected with IP: ");
strength=(WiFi.RSSI());
Serial.println(WiFi.localIP());
if (kill==1) {
Serial.println("Start Konnect 2");
esp_wifi_set_protocol( WIFI_IF_STA, WIFI_PROTOCOL_LR );
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(400);
Serial.println("///");
kattempt++;
if (kattempt>20) {kattempt=0;WiFi.disconnect();
Serial.println("Connect 2 FAILED");
return; }
}
Serial.print("#2 WiFi connected with IP: ");
strength=(WiFi.RSSI());
Serial.println(WiFi.localIP()); }
}
void loop() {
// put your main code here, to run repeatedly:
}