External 32kHz Crystal Calibration During Deep Sleep Wake Up?
Posted: Fri Aug 27, 2021 4:18 pm
Hi all,
I'm working on decreasing my deep sleep wakeup time. Currently the longest part of the process seems to be calibrating the 32kHz external crystal I'm using for RTC. With the recommended calibration cycles of 3000 it takes about 200ms.
I believe I understand all the menuconfig options for this. I know I can decrease it to lower startup time, but my question is: Why is calibration happening during deep sleep wakeup at all?
On cold boot it makes sense to calibrate the crystal, but when waking from deep sleep, presumably the crystal has been ticking along keeping time, so why recalibrate it when waking?
Here are the related sdkconfig options I'm using:
And logs from my test app:
Note, I have changed the log level of the "waiting for 32k" line to warning so I can disable most other logging and still see it.
Thanks,
Jason
I'm working on decreasing my deep sleep wakeup time. Currently the longest part of the process seems to be calibrating the 32kHz external crystal I'm using for RTC. With the recommended calibration cycles of 3000 it takes about 200ms.
I believe I understand all the menuconfig options for this. I know I can decrease it to lower startup time, but my question is: Why is calibration happening during deep sleep wakeup at all?
On cold boot it makes sense to calibrate the crystal, but when waking from deep sleep, presumably the crystal has been ticking along keeping time, so why recalibrate it when waking?
Here are the related sdkconfig options I'm using:
Code: Select all
RTC clock source: External 32kHz crystal
Number of cycle for RTC_SLOW_CLK calibration: 3000
Code: Select all
W (568) clk: waiting for 32k oscillator to start up
W (631) clk: RTC_SLOW_CLK calibration value: 16000576
671
going to sleep
W (26) clk: waiting for 32k oscillator to start up
W (89) clk: RTC_SLOW_CLK calibration value: 16000589
129
waking up
going to sleep
W (26) clk: waiting for 32k oscillator to start up
W (89) clk: RTC_SLOW_CLK calibration value: 16000576
Thanks,
Jason