ESP32-S3 RTC accuracy

ESPIRIT
Posts: 7
Joined: Tue Jul 18, 2023 8:56 am

ESP32-S3 RTC accuracy

Postby ESPIRIT » Tue Jul 18, 2023 9:17 am

Hello All,

I am using the ESP32-S3 (ESP32-S3-WROOM-1U-N4R2), and we need an accurate RTC.
At the hardware I have connected a 32.378Hz crystal clock at pin 8 (IO15) and pin 9 (IO16).
We use the ABS07-32.768KHZ-T crystal and have load capacitors of 15pF.

The problem is that the clock is very inaccurate. We expect about 20ppm, but we measure about 850ppm difference.
Changing the stray capacitance does not make any difference. We tried 6.8pF instead of the 15pF, but still the same difference...

Visual GDB:
- IDF version: 4.4.2
- See attachments

Can anybody please assist me solving this problems?

Manny thanks!
Attachments
VisualGdb_Timer.jpg
VisualGdb_Timer.jpg (109.08 KiB) Viewed 4177 times
VisualGdb_RTC.jpg
VisualGdb_RTC.jpg (73.79 KiB) Viewed 4177 times

ESP_Sprite
Posts: 9589
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-S3 RTC accuracy

Postby ESP_Sprite » Tue Jul 18, 2023 9:57 am

Check the bootup messages; if the crystal is tried but fails calibration for the RTC, ESP-IDF will fallback to the (inaccurate) internal oscillator but will also complain in the bootup messages.

ESPIRIT
Posts: 7
Joined: Tue Jul 18, 2023 8:56 am

Re: ESP32-S3 RTC accuracy

Postby ESPIRIT » Tue Jul 18, 2023 3:03 pm

Hi,

I checked if the external crystal is running normally at my application firmware and that is the case.
So the RTC does not run at the internal oscillators.
I checked it by short circuiting the crystal. Then I get a message in my debug output, the internal oscillator is taking over.

ESP_Sprite
Posts: 9589
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-S3 RTC accuracy

Postby ESP_Sprite » Wed Jul 19, 2023 12:43 am

How, specifically, do you measure the time drift? As in: duration of test, sleep mode active, how do you get the time, ...?

ESPIRIT
Posts: 7
Joined: Tue Jul 18, 2023 8:56 am

Re: ESP32-S3 RTC accuracy

Postby ESPIRIT » Wed Jul 19, 2023 5:59 am

The firmware does not goto sleep.
I reset the clock and 24hours later I check it.
In 24 hours the time drift is about a minute.
I retrieve the clock with the gettimeofday function.

ESP_Sprite
Posts: 9589
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-S3 RTC accuracy

Postby ESP_Sprite » Wed Jul 19, 2023 6:03 am

This is from memory and it's been a while, but I don't think the ESP32 uses the RTC clock signal when not in deep sleep; it uses the (normally more accurate) 40MHz clock instead. Could there be something wrong with that crystal?

ESPIRIT
Posts: 7
Joined: Tue Jul 18, 2023 8:56 am

Re: ESP32-S3 RTC accuracy

Postby ESPIRIT » Wed Jul 19, 2023 6:06 am

Is there anybody who has implemented a 32kHz crystal clock at the ESP32-S3-WROOM-1U-N4R2?
If so, is your circuit accurate?
Can be please share your circuit with me? It would be very helpful...

Many thanks in advance!

ESPIRIT
Posts: 7
Joined: Tue Jul 18, 2023 8:56 am

Re: ESP32-S3 RTC accuracy

Postby ESPIRIT » Wed Jul 19, 2023 6:10 am

Well the whole idea is to use an accurate 32khz crystal clock for the RTC.
Normally these crystals are more accurate then the main clock. (I see that it actually is 10ppm, which is not bad...)
Now I am testing without going to deep sleep, but later deep sleep is a must.
So then we also need the 32kHz RTC.

ESPIRIT
Posts: 7
Joined: Tue Jul 18, 2023 8:56 am

Re: ESP32-S3 RTC accuracy

Postby ESPIRIT » Wed Jul 19, 2023 12:41 pm

Hello All,

I have found a problem which causes the deviation of the RTC clock.
It seems be be in software somewhere.

When I use the rtc_time_get() function the clock is accurate.
When I use the gettimeofday() function the clock deviation is about 700ppm.
The gettimeofday() is inaccurate both when I set calibration time to 0 or 5000.

So maybe someone can tell me why this difference occures in software??

Thanks!

ESP_Sprite
Posts: 9589
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-S3 RTC accuracy

Postby ESP_Sprite » Thu Jul 20, 2023 2:41 am

Do you have some minimal example code that shows the issue?

Who is online

Users browsing this forum: No registered users and 85 guests