esp_wake_deep_sleep not called

gatisp
Posts: 19
Joined: Thu May 26, 2016 11:49 am

esp_wake_deep_sleep not called

Postby gatisp » Sun Oct 29, 2017 11:50 am

Hello,

It seems that after using light sleep in an app and then going to deep sleep the deep sleep wake stub is not called after waking from deep sleep.

Here is a sample program that shows the problem:

Code: Select all

#include "freertos/FreeRTOS.h"

#define DEEP_SLEEP_STATUS_ADDR 0x3ff81ff8
#define DEEP_SLEEP_STATUS *((volatile unsigned *)DEEP_SLEEP_STATUS_ADDR)

void RTC_IRAM_ATTR esp_wake_deep_sleep(void) {
    esp_default_wake_deep_sleep();
    DEEP_SLEEP_STATUS = 0;
}

void app_main(void) {
    printf("deep_sleep_status:%d\n", DEEP_SLEEP_STATUS);

    esp_sleep_enable_timer_wakeup(1000 * 1000);
    esp_light_sleep_start();

    printf("after light sleep\n");
    DEEP_SLEEP_STATUS = 1;
    esp_deep_sleep(1000 * 1000);
}
Note the use of RTC_FAST mem as scratchpad for storing deep sleep status.

The program generates output:

Code: Select all

2017.10.29-13:33:11.645<2>: target: deep_sleep_status:1626178098
2017.10.29-13:33:12.507<2>: target: after light sleep
2017.10.29-13:33:13.434<2>: target: deep_sleep_status:1
2017.10.29-13:33:14.292<2>: target: after light sleep
2017.10.29-13:33:15.214<2>: target: deep_sleep_status:1
2017.10.29-13:33:16.073<2>: target: after light sleep
2017.10.29-13:33:16.998<2>: target: deep_sleep_status:1
2017.10.29-13:33:17.854<2>: target: after light sleep
Whereas I would expect deep_sleep_status to be zero. Commenting out the "esp_light_sleep_start();" fixes it and deep sleep stub gets called and deep_sleep_status is printed as zero.

Could somebody please comment on this? Our bigger app after using light sleep seems to exit the deep sleep with watchdog reset, but this smaller sample also seems to illustrate that there is some kind of a problem.

ESP-IDF version: 552ba35da5f3d432faf7fe33a635d1154e946896

Attached is sdkconfig as used to compile the app.

Thank you!
Attachments
sdkconfig.txt
(9.91 KiB) Downloaded 623 times

Who is online

Users browsing this forum: Bing [Bot] and 126 guests