-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
clock_gettime seems random after deep sleep with flash encryption enabled (IDFGH-12957) #13912
Comments
@NotMick I just tested this and |
I use flash encryption in release mode. And you are correct. It works for the first few hours before starting to show deviations. The deviations can range from going a couple of seconds back and jumping a few thousand. |
Hi @NotMick,
|
sdkconfig.txt I personally have not encountered this issue on devices without flash encryption |
Do you use only deepsleep or light sleep as well? |
Only deep sleep |
@NotMick struct timespec tp;
ESP_LOGI(TAG, "CLOCK_REALTIME= %lld seconds", tp.tv_sec);
clock_gettime(CLOCK_REALTIME, &tp); Do you set timestamp? using this I still can not reproduce this issue. I run the app for a long time (about 6 hours) and I do not see such a behavior. |
I use CLOCK_REALTIME |
I want to thank you for trying to reproduce the issue. I'll try to make a small example in which I can reproduce the bug next week. |
clock_gettime_example.zip |
@NotMick! |
Hi @NotMick!
I do not see it. I do not have an AHT20 sensor (the ulp core does nothing), but it does not matter for this issue. Here is my log. Which says that it was run for about 22 hours and "Time now" is intolerance (79204 and 79109). I pressed the BUTTON0 a few times as well:
|
Just to make sure, are you using flash encryption and secure boot? Cause I have two examples running, one with flash encryption and one without. Only the one with flash encryption has the problem. |
I will take it from @NotMick for this week. @KonstantinKondrashov I was wondering if you were able to test the example while using flash encryption and secure boot? |
@KonstantinKondrashov Any update for this issue? |
Answers checklist.
General issue report
I have an ESP32-C6 with idf v5.2.1 (also tested with v5.2.2) that needs to be in deep sleep and wake up every now and then. When its woken up it needs to know how long it slept. For that I use
clock_gettime()
. But when I wake the esp up the return value seems wrong. I got the following results with 5 seconds of deep sleep between them:These are the seconds since the first boot but they go up and down with large jumps.
I'm not experiencing this issue when flash encryption is disabled. And when I give the esp an hard reset (power off and on) the time is right for a couple of hours but eventually they are wrong again.
The text was updated successfully, but these errors were encountered: