【Feedback】Memory RTC read and write issue

rupak426
Posts: 23
Joined: Fri Apr 15, 2016 2:16 am

【Feedback】Memory RTC read and write issue

Postby rupak426 » Thu Jul 07, 2016 2:33 am

Hi,

I am trying to write data into system_rtc_memory so that data can be retrieved after deep sleep. I am writing on 65th block of memory address as read in some other blog that 64th address is used for system data and not for user data.
I am using latest SDK 1.5.4 with the latest patch SDK 1.5.4.1. Its ESP-01.

Code: Select all

Serial.println("RTC Memory Test");
byte rtcStore[2];
system_rtc_mem_read(65, rtcStore, 2);

Serial.print("current value = ");
Serial.println(*rtcStore);

(*rtcStore)++;
Serial.print("new value = ");
Serial.println(*rtcStore);

system_rtc_mem_write(65, rtcStore, 2);
ESP.deepSleep(30*1000000, WAKE_RF_DEFAULT);

delay(1000);


But I am not getting incremental data.
Can you provide some suggestion.

output:
RTC Memory Test
current value = 239
new value = 240

RTC Memory Test
current value = 239
new value = 240

thanks,
Rupak

ESP_Rubin
Posts: 222
Joined: Wed Jun 29, 2016 11:59 am

Re: Memory RTC read and write issue

Postby ESP_Rubin » Thu Jul 07, 2016 11:21 am

Hi,
i'm not sure the detail of your function:ESP.deepSleep(30*1000000, WAKE_RF_DEFAULT);
in my test, i used below code and test result is ok, you can try:
void user_init()
{
os_printf("======RTC read write test======\n");
uint8 rtcStore;
system_rtc_mem_read(65, &rtcStore, sizeof(rtcStore));
os_printf("currect value = %d\n", rtcStore);
rtcStore++;
os_printf("added value = %d\n", rtcStore);
system_rtc_mem_write(65, &rtcStore, sizeof(rtcStore));
system_deep_sleep(3*1000*1000);
}

UART log:
======RTC read write test======
currect value = 253
added value = 254
mode : softAP(1a:fe:34:ed:86:99)
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100

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

load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79

2nd boot version : 1.5
SPI Speed : 40MHz
SPI Mode : QIO
SPI Flash Size & Map: 32Mbit(1024KB+1024KB)
jump to run user1 @ 1000

rf[112] : 03
rf[113] : 00
rf[114] : 01

SDK ver: 1.5.4(baaeaebb) compiled @ May 17 2016 19:23:54
phy ver: 972, pp ver: 10.1

======RTC read write test======
currect value = 254
added value = 255
mode : softAP(1a:fe:34:ed:86:99)
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100

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

load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79

2nd boot version : 1.5
SPI Speed : 40MHz
SPI Mode : QIO
SPI Flash Size & Map: 32Mbit(1024KB+1024KB)
jump to run user1 @ 1000

rf[112] : 03
rf[113] : 00
rf[114] : 01

SDK ver: 1.5.4(baaeaebb) compiled @ May 17 2016 19:23:54
phy ver: 972, pp ver: 10.1

======RTC read write test======
currect value = 255
added value = 0
mode : softAP(1a:fe:34:ed:86:99)
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100

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

load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79

2nd boot version : 1.5
SPI Speed : 40MHz
SPI Mode : QIO
SPI Flash Size & Map: 32Mbit(1024KB+1024KB)
jump to run user1 @ 1000

rf[112] : 03
rf[113] : 00
rf[114] : 01

SDK ver: 1.5.4(baaeaebb) compiled @ May 17 2016 19:23:54
phy ver: 972, pp ver: 10.1

======RTC read write test======
currect value = 0
added value = 1
mode : softAP(1a:fe:34:ed:86:99)
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100

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

load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79

2nd boot version : 1.5
SPI Speed : 40MHz
SPI Mode : QIO
SPI Flash Size & Map: 32Mbit(1024KB+1024KB)
jump to run user1 @ 1000

rf[112] : 03
rf[113] : 00
rf[114] : 01

SDK ver: 1.5.4(baaeaebb) compiled @ May 17 2016 19:23:54
phy ver: 972, pp ver: 10.1

======RTC read write test======
currect value = 1
added value = 2
mode : softAP(1a:fe:34:ed:86:99)
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100

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

load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79

2nd boot version : 1.5
SPI Speed : 40MHz
SPI Mode : QIO
SPI Flash Size & Map: 32Mbit(1024KB+1024KB)
jump to run user1 @ 1000

rf[112] : 03
rf[113] : 00
rf[114] : 01

SDK ver: 1.5.4(baaeaebb) compiled @ May 17 2016 19:23:54
phy ver: 972, pp ver: 10.1

======RTC read write test======
currect value = 2
added value = 3
mode : softAP(1a:fe:34:ed:86:99)
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100

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

load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79

2nd boot version : 1.5
SPI Speed : 40MHz
SPI Mode : QIO
SPI Flash Size & Map: 32Mbit(1024KB+1024KB)
jump to run user1 @ 1000

rf[112] : 03
rf[113] : 00
rf[114] : 01

SDK ver: 1.5.4(baaeaebb) compiled @ May 17 2016 19:23:54
phy ver: 972, pp ver: 10.1

======RTC read write test======
currect value = 3
added value = 4
mode : softAP(1a:fe:34:ed:86:99)
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100

rupak426
Posts: 23
Joined: Fri Apr 15, 2016 2:16 am

Re: 【Feedback】Memory RTC read and write issue

Postby rupak426 » Fri Jul 08, 2016 5:42 pm

Hi,

I debugged further and found that I am seeing issue for RTC memory read and write due to below API:

Code: Select all

  WiFi.softAPmacAddress(mac); //Here mem value is getting set as 239 and 240
  clientName += getMacAddress(mac);


when the coed calls this API, mem value read starts showing 239 and it never gets reset.
can you please have a look.
Is there any other API which I can use as workaround.

thanks,
Rupak

ESP_Rubin
Posts: 222
Joined: Wed Jun 29, 2016 11:59 am

Re: 【Feedback】Memory RTC read and write issue

Postby ESP_Rubin » Fri Jul 08, 2016 9:13 pm

I never found the API in our ESP8266 SDK API guide, could you guide me which document you found the API?

rupak426
Posts: 23
Joined: Fri Apr 15, 2016 2:16 am

Re: 【Feedback】Memory RTC read and write issue

Postby rupak426 » Sat Jul 09, 2016 3:43 am

Hi,

Don't remember, from where I got it, but a quick search on esp8266 forum has given me below result.
can you have a look:

http://www.esp8266.com/viewtopic.php?f=29&t=3587

thanks,
Rupak

ESP_Rubin
Posts: 222
Joined: Wed Jun 29, 2016 11:59 am

Re: 【Feedback】Memory RTC read and write issue

Postby ESP_Rubin » Sat Jul 09, 2016 9:03 am

if you want to get or set wifi MAC address, please refer to our offical API as attached API guide
Attachments
2C-ESP8266-SDK__API Guide__EN_V1.5.3_20160429.pdf
(864.94 KiB) Downloaded 777 times

rupak426
Posts: 23
Joined: Fri Apr 15, 2016 2:16 am

Re: 【Feedback】Memory RTC read and write issue

Postby rupak426 » Sat Jul 09, 2016 9:12 pm

Thanks for the Doc.
Its really helpful.

Who is online

Users browsing this forum: No registered users and 3 guests