ESP32-S2 RTC with external crystal drifts constantly.

Badzonor
Posts: 2
Joined: Tue Nov 01, 2022 1:58 pm

ESP32-S2 RTC with external crystal drifts constantly.

Postby Badzonor » Tue Nov 01, 2022 2:35 pm

Hello, anyone has an idea why the internal RTC with an 32kHz crystal is drifting constantly in the ESP32-S2?

I am using this code to run and calibrate an external crystal: (Arduino IDE)
  1. rtc_clk_32k_bootstrap (512);
  2. rtc_clk_32k_enable (true);
  3. rtc_clk_slow_freq_set (RTC_SLOW_FREQ_32K_XTAL);
  4. for (uint8_t i = 0; i < 5; i ++) rtc_clk_cal (RTC_CAL_32K_XTAL, 3000);
When ESP is in deep sleep mode, RTC always drifts exactly 37 seconds per hour.
Crystal is high quality so it should be fine.
When the ESP is in normal operation there is no problem with drifting (probably because the RTC is running at 40MHz clock then)

Is there an option to manually change the calibration value to compensate for that error? Or maybe other calibration method / additional line of code needed?

Thanks a lot!
DSC08086.jpg
DSC08086.jpg (293.42 KiB) Viewed 1679 times

Who is online

Users browsing this forum: No registered users and 63 guests