cnlohr / esp82xx

Useful ESP8266 C Environment
Other
288 stars 107 forks source link

Reboots with default settings after toggling gpios #54

Closed Damme closed 7 years ago

Damme commented 7 years ago

When setting wifi settings in web-gui, the "change settings" button does not save settings to flash, I have to send command "Is" to save settings.

My main problem is that settings reverts to default then device is crashing by unknown reason. One way to reproduce this is to randomly toggle gpio pins via web-gui. This is the log from then it reboots to factory defaults after crash.

Version: unknown - Build Mon, 15 May 2017 20:54:44 +0200 with -DICACHE_FLASH -DWEB_PORT=80 -DCOM_PORT=7777 -DBACKEND_PORT=7878  -DSLOWTICK_MS=5Loading Settings: af / 0 / 69 / 69
Settings Loaded: ESP_D60606 / Default
Opmode: 1
Station mode: "Q-2.4":"xxxxxxxx" (bssid_set:0)
Boot Ok.
IGMP Joining: cc282a0a fb0000e0
STAT: 5
IP: 10.42.40.204
NM: 255.255.252.0
GW: 10.42.41.200
WCFG: /Q-2.4/xxxxxxxx/
IGMP Joining: cc282a0a fb0000e0

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 30368, room 16 
tail 0
chksum 0x6a
load 0x3ffe8000, len 884, room 8 
tail 12
chksum 0x3d
ho 0 tail 12 room 4
load 0x3ffe8380, len 2832, room 12 
tail 4
chksum 0xe6
csum 0xe6
����g�s��n|�$dll`��;�$�d�䤨H����2XX Web-GUI
Version: unknown - Build Mon, 15 May 2017 20:54:44 +0200 with -DICACHE_FLASH -DWEB_PORT=80 -DCOM_PORT=7777 -DBACKEND_PORT=7878  -DSLOWTICK_MS=5Loading Settings: af / 0 / 69 / 69
Settings Loaded: ESP_D60606 / Default
Opmode: 2
Default SoftAP mode: "ESP_D60606":""
Boot Ok.
IGMP Joining: 0104a8c0 fb0000e0
con-f-use commented 7 years ago

@cnlohr is fixing #53 at the moment, which might be related.

Also can you please tell us, which commit you're using and which GPIO-pin you toggle? Try using the latest commit on master. Does the error still persist?

Damme commented 7 years ago

Tested with both Master and Dev.

I have successfully changed all gpios (that are changeable to out) without reboot, but then randomly pressing then in fast succession crash happens. Its not one same gpio that toggles the crash but random.

con-f-use commented 7 years ago

Okay that is strange. As I said in #53, I had endless reboots after flashing the firmware. They seem to be related to the init-data, but random resets on toggling the GPIOs seem very strange. Are you sure it is not a hardware issue? Do have adequate capacitance on the power rail close to the module (at least 10 μF)? Is the problem persistent between different ESP-modules? Is it persistent between different versions of the SDK?

Btw. most of these wonky issues I had, were due to one of these:

Damme commented 7 years ago

Hello again It seems to have nothing do with switching GPIOs to 1/0, but direction (in/out) , and switching back an IO to "in". There is no external hardware and I tried with and without an extra cap.

What buggers me the most though is that the settings reverts to default. My saved settings are not loaded.

cnlohr commented 7 years ago

That is really weird.

Also! @Damme it looks like there is a change in the SDKs as of recent. Try erasing your ESP, and flashing the init data.

git fetch && git checkout dev
make erase initdefault burn

Charles

con-f-use commented 7 years ago

Okay in the mean time, I had one of my modules doing the same thing with resetting on IO direction change. But that went away on it's own. I really think it's either corrupted flash or a hardware issue. But the bug is real.

@Damme Did you have a chance to try @cnlohr's make initdefault?

Damme commented 7 years ago

I have put this project to the side at the moment and tried the same module with arduino-esp and seams to work fine. And yes, I did try erase and init default. I'll come back to this later with a brand new module to see if it was hardware error or not.

cnlohr commented 7 years ago

Ok. Just tried with a fresh ESP. make erase initdefault does in fact fix the constantly rebooting issues. So, this is likely a different issue.