ESP32 not saving preferences (Wifi, NTP, Rules, etc.)

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
KaiK
New user
Posts: 9
Joined: 12 Nov 2016, 10:22

ESP32 not saving preferences (Wifi, NTP, Rules, etc.)

#1 Post by KaiK » 07 May 2023, 10:23

Dear all,

I have a few ESP8266 and ESP32 running ESP Easy smoothly, but recently I stumbled across a problem:
- Using ESP32 Relay board: LILYGO TTGO T-Relay ESP32 4MB Flash
- Spec saying it is a ESP32-Wrover-B 4MB Flash 8MB RAM
- I have flashed ESP_Easy_mega_20230409_normal_ESP32_4M316k.factory.bin using the flash_download_tool_3.9.3
- Device is coming up with ESP Easy, I can connect via Wifi and put in my local Wifi settings
- Device is connecting to my local Wifi
- I can connect NPT, Rules, etc.
- But: When I do a hard reboot (power off) device is loosing all settings and rebooting with factory settings (local Wifi access point, without any other settings done before)

What I tried already:
- Flasing ESP_Easy_mega_20230409_normal_ESP32_4M316k.bin via Webinterface after flashing ESP_Easy_mega_20230409_normal_ESP32_4M316k.factory.bin using the flash_download_tool_3.9.3
- Flashing blank_4MB.bin via flash_download_tool_3.9.3 and then flashing ESP_Easy_mega_20230409_normal_ESP32_4M316k.factory.bin using the flash_download_tool_3.9.3

What I did not try so far:
- ESP_Easy_mega_20230409_normal_ESP32_4M316k_LittleFS.factory

Do you have any ideas what could be the cause?
(I found some references to PUYA flash chip from 2018, but this does not seem to be a topic for ESP32)

Thank you!

Best
Kai

TD-er
Core team member
Posts: 8739
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP32 not saving preferences (Wifi, NTP, Rules, etc.)

#2 Post by TD-er » 07 May 2023, 12:17

The WROVER modules are for sure not using PUYA chips.
As far as I know those were only used on 1MB ESP8266 modules.

However some ESP32-WROVER boards do use flash chips running at a different voltage compared to almost any module released later.
GPIO-12 on the ESP32 is one of the so called "boot strapping" pins, meaning its state during boot does set something in the module.
The boot state of GPIO-12 does set the flash voltage.

Is something connected to GPIO-12? And is it possible this could force the boot state of that pin to a specific state?

Another option can be when GPIO-1 and GPIO-3 are shorted.
This does force ESPEasy to perform a factory reset at boot.

KaiK
New user
Posts: 9
Joined: 12 Nov 2016, 10:22

Re: ESP32 not saving preferences (Wifi, NTP, Rules, etc.)

#3 Post by KaiK » 08 May 2023, 21:09

The "datasheet" does not tell me something with regards to GPIO12/1/3.
Hf69e9ed375094191975cc5946d53a968K.jpg_640x640q90.jpg
Hf69e9ed375094191975cc5946d53a968K.jpg_640x640q90.jpg (121.52 KiB) Viewed 1505 times
Following the print on the ESP it is a ESP-WROVER-E
Based on pinout from here (page 11): https://www.espressif.com/sites/default ... eet_en.pdf

Checking with the multimeter GPIO12 seems to be floaiting.
GPIO-1 and GPIO-3 are not shorted/connected.

TD-er
Core team member
Posts: 8739
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP32 not saving preferences (Wifi, NTP, Rules, etc.)

#4 Post by TD-er » 08 May 2023, 22:13

On the sysinfo page, or via the output of esptool.py (that one is the preferred one), you can see what CPU is used inside the module.
Is it the ESP32-D0WD-V3 or is it the ESP32-D0WDR2-V3 ? (the number after the "R" may be different)
The one with the "R" does have the QSPI PSRAM embedded in the chip.

On the metal of the WROVER there is probably also something printed like ESP32-WROVER-E-N4R8.

Maybe you can also run this test build: https://github.com/letscontrolit/ESPEas ... 4914697503
It has a new item on the sysinfo page showing the CPU Features as reported by the CPU.
Not all ESPs seem to have these set, but perhaps the modules made by Espressif themselves have these CPU features burnt in the E-Fuses.

Please show all which is shown on the sysinfo page.
Especially the "memory", "ESP Board" and "Storage" part and when possible the "Partitions"

KaiK
New user
Posts: 9
Joined: 12 Nov 2016, 10:22

Re: ESP32 not saving preferences (Wifi, NTP, Rules, etc.)

#5 Post by KaiK » 08 May 2023, 22:27

From the test build (ESPEasy_mega_20230508_ESP32_PR#4640_4914697503) using ESP_Easy_mega_20230508_normal_ESP32_4M316k.factory.bin:

Memory
Heap Size: 307032
Heap Min Free: 195500
Free RAM: 210924 (195500 - sendContentBlocking)
Heap Max Free Block: 110580
Free Stack: 7440 (5164 - sendContentBlocking)
PSRAM Size: 4192107
PSRAM Free: 4187947
PSRAM Min Free: 4187947
PSRAM Max Free Block: 4128756

ESP Board
ESP Chip ID: 4973340 (0x4BE31C)
ESP Chip Frequency: 240 MHz
ESP Crystal Frequency: 40 MHz
ESP APB Frequency: 80 MHz
ESP Chip Model: ESP32-D0WDQ5-V3
Features: Wi-Fi bgn / BLE
ESP Chip Revision: 300
ESP Chip Cores: 2
ESP Board Name: Espressif Generic ESP32 4M Flash ESPEasy 1810k Code/OTA 316k FS

Storage
Flash Chip ID: Vendor: 0x5E Device: 0x4016
Flash Chip Real Size: 4096 kB
Flash IDE Size: 4096 kB
Flash Chip Speed: 80 MHz
Flash IDE Speed: 40 MHz
Flash IDE Mode: DIO
Flash Writes: 7 daily / 8 boot
Sketch Size: 1325 kB (1856 kB free)
Max. OTA Sketch Size: 1856 kB (1900544 bytes)
SPIFFS Size: 283 kB (128 kB free)
Page size: 256
Block size: 8192
Number of blocks: 35
Screenshot 2023-05-08 222659.png
Screenshot 2023-05-08 222659.png (12.89 KiB) Viewed 1498 times
20230508_210857.jpg
20230508_210857.jpg (1.18 MiB) Viewed 1498 times

TD-er
Core team member
Posts: 8739
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP32 not saving preferences (Wifi, NTP, Rules, etc.)

#6 Post by TD-er » 08 May 2023, 23:00

And what happens if you enter "save" in the command field on the tools page?
Please either keep a web log view open in another tab, or the log via the serial port (then you can also enter this command via the serial port)

I would like to see which file(s) are being saved.

KaiK
New user
Posts: 9
Joined: 12 Nov 2016, 10:22

Re: ESP32 not saving preferences (Wifi, NTP, Rules, etc.)

#7 Post by KaiK » 09 May 2023, 07:13

Output via Serial connection while initially (after power off) setting WiFi and NTP server.
(had to do a soft-reboot via "reboot" bcause internal AP didnt show in first try...)

Code: Select all

y▒bD▒«▒!▒▒▒▒▒▒9▒▒▒1755455 : Info   : WD   : Uptime 29 ConnectFailures 0 FreeMem                                                                                                                                                              225972 WiFiStatus WL_DISCONNECTED 6 ESPeasy internal wifi status: DISCONNECTED
>testdfdfsave
1785105 : Info   : Command unknown: testdfdfsave
Command unknown: testdfdfsave
1785455 : Info   : WD   : Uptime 30 ConnectFailures 0 FreeMem 225972 WiFiStatus                                                                                                                                                              WL_DISCONNECTED 6 ESPeasy internal wifi status: DISCONNECTED
>save
1789026 : Info   : Skip saving settings, not changed
1789027 : Info   : Skip saving SecuritySettings, not changed

OK
1789961 : Info   : WiFi : Start network scan all channels
1796576 : Info   : WiFi : Scan finished, found: 17
1796579 : Info   : WIFI : Arduino wifi status: WL_DISCONNECTED 6 ESPeasy interna                                                                                                                                                             l wifi status: DISCONNECTED
>reboot
1810397 : Info   : WiFi : WifiDisconnect()
1810501 : Info   : WIFI : Disconnected! Reason: '(1) Unspecified'
1810502 : Info   : WIFI : Arduino wifi status: WL_DISCONNECTED 6 ESPeasy interna                                                                                                                                                             l wifi status: DISCONNECTED
1810603 : Info   : WIFI : Set WiFi to OFFets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:184
load:0x40078000,len:12680
load:0x40080400,len:2908
entry 0x400805c4
133 : Info   : Using PSRAM▒U
147 : Info   :

INIT : Booting version: ESP_Easy_mega_20230508_normal_ESP32_4M316k, (GitHub Acti                                                                                                                                                             ons) HEAD_d2da175 (ESP32 SDK 4.4.4.20230310)
148 : Info   : INIT : Free RAM:285348
149 : Info   : INIT : Soft Reboot #1 Last Action before Reboot: Intended Reboot:                                                                                                                                                              CommandReboot Last systime: 1810 - Restart Reason: CPU0: Software reset CPU CPU                                                                                                                                                             1: Software reset CPU
150 : Info   : FS   : Mounting...
174 : Info   : FS   : Mount successful, used 141815 bytes of 290156
188 : Info   : CRC  : Settings CRC           ...OK
194 : Info   : CRC  : SecuritySettings CRC   ...OK
199 : Info   : INIT : SPI not enabled
201 : Info   : Set Network mode: WiFi
303 : Info   : WIFI : Set WiFi to STA
404 : Info   : WiFi : Event STA Started
504 : Info   : WiFi : Start network scan all channels
6919 : Info   : WiFi : Scan finished, found: 18
6922 : Info   : WiFi : Start network scan all channels
13537 : Info   : WiFi : Scan finished, found: 18
13540 : Info   : Setup: Scan all channels
13556 : Info   : INIT : Free RAM:236124
13636 : Info   : INFO : Plugins: 47 [Normal] (ESP32 SDK 4.4.4.20230310)
13638 : Error  : WIFI : No valid wifi settings
13639 : Info   : WiFi : WiFiConnected(), start AP
13741 : Info   : WIFI : Set WiFi to AP+STA
13745 : Info   : WiFi : Event AP Started
14305 : Info   : WiFi : Event AP Stopped
14306 : Info   : WiFi : Event AP Started
14307 : Info   : WIFI : AP Mode ssid will be ESP-Easy with address 192.168.4.1
14309 : Info   : WIFI : Arduino wifi status: WL_DISCONNECTED 6 ESPeasy internal                                                                                                                                                              wifi status: DISCONNECTED
14314 : Info   : Webserver: start
15655 : Info   : WD   : Uptime 0 ConnectFailures 0 FreeMem 223332 WiFiStatus WL_                                                                                                                                                             DISCONNECTED 6 ESPeasy internal wifi status: DISCONNECTED
25456 : Info   : AP Mode: Client connected: DC:21:5C:3C:59:6A Connected devices:                                                                                                                                                              1
30199 : Error  : UNKNOWN WIFI/ETH EVENT: 14
45668 : Info   : WD   : Uptime 1 ConnectFailures 0 FreeMem 217420 WiFiStatus WL_DISCONNECTED 6 ESPeasy internal wifi status: DISCONNECTED
68655 : Info   :  Webserver 3 Arguments: 0: 'ssid' length: 10 1: 'other' length: 0 2: 'pass' length: 63
68657 : Info   : Skip saving settings, not changed
68658 : Info   : SaveToFile: free stack: 7104
68684 : Info   : FILE : Saved security.dat offset: 0 size: 593
68685 : Info   : SaveToFile: free stack after: 7104
68687 : Info   : WiFi : WifiDisconnect()
68791 : Info   : WIFI : Disconnected! Reason: '(1) Unspecified'
68792 : Info   : WIFI : Arduino wifi status: WL_DISCONNECTED 6 ESPeasy internal wifi status: DISCONNECTED
68892 : Info   : Reset WiFi.
68895 : Info   : WiFi : Start network scan all channels
75744 : Info   : WiFi : Best AP candidate: Freiheit2G 7E:8A:20:2A:06:48 Ch:1 (-73dBm) WPA2/PSK bgn
75745 : Info   : WiFi : Scan finished, found: 16
75748 : Info   : WiFi : Best AP candidate: Freiheit2G 7E:8A:20:8A:56:52 Ch:6 (-74dBm) WPA2/PSK bgn
75749 : Info   : WiFi : Added known candidate, try to connect
75749 : Info   : WiFi : WifiDisconnect()
75853 : Info   : WIFI : Disconnected! Reason: '(1) Unspecified'
75855 : Info   : WIFI : Arduino wifi status: WL_DISCONNECTED 6 ESPeasy internal wifi status: DISCONNECTED
75955 : Info   : WIFI : Set WiFi to OFF
76307 : Info   : WIFI : Set WiFi to STA
76319 : Info   : WiFi : Event STA Started
76419 : Info   : WIFI : Connecting Freiheit2G 7E:8A:20:8A:56:52 Ch:6 (-74dBm) WPA2/PSK bgn attempt #1
76428 : Info   : WIFI : Credentials Changed, retry connection. SSID: Freiheit2G
76993 : Info   : WIFI : Connected! AP: Freiheit2G (7E:8A:20:8A:56:52) Ch: 6 Duration: 552 ms
76995 : Info   : WIFI : Arduino wifi status: WL_IDLE_STATUS 0 ESPeasy internal wifi status: Conn.
77000 : Info   : WD   : Uptime 1 ConnectFailures 0 FreeMem 224800 WiFiStatus WL_CONNECTED 3 ESPeasy internal wifi status: Conn.
77024 : Info   : WIFI : DHCP IP: 192.168.2.59 (ESP-Easy) GW: 192.168.2.1 SN: 255.255.255.0 DNS: 192.168.2.1 / 0.0.0.0   duration: 26 ms
77026 : Info   : Skip saving SecuritySettings, not changed
77078 : Info   : UDP : Start listening on port 8266
77078 : Info   : firstLoopConnectionsEstablished
95883 : Info   : static_file: /esp.css
96094 : Info   : static_file: /favicon.ico
98867 : Info   : static_file: /esp.css
98869 : Info   : Serve 304: 1054270122 /esp.css
100839 : Info   : static_file: /esp.css
100841 : Info   : Serve 304: 1054270122 /esp.css
105648 : Info   : WD   : Uptime 2 ConnectFailures 0 FreeMem 220780 WiFiStatus WL_CONNECTED 3 ESPeasy internal wifi status: Conn. IP Init
106907 : Info   :  Webserver 33 Arguments (First 20): 0: 'enable_rules_cache' length: 2 1: 'usentp' length: 2 2: 'ntphost' length: 15 3: 'exttimesource' length: 1 4: 'dststartweek' length: 1 5: 'dststartdow' length: 1 6: 'dststartmonth' length: 1 7: 'dststarthour' length: 1 8: 'dstendweek' length: 1 9: 'dstenddow' length: 1 10: 'dstendmonth' length: 2 11: 'dstendhour' length: 1 12: 'timezone' length: 1 13: 'latitude' length: 8 14: 'longitude' length: 8 15: 'syslogip' length: 0 16: 'syslogport' length: 3 17: 'syslog_log_level' length: 1 18: 'syslogfacility' length: 1 19: 'serial_log_level' length: 1
106915 : Info   : SaveToFile: free stack: 7216
106990 : Info   : FILE : Saved config.dat offset: 0 size: 3024
106991 : Info   : SaveToFile: free stack after: 7216
106992 : Info   : Skip saving SecuritySettings, not changed
106994 : Info   : IP   : Set DNS: 192.168.2.1
107034 : Info   : NTP  : NTP replied: delay 21 mSec Accuracy increased by 0.381 seconds
107036 : Info   : Time set to 1683609048.381
107037 : Info   : Current Time Zone: STD time start: 2023-10-29 03:00:00 offset: 0 min
107039 : Info   : Local time: 2023-05-09 05:10:48
107195 : Info   : static_file: /esp.css

TD-er
Core team member
Posts: 8739
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP32 not saving preferences (Wifi, NTP, Rules, etc.)

#8 Post by TD-er » 09 May 2023, 09:49

Ehh you were saving while not being connected to WiFi?
The idea was to test if you could save the settings while being connected.

I got the impression that the interaction with the flash may corrupt data so it does a factory reset after a reboot.

So can you try this via the console:

Code: Select all

wifissid,YourWiFiNetworkName
wifikey,YourWiFiPassword
save
wifidisconnect
If the unit successfully connects, you might want to do a reboot to see if that is working.

KaiK
New user
Posts: 9
Joined: 12 Nov 2016, 10:22

Re: ESP32 not saving preferences (Wifi, NTP, Rules, etc.)

#9 Post by KaiK » 09 May 2023, 15:32

Just an idea: My wifi password has 63 characters. Could that cause a problem?

User avatar
Ath
Normal user
Posts: 3488
Joined: 10 Jun 2018, 12:06
Location: NL

Re: ESP32 not saving preferences (Wifi, NTP, Rules, etc.)

#10 Post by Ath » 09 May 2023, 16:34

KaiK wrote: 09 May 2023, 15:32 Just an idea: My wifi password has 63 characters. Could that cause a problem?
:lol: :lol: :lol: Most likely: yes.
/Ton (PayPal.me)

KaiK
New user
Posts: 9
Joined: 12 Nov 2016, 10:22

Re: ESP32 not saving preferences (Wifi, NTP, Rules, etc.)

#11 Post by KaiK » 09 May 2023, 16:44

Ehhh, maybe I found the root cause.

The Lilygo Board does not have a USB2Serial on board but ships with a Tiny USB-C USB2Serial.
It is connected via USB-C connector to the board (strange to use a USB-C adapter for serial.
Somewhere in the docs it is described, the board can be powered via USB-C without the adapter.

I found out, that the board seems to reset config, if I am connecting the board to a AC-power adapter directly with USB-C cable (without the tiny USB2Serial ) -> maybe there is a bridge between GPIO01 and GPIO03 in the AC adapter...
H3d8276273ca04926a63fd8aa7e6b99a9B.jpg_640x640q90.jpg
H3d8276273ca04926a63fd8aa7e6b99a9B.jpg_640x640q90.jpg (115.84 KiB) Viewed 1453 times
Maybe see also: https://github.com/Xinyuan-LilyGO/LilyG ... /Schematic

TD-er
Core team member
Posts: 8739
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP32 not saving preferences (Wifi, NTP, Rules, etc.)

#12 Post by TD-er » 09 May 2023, 17:06

It doesn't even need to be a short.

ESPEasy does send a string on the TX port and if that exact string is received on the RX port, it will consider the RX/TX pin shorted.
This can also be done via some resistor.

KaiK
New user
Posts: 9
Joined: 12 Nov 2016, 10:22

Re: ESP32 not saving preferences (Wifi, NTP, Rules, etc.)

#13 Post by KaiK » 09 May 2023, 17:45

Thanks for your help - so it seems we found the root cause - I will give a hint to the Lilygo developers...


TD-er
Core team member
Posts: 8739
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP32 not saving preferences (Wifi, NTP, Rules, etc.)

#15 Post by TD-er » 09 May 2023, 18:13

As stated here: https://en.wikipedia.org/wiki/USB_hardw ... y_charging
There is a resistor over D+ and D- when using an USB charger.

TD-er
Core team member
Posts: 8739
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP32 not saving preferences (Wifi, NTP, Rules, etc.)

#16 Post by TD-er » 09 May 2023, 18:22

Jason2866 pointed me to this thread on Tasmota:
https://github.com/arendst/Tasmota/discussions/16060

Post Reply

Who is online

Users browsing this forum: No registered users and 32 guests