-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
problem with deep sleep time (esp_sleep_enable_timer_wakeup() suddenly/randomly stops) (IDFGH-10717) #11939
Comments
I guess it may be due to the slow clock source you have chosen. Please refer to the following:
CONFIG_ESP32S3_RTC_CLK_SRC_EXT_OSC It means you need to provide an external crystal oscillator as the slow clock source. Perhaps you can use Internal 150 kHz OSC (CONFIG_ESP32S3_RTC_CLK_SRC_INT_RC) to test. |
Hello [esp-lis], We used external crystal oscillator in our devices, so the setting. |
Hello [esp-lis], Am positive that GPIO functionality of the alternative XTAL PIN functionality is not initialized in the code. I will use Internal 150 kHz OSC (CONFIG_ESP32S3_RTC_CLK_SRC_INT_RC) to test whether there is still the same problem. Thank you. |
Hello [esp-lis], I tried Internal 150 kHz OSC (CONFIG_ESP32S3_RTC_CLK_SRC_INT_RC) to test whether there is still the same problem or not If this is not due to external/internal clock, then is it due to some firmware routine/flow? Have already share the flow from timer set for waking up from deep sleep till calling deep_sleep function. what might be wrong here? Let me know what I can test/check to resolve this. Thank you. |
@snehapawar221087 When Internal 150 kHz OSC (CONFIG_ESP32S3_RTC_CLK_SRC_INT_RC) is used as a slow clock source compared to external 32k oscillator (CONFIG_ESP32S3_RTC_CLK_SRC_EXT_OSC), there is a large time drift. Or use external 32k crystal, e.g. 20 ppm (CONFIG_ESP32S3_RTC_CLK_SRC_EXT_CRYS), which we have tested over a long period of time. |
Hello [esp-lis], please explain in brief Thank you. |
@snehapawar221087 I suspect that the slow clock source may have lost its clock and want to replace a slow clock source test (such as Internal 150 kHz OSC (CONFIG_ESP32S3_RTC_CLK_SRC_INT_RC) or external 32k xtal (CONFIG_ESP32S3_RTC_CLK_SRC_EXT_CRYS)), which have longer tests If it (the problem you describe) is still there, it could be something else and we need more information to diagnose it. For example, this problem can occur in very few products, or it can occur in all products. |
Hello esp-lis, The device which i have with this issue(other devices are with customers) has frequent data loss issue when clock was external 32k oscillator (CONFIG_ESP32S3_RTC_CLK_SRC_EXT_OSC). Another device which has got this loss issue on field and while with customer's, that device didn't report any data loss issue for more than a 15 days now, when clock was same external 32k oscillator (CONFIG_ESP32S3_RTC_CLK_SRC_EXT_OSC). Device serial logs couldn't help as we can see that device went for deep sleep, but never wakeup at set time, but wakeup for set external GPIO wakeup sources. I don't understand whether it's firmware or hardware issue. What might be the issue here?? Thanks & Regards, |
hello, |
we can add some test code to collect some data with the following steps:
|
Hello esp-lis, Please find the log, attached with this reply. In this log, you can fine, sleep_time_ms as a time for which device was in deep sleep. according to log, set time for Total time while Device time It looks like, device's set rtc time is proper/stable. Please see attached log file, that might help you for analysis. Thanks & Regards, |
set time for total time while Device time when wokeup 298 298 1690256400 (Tue Jul 25 2023 09:10:00 GMT+0530 (India Standard Time) |
Hello esp-lis, According to the logs, device won't loose it's time, when it skips timer wakeup. wakeup reason : Timer wakeup reason : Timer wakeup reason : Button press(external gpio wakeup As per the current flow, we set the timer wakeup in deep sleep, and then we set external gpio wakeups, as below
enabling external wakeups using below Please note below important observations: What might be the issue here? |
@snehapawar221087 some few points to be noted, as follows:
In addition, I need to know what is the CPU reset reason you mentioned here (And some devices, sent data because they had CPU resets)? |
Hello esp-lis, Below points are noted: In addition, I need to know what is the CPU reset reason you mentioned here (And some devices, sent data because they had CPU resets)?
So two behaviour has been found here: What is causing these kind of behaviours? |
RTC_SW_CPU_RESET, It looks like a software-triggered reset, for example, by calling esp_cpu_reset(int cpu_id). |
It might have called esp_restart() (ESP_SYSTEM_MEMPROT_FEATURE disabled in menuconfig) and triggered a RTC_SW_CPU_RESET. |
Hello esp-lis, sorry, but may i know what is "ESP_SYSTEM_MEMPROT_FEATURE"? have used watchdog in code flow, and before restarting due to it or due to fota, we set some flag in nvs, so we get status that this kind of cpu reset is because of watchdog or fota etc. While this issue, i don't understand case 1 and case 2 are happening due to the same reason? Why esp timer stops working and device won't come out of deep sleep? |
@snehapawar221087 Can you provide a simple example code that can reproduce the problem? |
Hello esp-lis, am getting this issue in my project, which is huge code. Thanks |
Code for deep sleep task `
}` Code after wake up `void check_wakeup_reason()
// check wake up reason |
Hello esp-lis, We found some devices, where before going into 'not wakeup problem', quectel module stopped responding, and we got battery read from quectel is 65235(garbage). ESP file system didn't have saved files of that time, so it's because device didn't walkups for set time to collect sensor's reading. can it be the issue due to battery/power related? OR some PCB track related issue?? what causes ESP32s3, not waking by set timer?? But system itself wakes up due to watchdog-cpu reset. any help would be appreciated. |
@snehapawar221087 To quote your description (quectel module stopped responding, and we got battery read from quectel is 65235(garbage)), the quectel module stopped responding, why can you read the battery status? |
Hi esp-lis, I gave you quectel's reference to let you know the status of device while going into 'no wakeup state'(timer wakeup stops working but external interrupts like button press, USB etc working during this time), this will make me think if it's power or pcb level issue? If we just ignore everything, and focus on this that in what circumstances, esp could go into no wakeup state, even if timer wakeup value is been set, and starts working normally after CPU reset??? |
@snehapawar221087 I have given feedback on this problem. Could you please provide us with samples that can reproduce the problem. |
I'm facing the same issue with ESP32 and |
@soroosha Could you please provide us with samples that can reproduce the problem. |
Here is the entire code. Essentially all it does is wake up every 20 seconds, get the RSSI of a specific WiFi network, turn a GPIO on/off based on the RSSI value, then go back to sleep. And repeat.
|
|
The entire code is 50 lines of code so I'm not sure how simpler it can be. And I have not tested it on a large number of chips. I don't think you'll be able to help me specially since the issue is sporadic and the timer seems to stop working after a few days (making it hard to reproduce the issue quickly). Thanks anyway |
@soroosha I have reported this issue back to the digital engineer, we need a sample that can reproduce this issue, and the program to reproduce it is simple enough, such as using the deep_sleep example (disable some options of |
Thanks for reporting, will close due to short of feedback, feel free to reopen with more updates. |
Answers checklist.
General issue report
Hello All,
we have designed a data logger using esp32s3, and device wakes up after every set time, and collects data from sensor and goes to deep sleep.
But suddenly system is facing a issue where device is not waking from deep sleep after setting a time of 10mins.
ESP_IDF version is v4.4
please find sdkconfig file in an attachment.
Kindly note the below behaviour:
1] This issue is happening randomly.
2] device is waking up due to any external interrupts which we have set but timer wakeup
3] when device goes to deep sleep, unless and until external interrupt happens, device won't wakeup
4] when issue happens, device won't wakeup and collects data until external interrupt happens, before this issue and after external interrupt while device is in mode, device works fine, goes in deep sleep and comes out of it properly, and no data loss is been seen.
it's been found that when device won't wake up at set time, till external interrupt, that time device remains in deep sleep.
Please find the code below :
<-------------------------------------------------
sdkconfig_file.txt
sdkconfig_file.txt
------------------------------------------------------------->
//set deep sleep time as sleep_time -> seconds is user defined
uint64_t sleep_time = seconds * uS_TO_S_FACTOR;
esp_err_t err = esp_sleep_enable_timer_wakeup(sleep_time);
printf("SLEEPING FOR %d SECONDS: %d\r\n\r\n", seconds, err);
//external interrupts to wakeup device from deep sleep
const int ext_wakeup_pin_1 = 12;
const uint64_t ext_wakeup_pin_1_mask = 1ULL << ext_wakeup_pin_1;
const int ext_wakeup_pin_2 = 14;
const uint64_t ext_wakeup_pin_2_mask = 1ULL << ext_wakeup_pin_2;
const int ext_wakeup_pin_3 = 1;
const uint64_t ext_wakeup_pin_3_mask = 1ULL << ext_wakeup_pin_3;
esp_sleep_enable_ext1_wakeup(ext_wakeup_pin_1_mask | ext_wakeup_pin_2_mask | ext_wakeup_pin_3_mask, ESP_EXT1_WAKEUP_ALL_LOW);
gettimeofday(&sleep_enter_time, NULL);
//delete/deinit watchdog timers
esp_task_wdt_reset();
esp_task_wdt_delete(NULL); //Unsubscribe Idle Task from TWDT
esp_task_wdt_status(NULL); //Confirm Idle task has unsubscribed
//Deinit TWDT after all tasks have unsubscribed
esp_task_wdt_deinit();
esp_task_wdt_status(NULL); //Confirm TWDT has been deinitialized
//start deep sleep
esp_deep_sleep_start();
<-------------------------------------------------------------------------------------------------------------->
Please let me know,
1] what is the cause of this issue AND
2] how to resolve this issue.
Thank you in advance.
The text was updated successfully, but these errors were encountered: