cancel
Showing results for 
Search instead for 
Did you mean: 

Should HAL_RTCEx_SetSmoothCalib() behave same with 16s and 32s window periods ?

mcu_
Visitor

I'm working on RTC smooth digital calibration on an STM32U575 board using the HAL function HAL_RTCEx_SetSmoothCalib(). I'm using the LSE (32.768kHz) as the RTC clock source.

What I'm trying to do:

I want to adjust a known RTC drift (e.g., 500ms) over time using the RTC’s smooth calibration feature. I understand that I can configure the calibration window to 32s, 16s, or 8s using the SmoothCalibPeriod parameter, and that I can add or subtract pulses (each approx 30.5µs) to speed up or slow down the RTC.

What I expected:

With a 32s window, each call to HAL_RTCEx_SetSmoothCalib() can adjust ~15.6ms max (512 pulses × 30.5µs). So, it should take about 1024s (500 / 15.6 = 32 calls every 32s) to fully adjust 500ms. With a 16s window, I expected the correction rate to double, since the same pulse change should now apply over a shorter time, and thus the 500ms adjustment should take ~512s (500/15.6 = 32 calls every 16s).

What I’m observing:

When I call the function with RTC_SMOOTHCALIB_PERIOD_32SEC, it behaves as expected (takes ~1024s to fully correct 500ms). But when I change the calibration window to RTC_SMOOTHCALIB_PERIOD_16SEC, the total correction over the same number of calls is less than expected. it adjusts only ~250ms instead of 500ms. It seems like the effective correction rate remains the same as 32s, and/or the settings aren’t applied each time as expected.

My Question:

Is there any internal hardware limitation in STM32U575 (or STM32 in general) that causes 16s/8s window settings to behave like 32s? If so, what's the correct way to apply faster or more frequent RTC calibration?





0 REPLIES 0