RTC clock too fast by 2 Min in 10 hours?

rin67630
Posts: 141
Joined: Sun Mar 11, 2018 5:13 pm

RTC clock too fast by 2 Min in 10 hours?

Postby rin67630 » Sun Apr 15, 2018 8:17 am

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...

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: RTC clock too fast by 2 Min in 10 hours?

Postby ESP_igrr » Sun Apr 15, 2018 9:57 am

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%.

rin67630
Posts: 141
Joined: Sun Mar 11, 2018 5:13 pm

Re: RTC clock too fast by 2 Min in 10 hours?

Postby rin67630 » Sun Apr 15, 2018 10:53 am

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.

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: RTC clock too fast by 2 Min in 10 hours?

Postby ESP_igrr » Sun Apr 15, 2018 1:11 pm

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".

ggoblin
Posts: 1
Joined: Mon Apr 16, 2018 7:32 pm

Re: RTC clock too fast by 2 Min in 10 hours?

Postby ggoblin » Tue Jun 05, 2018 12:32 am

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!

rin67630
Posts: 141
Joined: Sun Mar 11, 2018 5:13 pm

Re: RTC clock too fast by 2 Min in 10 hours?

Postby rin67630 » Wed Jun 06, 2018 1:07 pm

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.

Seungwhan
Posts: 19
Joined: Mon Jul 29, 2019 11:23 pm

Re: RTC clock too fast by 2 Min in 10 hours?

Postby Seungwhan » Wed Sep 18, 2019 9:26 pm

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!

Who is online

Users browsing this forum: No registered users and 141 guests