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);
}
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
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!