-->
Page 1 of 2

EEPROM on esp8266 cause some problems!!!

PostPosted: Sun Oct 01, 2017 2:23 am
by mahdinga
hello guys!!!

recently, i made a project on esp8266 07.
i have to use eeprom to save some information(including ssid and password that esp should make an access point)
these information change during running of esp and saves frequently.

the main problem is when i put
EEPROM.begin(512);
in the begining, esp heads for a major problem:

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

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

Exception (3):
epc1=0x40100221 epc2=0x00000000 epc3=0x00000000 excvaddr=0x40011730 depc=0x00000000

ctx: cont
sp: 3fff0c10 end: 3fff0eb0 offset: 01a0

>>>stack>>>
3fff0db0: 3ffefe38 00001d18 00001d18 4010020c
3fff0dc0: 3ffe8368 3ffe8e34 3fff0e1c 4010068c
3fff0dd0: 3fffc718 3fff2734 3ffefc7c 40207150
3fff0de0: 0007b000 40206b85 3fff0e00 40202780
3fff0df0: 00000010 3ffe8e34 3ffefc7c 40203652
3fff0e00: ffffffff ffffffff ffffffff 0effffff
3fff0e10: ff000000 ffffffff 0000000f ffffffff
3fff0e20: ffffffff ffffffff ffffffff ffffffff
3fff0e30: ffffffff ffffffff ffffffff ffffffff
3fff0e40: ffffffff ffffffff ffffffff ffffffff
3fff0e50: ffffffff ffffffff 3ffefe58 40207544
3fff0e60: 3ffe0001 3ffefc7c 00001000 3ffefe84
3fff0e70: 3ffefc7c 3ffe8e34 3ffefe58 402036dc
3fff0e80: 3fff373c 0000000f 00000002 feefeffe
3fff0e90: 3fffdad0 00000000 3ffefe7c 40207990
3fff0ea0: feefeffe feefeffe 3ffefe90 40100718
<<<stack<<<


when i delete EEPROM.begin(); and flash it, esp works well but the information stored in eeprom changes and destroys rapidly.

in addition, i am saving a struct including some (String)s and (int)s(3 Strings and 12 int) and i use EEPROM.put(1,MyStruct); for saving data and EEPROM.get(1,MyStruct); for retrieving data.

now, what should i do to be able to use eeprom and esp itself!!!????
Thank you alot !!! :)

Re: EEPROM on esp8266 cause some problems!!!

PostPosted: Sun Oct 01, 2017 3:29 am
by schufti
It is hard to say anything because you tell nothing about your environment (esp8266 arduino core version, settings, sketch).
Tested EEPROM_read example with NodeMCU1.0 / 1M spiff setting with 2.4rc1 core without problem.

If the example fails, try to upgrade your esp arduino core.

Re: EEPROM on esp8266 cause some problems!!!

PostPosted: Sun Oct 01, 2017 6:31 am
by andre_teprom
The type of message above (not the content, but the format) is typical of watchdog reset, whose frequent cause is the use of long loops in the main process, delaying the refresh of Wifi routines (at least in Arduino).

Re: EEPROM on esp8266 cause some problems!!!

PostPosted: Sun Oct 01, 2017 9:48 am
by martinayotte
mahdinga wrote:hello guys!!!
in addition, i am saving a struct including some (String)s and (int)s(3 Strings and 12 int) and i use EEPROM.put(1,MyStruct); for saving data and EEPROM.get(1,MyStruct); for retrieving data.


Be carefull how you manage your String in the structure, because they are pointer to String object not to character array expected, so when restored, the pointer is pointing to no where, therefore you get such crashes...
Your structures should contains character arrays with predefined length, and then you should copy the String into it using "memcpy(st.str, str.c_str(), str.length());"