letscontrolit / ESPEasy

Easy MultiSensor device based on ESP8266/ESP32
http://www.espeasy.com
Other
3.27k stars 2.21k forks source link

FS : Error while reading/writing config.dat in 1007 / ESP8285 1MB / Itead PSF-B85 #1674

Closed fluppie closed 1 year ago

fluppie commented 6 years ago

If you self compile, please state this and PLEASE try to ONLY REPORT ISSUES WITH OFFICIAL BUILDS!

Self compiled through Atom + PlatformIO

Summarize of the problem/feature request

When I change settings and hit save I get this error: FS : Error while reading/writing config.dat in 1007

Expected behavior

No error :).

Actual behavior

Error + ESP Easy forgets the modified settings after a power cycle.

Steps to reproduce

  1. Take a 1MB module, preferably a ESP8285 module (ESP8266+1MB Flash). I use a Itead PSF-B85
  2. Flash the latest software
  3. Try to save some parameters in the web interface

System configuration

Hardware: Itead PSD-B85

ESP Easy version:

Build 20102 - Mega Libraries ESP82xx Core 2_4_2, NONOS SDK 2.2.1(cfd48f3), LWIP: 2.0.3 GIT version

Plugins 49 [Normal] Build time Aug 22 2018 13:51:51 Binary filename ThisIsTheDummyPlaceHolderForTheBinaryFilename64ByteLongFilenames

ESP board

ESP Chip ID | 8634151 (0x83BF27) ESP Chip Freq: | 80 MHz Storage Flash Chip ID | Vendor: 0x51 Device: 0x4014 Flash Chip Real Size: | 1024 kB Flash IDE Size: | 1024 kB Flash IDE speed: | 40 MHz Flash IDE mode: | DOUT Flash Writes | 8 daily / 8 boot Sketch Size | 732 kB (140 kB free)

ESP Easy settings/screenshots:

Rules or log data

571550: WD : Uptime 10 ConnectFailures 0 FreeMem 19424
576857: FILE : Saved config.dat
577002: FS : Error while reading/writing config.dat in 1007
578320: Timeout while reading input data!
582166: EVENT: Clock#Time=Thu,15:10
584606: FILE : Saved config.dat
584618: FS : Error while reading/writing config.dat in 1007
585949: Timeout while reading input data!
601549: WD : Uptime 10 ConnectFailures 0 FreeMem 19496
631549: WD : Uptime 11 ConnectFailures 0 FreeMem 19496
642170: EVENT: Clock#Time=Thu,15:11
TD-er commented 6 years ago

Can you give some listing of the files and their size on the SPIFF? You can get that from the Tools => Flash page on the webinterface

fluppie commented 6 years ago
  Filename Size
Del rules1.txt 0
  security.dat 4096
  notification.dat 4096
  config.dat 65536
TD-er commented 6 years ago

If you can build a version of your own, can you test with this setting set to 40960 ? #define CONFIG_FILE_SIZE 65536

fluppie commented 6 years ago

Upload

Filename    Size
config.dat  40960
security.dat    4096
notification.dat    4096

Del rules1.txt 0

PS C:\Users\Philippe\Documents\GitHub\ESPEasy> pio device monitor --port COM7 --baud 115200 --- Miniterm on COM7 115200,8,N,1 --- --- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H --- 89407 : AP Mode: Client connected: 58:40:4E:C5:DA:DA Connected devices: 1 89411 : Webserver: start 93236 : WIFI : Set WiFi to AP 93868 : WD : Uptime 2 ConnectFailures 0 FreeMem 17840 104572 : WIFI : Credentials Changed, retry connection. SSID: WiFi2016AP1 104603 : WIFI : Set WiFi to AP+STA 104636 : WIFI : Connecting WiFi2016AP1 attempt #0 107765 : WIFI : Connected! AP: WiFi2016AP1 (78:8A:20:5A:41:76) Ch: 1 Duration: 3128 ms 107795 : WIFI : DHCP IP: 192.168.1.27 (ESP-Easy-0) GW: 192.168.1.1 SN: 255.255.255.0 duration: 30 ms

ets Jan 8 2013,rst cause:1, boot mode:(3,7)

load 0x4010f000, len 1384, room 16 tail 8 chksum 0x2d csum 0x2d vbb28d4a3 ~ld �U107 :

INIT : Booting version: (ESP82xx Core 2_4_2, NONOS SDK 2.2.1(cfd48f3), LWIP: 2.0.3) 108 : INIT : Warm boot #2 - Restart Reason: Software/System restart 112 : FS : Mounting... 2741 : FS : Mount successful, used 0 bytes of 113201 RESET: Resetting factory defaults... RESET: Warm boot, reset count: 1 RESET: formatting... RESET: formatting done... 8175 : FILE : Saved config.dat 8214 : FILE : Saved security.dat RESET: Succesful, rebooting. (you might need to press the reset button if you've justed flashed the firmware)

ets Jan 8 2013,rst cause:1, boot mode:(3,7)

load 0x4010f000, len 1384, room 16 tail 8 chksum 0x2d csum 0x2d vbb28d4a3 ~ld

�U107 :

INIT : Booting version: (ESP82xx Core 2_4_2, NONOS SDK 2.2.1(cfd48f3), LWIP: 2.0.3) 107 : INIT : Warm boot #3 - Restart Reason: Software/System restart 112 : FS : Mounting... 118 : FS : Mount successful, used 50953 bytes of 113201 124 : CRC : No program memory checksum found. Check output of crc2.py 130 : CRC : SecuritySettings CRC ...OK 150 : INIT : Free RAM:26376 151 : INIT : I2C 151 : INIT : SPI not enabled 167 : INFO : Plugins: 49 [Normal] (ESP82xx Core 2_4_2, NONOS SDK 2.2.1(cfd48f3), LWIP: 2.0.3) 167 : WIFI : No valid wifi settings 168 : WIFI : Could not connect to AP! 171 : WIFI : Set WiFi to AP 1094 : WIFI : AP Mode ssid will be ESP_Easy_0 with address 192.168.4.1 2428 : WD : Uptime 0 ConnectFailures 0 FreeMem 23944 32428 : WD : Uptime 1 ConnectFailures 0 FreeMem 23944 37660 : AP Mode: Client connected: 58:40:4E:C5:DA:DA Connected devices: 1 37664 : Webserver: start 41355 : WIFI : Set WiFi to AP 56307 : WIFI : Credentials Changed, retry connection. SSID: WiFi2016AP1 56338 : WIFI : Set WiFi to AP+STA 56370 : WIFI : Connecting WiFi2016AP1 attempt #0 59490 : WIFI : Connected! AP: WiFi2016AP1 (78:8A:20:5A:41:76) Ch: 1 Duration: 3119 ms 62428 : WD : Uptime 1 ConnectFailures 0 FreeMem 18064 62970 : WIFI : DHCP IP: 192.168.1.27 (ESP-Easy-0) GW: 192.168.1.1 SN: 255.255.255.0 duration: 3480 ms

fluppie commented 6 years ago

Looks like when I don't check the checkbox of rules, config a NTP server and the DST settings it has no problems. If I do want to use these features the module resets/reformats after a power cycle.

fluppie commented 6 years ago

Adding the MQTT broker (was running Thingspeak)

31556: WD : Uptime 1 ConnectFailures 0 FreeMem 20952 41538: FILE : Saved config.dat 41614: FILE : Saved config.dat 51001: EVENT: Clock#Time=Fri,07:56 54689: FILE : Saved config.dat 54998: FILE : Saved config.dat 55156: FILE : Saved security.dat 55229: MQTT : Intentional reconnect 55248: MQTT : Connected to broker with client ID: ESPClient_DC:4F:22:83:BF:27 55250: Subscribed to: /PSF-B85_100/# 55252: EVENT: MQTT#Connected 61556: WD : Uptime 1 ConnectFailures 0 FreeMem 20688

Adding Systeminfo / uptime:

91555: WD : Uptime 2 ConnectFailures 0 FreeMem 20544 92518: FILE : Saved config.dat 92526: FS : Error while reading/writing config.dat in 1131 92900: FILE : Saved config.dat 102058: FILE : Saved config.dat 102066: FS : Error while reading/writing config.dat in 1131 102345: FILE : Saved config.dat 102489: SYS : 2.00 102492: EVENT: Uptime_100#=2.00 111009: EVENT: Clock#Time=Fri,07:57 121555: WD : Uptime 2 ConnectFailures 0 FreeMem 20464

Playing with DST offset: 197285: FILE : Saved config.dat 197312: EVENT: Time#Set 198001: EVENT: Clock#Time=Fri,07:58

Is the position of data fixed in the config.dat file? Or how does it work? Remember this 8285 is a 1MB module.

Storage

Flash Chip ID | Vendor: 0x51 Device: 0x4014 Flash Chip Real Size: | 1024 kB Flash IDE Size: | 1024 kB Flash IDE speed: | 40 MHz Flash IDE mode: | DOUT Flash Writes | 28 daily / 28 boot Sketch Size | 732 kB (140 kB free)

TD-er commented 6 years ago

Data is always stored in the same order at the same position. I added some visual representation of the memory layout to the sysinfo page. You have to run the command meminfodetail first to enable it.

TD-er commented 6 years ago

About setting DST... The EU may fix that ;)

TD-er commented 6 years ago

Just a question about the version you're running. If it is a self-made build, can you give as much info as possible on the build env? (PIO core version, OS, 32/64 bit OS, etc) There seems to be an issue with byte alignment in systems built on Windows and those build on Linux.

I had some discussion with Theo Arends from Tasmota via email and he pointed me to this thread on Tasmota: https://github.com/arendst/Sonoff-Tasmota/issues/3385#issuecomment-409957965 And to this change in code indicating the change of builds made on Windows: https://github.com/arendst/Sonoff-Tasmota/pull/3623

fluppie commented 6 years ago

I run Atom 1.30.0 x64 with PlatformIO 3.6.1a1 Electron: 2.0.5 Node: v8.9.3 My OS is Windows 10 x64 1803

And the build was the latest GIT pull (I use Github Desktop for Windows)

tonhuisman commented 1 year ago

This issue is no longer relevant, and can be closed.