Hi everybody,
I use gettimeofday to mantain a calendar on device.
If I have a "cold power on" it reports 1st jan 1970 and I update it using settimeofday with current time/date.
When I invoke gettimeofday it reports the current date/time correctly.
Then after some time (for example 24 hours of operation) and, let's imagine the date/time is 05 oct 2018, 10:00:00, I call "esp_restart" the program restart, but gettimeofday reports a time back of about 30minutes (it is not always the same time delay), so I get 05 oct 2018, 09:35:00
Should I not consider gettimeofday result after an esp_restart reboot?
Thanks
gettimeofday fails after esp_restart
Re: gettimeofday fails after esp_restart
"Internal RTC clock frequency error is about 5%."
viewtopic.php?f=2&t=3715&p=17063&hilit= ... acy#p17063
viewtopic.php?f=2&t=3715&p=17063&hilit= ... acy#p17063
--
Paul.
Paul.
Re: gettimeofday fails after esp_restart
I had similar problem - not sure why this happens but it seemed to go away when I changed the configuration parameter in menuconfig -> component config -> ESP32 -> Timer used for gettimeofday from RTC & FRC to just RTC.
However, I don't really understand the FRC and RTC interactions.
However, I don't really understand the FRC and RTC interactions.
Re: gettimeofday fails after esp_restart
Try calling esp_sync_counters_rtc_and_frc before restart
Re: gettimeofday fails after esp_restart
Thanks @0xffff and @wifive.
As a workaround I m saving in a noinit ram variable the result of gettimeofday just before the restart.then at restart i settimeofday with thay variable and it seem to work.
However i discovered that in case of a crash of code the problem arise again because the reset is perfomed without my control.
Should i call regulary in the code the esp_sync_counter_rtc__and_frc?
As a workaround I m saving in a noinit ram variable the result of gettimeofday just before the restart.then at restart i settimeofday with thay variable and it seem to work.
However i discovered that in case of a crash of code the problem arise again because the reset is perfomed without my control.
Should i call regulary in the code the esp_sync_counter_rtc__and_frc?
Who is online
Users browsing this forum: No registered users and 98 guests