logo elektroda
logo elektroda
X
logo elektroda

[Solved] ESP8266MOD: No WiFi connection - program code issues

dasej 2856 11
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 19425195
    dasej
    Level 32  
    Posts: 1905
    Help: 165
    Rate: 265
    Welcome.

    The topic is about this version of the mod
    ESP8266MOD: No WiFi connection - program code issues .

    Code: C / C++
    Log in, to see the code
    .


    There is practically nothing in the program and it constantly resets itself.
    As I do not attach the WiFi support the module itself when blinking the diode works.

    Is the module defective or am I doing something wrong?

    ESP8266MOD: No WiFi connection - program code issues

    Code: Ini
    Log in, to see the code
    .
  • ADVERTISEMENT
  • #2 19425235
    sylweksylwina
    Moderator of Computers service
    Posts: 13170
    Help: 1875
    Rate: 2335
    Power supply all correct? I.e. you're probably powering from USB anyway, but you could check that the voltages are correct after the stabiliser etc.

    Exception indicates a problem with program execution, if it is caused by WiFi code then maybe try clearing memory and uploading new firmware.

    rst cause 2 it looks like the reset button was pressed.

    Don't do so many delays because if you start to complicate the code, it will start to watchdog reset the board (rst cause 4).
    You can give yield() in the main program loop.
  • ADVERTISEMENT
  • #3 19425289
    dasej
    Level 32  
    Posts: 1905
    Help: 165
    Rate: 265
    I fed 3.3V from the power supply behind the stabiliser and still the same.
    The button is working, when I hold it down the ESP does not start.
    I added a delay so that ESP resets more slowly.
  • ADVERTISEMENT
  • #4 19425336
    Anonymous
    Level 1  
  • #5 19425405
    Anonymous
    Level 1  
  • #6 19425450
    Anonymous
    Level 1  
  • #7 19425463
    dasej
    Level 32  
    Posts: 1905
    Help: 165
    Rate: 265
    @khoam .
    I received something like this back.

    Code: Ini
    Log in, to see the code
    .

    Added after 1 [minute]:

    @Jarzabek666 .

    My dear reader, we are not writing here about DELAY.
  • ADVERTISEMENT
  • Helpful post
    #8 19425469
    Anonymous
    Level 1  
  • #9 19425500
    dasej
    Level 32  
    Posts: 1905
    Help: 165
    Rate: 265
    @khoam Many thanks works.
    Two words of explanation.
  • #10 19425505
    Anonymous
    Level 1  
  • #11 19425519
    sylweksylwina
    Moderator of Computers service
    Posts: 13170
    Help: 1875
    Rate: 2335
    Okay I actually got something mixed up, although I try to avoid delays anyway, maybe that's what got me worked up. Although I'll admit honestly that I haven't figured out the basics like delay in the source files.

    Stack trace decoder would indeed help to track down the problem, although with this simple program it probably helps just to tick "erase all flash contents". Sometimes things can go wrong in the configuration and circuses happen.
  • #12 19425532
    dasej
    Level 32  
    Posts: 1905
    Help: 165
    Rate: 265
    Many thanks for your help @khoam

Topic summary

✨ The discussion revolves around issues with establishing a WiFi connection using the ESP8266MOD module. The user provided a code snippet but encountered problems, including exceptions during execution. Responses suggested checking the power supply, clearing memory, and using the "Erase Flash" option in the Arduino IDE to resolve potential issues with residual settings. The importance of minimizing delays in the code to prevent watchdog timer resets was emphasized. Additionally, using the ESP8266/ESP32 Exception Stack Trace Decoder was recommended for debugging. Ultimately, the user found success by erasing all flash contents, which resolved the connection issue.
Generated by the language model.

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

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()

  1. In Arduino IDE, set Tools → Erase Flash → All Flash Contents.
  2. Upload your sketch again.
  3. 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]
Generated by the language model.
ADVERTISEMENT