FAQ
TL;DR: A 3-step flash erase fixed the ESP8266 Wi‑Fi resets; "There was rubbish in the flash area." It clears corrupt Wi‑Fi settings that WiFi.begin won’t reset, stopping Exception 3 loops. Then switch uploads back to Only Sketch for speed. [Elektroda, khoam, post #19425505]
Why it matters: This helps makers quickly stop ESP8266 reset loops during Wi‑Fi connect without replacing hardware.
Quick Facts
- Typical symptom: Exception (3) with repeated "rst cause:2" messages after WiFi.begin(), seen at 115200 baud. [Elektroda, dasej, post #19425195]
- Primary fix: In Arduino IDE, set Erase Flash = "All Flash Contents" and re-upload the sketch. [Elektroda, khoam, post #19425469]
- Root cause: Corrupted Wi‑Fi config in flash; "WiFi.begin() doesn't clear this" area. [Elektroda, khoam, post #19425505]
- Fast diagnosis: Install the ESP8266/ESP32 Exception Stack Trace Decoder plugin for Arduino IDE. [Elektroda, khoam, post #19425405]
- Power sanity-check: Verify a stable 3.3 V after the regulator before chasing firmware issues. [Elektroda, sylweksylwina, #19425235
How do I fix ESP8266 Wi‑Fi resets right after WiFi.begin()?
Erase the saved Wi‑Fi config and re-upload. In Arduino IDE, set Tools → Erase Flash → All Flash Contents. Upload your sketch again. This clears corrupted credentials that trigger resets during connect. It’s the quickest, proven fix in this thread. [Elektroda, khoam, post #19425469]
Why did erasing flash fix the crash?
"There was rubbish in the flash area where the settings for the WiFi network are stored." WiFi.begin() only sets parameters; it does not purge old, corrupt data. Clearing flash removes that bad state so the ESP8266 can associate cleanly. [Elektroda, khoam, post #19425505]
What does "Exception (3) LoadStoreError" mean on ESP8266?
It decodes to: LoadStoreError, a processor internal physical address or data error during load or store. In practice, it shows as a crash with a stack trace. Decode it to see which call path failed. [Elektroda, dasej, post #19425463]
What does "rst cause:2" in the boot log tell me?
It indicates an external reset, like pressing the reset button. Watchdog-triggered resets typically show as cause 4. This helps distinguish a manual reset from firmware stalls. "rst cause 2 it looks like the reset button was pressed." [Elektroda, sylweksylwina, post #19425235]
Which tool decodes ESP8266 exception stack traces in Arduino IDE?
Install the "ESP8266/ESP32 Exception Stack Trace Decoder" plugin. It maps program counters to source lines, making crashes actionable instead of guesswork. This was the recommended approach in the thread. [Elektroda, khoam, post #19425405]
Should I avoid delay() on ESP8266 to prevent WDT resets?
No. "The delay() function in the ESP8266 does not block the execution of other threads or the operation of the WTD." delay() yields internally, so it cooperates with Wi‑Fi and system tasks. [Elektroda, khoam, post #19425405]
Do I need to add yield() in my loop?
Add yield() in tight loops or long operations to keep the system responsive. It prevents watchdog resets when you do extended processing without delays or blocking calls. "You can give yield() in the main program loop." [Elektroda, sylweksylwina, post #19425235]
How can I quickly check if power is the culprit?
Confirm a stable 3.3 V rail after the regulator and proper grounding. Measure under load. If voltage is correct yet crashes persist, investigate firmware and flash content next. The thread began with a power check suggestion. [Elektroda, sylweksylwina, post #19425235]
I powered it with 3.3 V after the regulator and it still resets—what next?
If a clean 3.3 V supply doesn’t help, suspect firmware state. Proceed to erase flash and re-upload. In the thread, external 3.3 V didn’t change the behavior until flash was cleared. [Elektroda, dasej, post #19425289]
What baud rate should I use to read logs and exceptions?
Use 115200 baud. Match Serial.begin(115200) in your sketch and set your Serial Monitor the same. This ensures the boot logs and decoder outputs are readable. [Elektroda, dasej, post #19425195]
After wiping flash, can I speed up uploads again?
Yes. Switch Tools → Erase Flash back to "Only Sketch" after the successful recovery. This shortens upload time while keeping your fresh Wi‑Fi settings. "You can go back to 'Only Sketch'." [Elektroda, khoam, post #19425505]
Is my reset button OK if holding it stops the ESP from starting?
Yes. Holding Reset keeps the chip from booting, which is expected. That confirms the button is wired and functioning. Release it to allow normal boot. [Elektroda, dasej, post #19425289]
Can long blocking code still trigger watchdog resets?
Yes. Long, non-yielding code paths can cause WDT resets, which appear as rst cause 4. Break work into chunks, use yield(), or rely on delay() which yields. [Elektroda, sylweksylwina, post #19425235]
Did this fix actually work for the original poster?
Yes. After setting Erase Flash to All Flash Contents and reloading, the OP confirmed the module worked. They thanked the helper for the solution. [Elektroda, dasej, post #19425500]
Quick how-to: erase ESP8266 Wi‑Fi settings that crash WiFi.begin()
- In Arduino IDE, set Tools → Erase Flash → All Flash Contents.
- Upload your sketch again.
- Let it boot and confirm stable Wi‑Fi connection in Serial Monitor.
This removes corrupted credentials and stops the reset loop. [Elektroda, khoam, post #19425469]