ESP32-S2-DevKit-Lipo-USB RTC not working

Started by findmyname, June 11, 2021, 03:26:27 PM

Previous topic - Next topic

findmyname

Hi everybody,

I'm trying to store var in RTC slow memory but after deep sleep the variable has always default value. I'm kind of lost. Used board ESP32-S2-DevKit-Lipo-USB and framework ESP-IDF.

I define var at the begging of the program:

RTC_DATA_ATTR static int bat_v_rtc;
I increment the var just for the test in the main code:
bat_v_rtc++;
I also print it before and after increment operation.

I enter DS, I also explicitly activate RTC slow memory:

    esp_wifi_stop();
    ESP_ERROR_CHECK( esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_ON) );
    esp_deep_sleep(sleep_interval)

When the VAR is printed when the board is up again the VAR has default value 0.
Do you know what can be wrong ?

Also this esp-idf example always prints boot count: 1.

Do you know guys if RTC should work for this board ?

Thx

JohnS

Maybe print the address of the thing(s) with RTC_DATA_ATTR to see if they have actually been put in the right place.

May be a software issue that they are not in there!

John

findmyname

Quote from: JohnS on June 12, 2021, 12:31:04 PMMaybe print the address of the thing(s) with RTC_DATA_ATTR to see if they have actually been put in the right place.

May be a software issue that they are not in there!

John

Hi John,

The value of pointer is 0x50000014.

BR

JohnS

#3
And what does the datasheet say for the memory area you want it in?

Then if it's in the right area I guess you look how (if at all) it needs powering and/or configuring.

John

findmyname

Quote from: JohnS on June 14, 2021, 01:47:54 AMAnd what does the datasheet say for the memory area you want it in?

Then if it's in the right area I guess you look how (if at all) it needs powering and/or configuring.

John

Hi John,

Thanks for your advice.
I looked on the esp32-s2 DOC and it seems that RTC SLOW memory starts at 0x50000000.
1)
```
The "Mem" written is the RTC_SLOW_MEM memory. Address 0, as seen by the ULP coprocessor,corresponds to address 0x50000000, as seen by the main C
```
2)
```
The program is stored in a dedicated region called Slow Memory, which is visible to the main CPU as one that has an address range of0x5000_0000 to 0x5000_1FFF (8 KB).
```

JohnS

That looks OK.

Is the ULP enabled? It looks not to be, by default.

John

findmyname

Quote from: JohnS on June 15, 2021, 12:42:14 AMThat looks OK.

Is the ULP enabled? It looks not to be, by default.

John

I did enable option Enable Ultra Low Power (ULP) Coprocessor but it didn't helped.

findmyname

Does anybody figure it out pls? I guess this issue is caused by framework so somebody with enough knowledge should fix it :)

findmyname

Anybody from Olimex here to take a look on this issue pls?
The product doesn't seem to work as advertised.

LubOlimex

#9
"Anybody from Olimex here to take a look on this issue pls?"

Unfortunately, it seems the hardware is working fine and fixing the described software behavior is beyond our knowledge.

Maybe test with Arduino IDE instead of ESP-IDF. From my experience Arduino IDE trivializes the usage of the deep sleep function. I usually use Arduino IDE for my deep sleep tests about power consumption.

My advice is to post in the espressif support forums and also contact the ESP-IDF community. Maybe it is something known.

"The product doesn't seem to work as advertised."

What? We never advertised the product to be capable to store RTC while in deep sleep and while using exactly ESP-IDF environment. That is too specific to advertise.
Technical support and documentation manager at Olimex

olimex

from the same technical reference manual linked above:

9.5 RTC Boot
The wakeup time for Deep-sleep and Hibernation modes are much longer, compared to the Light-sleep and
Modem-sleep, because the ROMs and RAMs are both powered down in this case, and the CPU needs more
time for ROM unpacking and data-copying from the flash (SPI booting). However, it's worth noting that both RTC
fast memory and RTC slow memory remain powered up in the Deep-sleep mode. Therefore, users can store
codes (so called "deep sleep wake stub" of up to 8 KB) either in RTC fast memory or RTC slow memory to avoid
the above-mentioned ROM unpacking and SPI booting, thus speeding up the wakeup process.


i.e. in deep sleep RAM memory is powered DOWN and whatever you write in it it's lost

findmyname

Quote from: LubOlimex on September 09, 2021, 02:17:35 PMMaybe test with Arduino IDE instead of ESP-IDF. From my experience Arduino IDE trivializes the usage of the deep sleep function. I usually use Arduino IDE for my deep sleep tests about power consumption.
I could but I never used Ardunio IDE.
Not sure that I want to start with it.

Quote from: LubOlimex on September 09, 2021, 02:17:35 PMMy advice is to post in the espressif support forums and also contact the ESP-IDF community. Maybe it is something known.
I did but no reply so far.

Quote from: LubOlimex on September 09, 2021, 02:17:35 PMWhat? We never advertised the product to be capable to store RTC while in deep sleep and while using exactly ESP-IDF environment. That is too specific to advertise.
It is too specific but the page for ESP32-S2-DevKit-Lipo-USB claims:

```
ESP32-S2-DevKit-Lipo-USB board is pin-to-pin compatible with Espressif ESP32-Saola-1, but adds Lipo charger and the ability to work on LiPo power when external power supply is missing, allowing handheld applications.
```
So it really depends how you interpret it e.g. if deep sleep + RTC memory is working for ESP32-Saola-1 one would expect that it should work also for DevKit-Lipo.

Quotei.e. in deep sleep RAM memory is powered DOWN and whatever you write in it it's lost
Hmm wait but I guess RTC memory is designed to survive DEEP sleep - see example https://diyprojects.io/esp32-store-temporary-data-rtc-memory-deep-sleep.

LubOlimex

Now that you mentioned ESP32-Saola-1 I think I figured it out!

Can you check if ESP32-Saola-1 and the Olimex ESP32-S2-DevKit-Lipo-USB board have the same ESP32-S2 module? Looking at the documentation it would seem that this is not the case. ESP32-Saola-1 has ESP32-S2-WROVER while ESP32-S2-DevKit-Lipo-USB has ESP32-S2-WROOM.

And there are hardware differences between WROOM and WROVER modules. WROVER has 2 MB PSRAM, and WROOM lacks such PSRAM.

Probably the board that would behave exactly like ESP32-Saola-1 would be the variant called ESP32-S2-WROVER-DevKit-LiPo-USB (it has ESP32-S2-WROVER)

> So it really depends how you interpret it e.g. if deep sleep + RTC memory is working for ESP32-Saola-1 one would expect that it should work also for DevKit-Lipo.

Read again what you quoted carefully. What you quoted says that the boards are pin-to-pin compatible, e.g. it has same connectors and spacing. It never said it is drop-in replaceable and has exactly the same behavior.
Technical support and documentation manager at Olimex

findmyname

Quote from: LubOlimex on September 10, 2021, 09:30:06 AMAnd there are hardware differences between WROOM and WROVER modules. WROVER has 2 MB PSRAM, and WROOM lacks such PSRAM.

Hmm does it mean that RTC works only if there is PSRAM ?
But it kind of make sense - info from https://diyprojects.io/esp32-store-temporary-data-rtc-memory-deep-sleep
```
8 KB of RTC SRAM, called RTC FAST memory, can be used for data storage. It is accessible by the main processor during RTC boot when exiting Deep-Sleep mode.
8 KB of RTC SRAM, called RTC SLOW memory and accessible by the ULP coprocessor when the processor is in Deep-Sleep.
```
I expect PSRAM == SRAM.

timokett81

This does not add up. PSRAM != SRAM. The WROVER has 2MB PSRAM. WROOM does not.
I have Olimex ESP32-S2-WROVER-DevKit-LiPo-USB and Espressif ESP32-S2-Saola-1 with WROOM (Saola is available in both WROOM amd WROVER modules).
The espressif deep sleep example works with Saola WROOM. It does not fully work with Olimex WROVER. The RTC slow memory used by the example does not work.
So I have detected the same problem than findmyname.
It is not about the PSRAM since it works with WROOM.
Deep sleep with ULP is quite useless without working RTC slow memory since there is no way to pass results between ULP and main processor.
I bought five modules from Olimex in order to do ULP SW and now I am really disappointed if this is not solved. Since it is not about module itself, it has something to do with wiring of it.