Skip to main content
DTeuc.1
Associate II
July 21, 2026
Question

Detect start of RTC calibration 32 sec window

  • July 21, 2026
  • 2 replies
  • 11 views

I have a very nice study using RTC smooth calibration, with the RTC steered by a GNSS receiver one second pulse and a software PI controller that redetermines the calibration every 32 seconds, kind of a PLL. I am using a STM32F746G Disco evaluation board for development. Phase comparison is by hardware (1 second RTC alarm output and 2 channel input capture on a 10 MHz timer).

For optimizing the PI controller i would like deterministic results, but i don’t know what happens when i set a new smooth calibration value during an ongoing 32 second period.

Does that initiate a new 32 second RTC smooth calibration period with the requested number of adjustments?

Is a certain one of the 32 seconds better for setting the new calibration value? Which one?

I  could analyze the 32 phase measurements in my PI controller time interval to see how many calibration steps actually happened, but maybe there are some simple rules.

2 replies

TDK
July 21, 2026

The CALR values are applied continuously. The end of one 32s period is the start of the next. Changing CALR mid-cycle doesn’t reset or start anything. The details on which exact clocks are masked is not given so determining the start of the cycle would be of no help anyway, not that you could change it at an exact moment anyway.

There’s no correct or best time to make the update to CALR. It is applied continuously. Change it when it is incorrect. Note that you technically must poll RECALPF first but it should always be clear at reasonable update rates. After being updated, the next 32 s (and beyond) will have the updates applied and can be used to calibrate.

Because CALR is on a 32s cycle, you shouldn’t update more often than that. Update CALR, then wait for 33 edges on the 1s sync pulse to make your measurement/adjustment.

"If you feel a post has answered your question, please click ""Accept as Solution""."
DTeuc.1
DTeuc.1Author
Associate II
July 22, 2026

Thanks! While looking for the RECALPF flag in the reference manual i found the answer: New CALR values take effect after three predivider A cycles. Since i am running the RTC in 8 * 4096 configuration, the new settings take effect within less than a msec.

I also checked the measured phase offsets. The next 32 seconds after setting the smooth calibration to n always show the expected phase step pattern: As the LSE crystal is about -25 ppm off, i see 32-n steps of -25 usec and n steps of 5,5 usec (-25 usec + 30.5 usec adjustment step).