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...
RTC clock too fast by 2 Min in 10 hours?
Re: RTC clock too fast by 2 Min in 10 hours?
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?
Thank you for the fast reply.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%.
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?
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".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.
Re: RTC clock too fast by 2 Min in 10 hours?
Hey rin67630,rin67630 wrote:Thank you for the fast reply.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%.
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.
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?
That was too much fiddling. I have used a hardware RTC.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!
As a convenient side effect my code is more universal.
Re: RTC clock too fast by 2 Min in 10 hours?
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!
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 148 guests