Page 1 of 1
RTC clock too fast by 2 Min in 10 hours?
Posted: Sun Apr 15, 2018 8:17 am
by rin67630
How accurate is the RTC clock of the ESP32.
My datalogger based on a ESP WROOM-32 Chip is ESP32D0WDQ6 (revision 1) is too fast by 2 Min in 10 hours.
That drift is really not an acceptable value.
According to the data sheet it has a xtal 40MHz+/-10ppm built in, so the drift after 10 hours should barely be noticeable.
My sketch goes to light sleep every second for 900mS.
Can it be the light sleep? I will check without it and report this tomorrw...
Re: RTC clock too fast by 2 Min in 10 hours?
Posted: Sun Apr 15, 2018 9:57 am
by ESP_igrr
In light sleep and deep sleep, RTC clock is used for timekeeping. This is either the internal 150kHz oscillator, or external 32kHz XTAL. The internal 150kHz oscillator is +/-5%.
Re: RTC clock too fast by 2 Min in 10 hours?
Posted: Sun Apr 15, 2018 10:53 am
by rin67630
ESP_igrr wrote:In light sleep and deep sleep, RTC clock is used for timekeeping. This is either the internal 150kHz oscillator, or external 32kHz XTAL. The internal 150kHz oscillator is +/-5%.
Thank you for the fast reply.
Thats really bad news.
So without an external xtal, sleep is unusable for any serious data logging.
If I connect a 32kHz XTAL to IO32 and IO33, will it be automagically recognized or will it need some specific code?
I am programming on the Arduino IDE.
Thank you for your help.
Re: RTC clock too fast by 2 Min in 10 hours?
Posted: Sun Apr 15, 2018 1:11 pm
by ESP_igrr
rin67630 wrote:
If I connect a 32kHz XTAL to IO32 and IO33, will it be automagically recognized or will it need some specific code?
I am programming on the Arduino IDE.
No specific code is needed, however you need to change
CONFIG_ESP32_RTC_CLOCK_SOURCE option in sdkconfig. This is not something you can do from Arduino IDE. However if you use ESP32 Arduino core as IDF component, you can make this change using "make menuconfig".
Re: RTC clock too fast by 2 Min in 10 hours?
Posted: Tue Jun 05, 2018 12:32 am
by ggoblin
rin67630 wrote:ESP_igrr wrote:In light sleep and deep sleep, RTC clock is used for timekeeping. This is either the internal 150kHz oscillator, or external 32kHz XTAL. The internal 150kHz oscillator is +/-5%.
Thank you for the fast reply.
Thats really bad news.
So without an external xtal, sleep is unusable for any serious data logging.
If I connect a 32kHz XTAL to IO32 and IO33, will it be automagically recognized or will it need some specific code?
I am programming on the Arduino IDE.
Thank you for your help.
Hey rin67630,
My problem is very similar to yours. I'm also doing light sleep and seeing very large and unpredictable time drifts (around +3-10ms/s). I'm also using a WROOM 32 rev1. Were you able to get better results from RTC by adding the 32kHz crystal to GPIO32 and 33? I've kind of hit a wall on this. What's odd is that depending on how the esp32 is woken from light sleep (I'm using timer, ext interrupt and touch) I'm getting a different clock drift which makes it hard to calibrate...
Thanks!
Re: RTC clock too fast by 2 Min in 10 hours?
Posted: Wed Jun 06, 2018 1:07 pm
by rin67630
ggoblin wrote:
My problem is very similar to yours. I'm also doing light sleep and seeing very large and unpredictable time drifts (around +3-10ms/s). I'm also using a WROOM 32 rev1. Were you able to get better results from RTC by adding the 32kHz crystal to GPIO32 and 33?
Thanks!
That was too much fiddling. I have used a hardware RTC.
As a convenient side effect my code is more universal.
Re: RTC clock too fast by 2 Min in 10 hours?
Posted: Wed Sep 18, 2019 9:26 pm
by Seungwhan
Hi,
By the way is it(the fact that RTC clock frequency error is about 5% when 150KHz internal RC clock is used.) documented somewhere in ESP32 data sheet or TRM? Or in ESP-IDF Programming Guide website?
Thanks!