Recovering from mixed EEPROM and WiFi ‘boot loop of death’ on ESP-8266’s

Short answer: Keep simplifying code until you get some serial output before the WDT triggers. Then move on and recover. If you still get WDT stack dumps, then check your power supply, supply capacitors (470uF + 0.1 uF), and run a delay(1) to yield processing once in a while. (the last one is questionable, because a delay(1000) in setup used to kill WiFi…).

Longer answer: I recovered a stuck ESP-01 that seemed to boot, but not join the WiFi network AFTER I enabled EEPROM code. I’ve also heard the loading a ‘blank’ hex/bin file might be advised, as well as reloading the original firmware to rebuild the hidden sectors of the EEPROM. Use CheckFlashConfig.ino to ensure your IDE config is good.

Longest answer: Possibly related steps:

  • Changed back / forward between 2.3.0 and 2.2.0 several times to wipe the EEPROM areas, as the WiFi library apparently writes out SSID and PASS to private sectors of SPIFFS. Not sure but since the Flash is an external chip I think this means they aren’t protected from external reading with an SPI bus master hack.
  • Simplified to the point of being silly, then expanded code.
  • Enabled debugging in the IDE and in code with Serial.setDebugOutput(true);
  • Enabled debug printing during WiFi setup with WiFi.printDiag(Serial);
The code; this is probably the most reasonable (?) mix of recommendations from the ESP8266 community forums. In any event it works, and might prevent early flash wear death.
// Debug
  Serial.print("State set, starting network; status = ");
 
  WiFi.persistent(false);
  WiFi.setAutoConnect(true);
  WiFi.mode(WIFI_STA);
  WiFi.config(ip,gw,subnet,dns); 
 
  int stat = WiFi.status();
  Serial.println( stat );
 
  // Possibly superfluous step - see below:
  if ( stat != WL_CONNECTED ) {
    WiFi.begin(ssid, pass);
  }
  
  // Debug
  WiFi.printDiag(Serial);
  
  Serial.println("Wait for network status...");
  
  while (stat != WL_CONNECTED) {
    WiFi.begin(ssid, pass);
    WiFi.waitForConnectResult();
    stat = WiFi.status();
    Serial.print("  S:");
    Serial.print(stat);
    blink(cRed , 50); 
  }

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.