-->
Page 1 of 1

[SOLVED] ESP8266 crashes on WiFi.disconnect()

PostPosted: Sat Jan 29, 2022 4:38 pm
by grhhm
Hello,

This is an example that I use to work with "ESP-NOW" WiFi mode. Obviously, there are several ESP8266 communicating each other.
I am experimenting with them for a few weeks and they were working OK.

Today one of them started crashing when reaching
Code: Select allWiFi.disconnect();
line in the code. Here I found that adding
Code: Select allWiFi.persistent(false);
before
Code: Select allWiFi.disconnect();
solves the crash problem.

Indeed it does. No crashes but no ESP-NOW connection too.
My guess for the root cause is:
- Wifi needs to write something to Flash in one WiFi function for the sake of other function to read.
- Maybe Flash is damaged somehow and therefore write/read fails and crashes.

My questions:
- How to check this idea?
- Is there better idea or direction to solve the crash problem? Still ESP-NOW communication needed, however I don't have anything to store in the Flash.

Thank you.

Re: ESP8266 crashes on WiFi.disconnect()

PostPosted: Sun Jan 30, 2022 5:36 am
by grhhm
Clean up and/or erase of the Flash didn't help.

Well, the brute-force idea was to replace the ESP12 module in the affected device. And it works now.
The Crash was resulted by a damage in Flash.

Posting this as solution for others who might experience ESP8266 crash with stacktrace on attempt to disconnect from WiFi.