
Real-time clock (RTC)
RM0453
1004/1454
RM0453 Rev 2
When the RTC_REFIN detection is enabled, PREDIV_A and PREDIV_S must be set to their
default values:
•
PREDIV_A = 0x007F
•
PREVID_S = 0x00FF
Note:
RTC_REFIN clock detection is not available in Standby mode.
32.3.14 RTC smooth digital calibration
The RTC frequency can be digitally calibrated with a resolution of about 0.954 ppm with a
range from -487.1 ppm to +488.5 ppm. The correction of the frequency is performed using
series of small adjustments (adding and/or subtracting individual ck_cal pulses).
If LPCAL=0: ck_cal = RTCCLK
If LPCAL=1: ck_cal = ck_apre
These adjustments are fairly well distributed so that the RTC is well calibrated even when
observed over short durations of time.
Calibration ultra-low-power mode
The calibration consumption can be reduced by setting the LPCAL bit in the RTC calibration
register (RTC_CALR). In this case, the calibration mechanism is applied on ck_apre instead
of RTCCLK. The resulting accuracy is the same, but the calibration is performed during a
calibration cycle of about 2
20
x PREDIV_A x RTCCLK pulses instead of 2
20
RTCCLK pulses
when LPCAL=0.
Smooth calibration mechanism
The smooth calibration register (RTC_CALR) specifies the number of ck_cal clock cycles to
be masked during the calibration cycle:
•
Setting the bit CALM[0] to 1 causes exactly one pulse to be masked during the
calibration cycle.
•
Setting CALM[1] to 1 causes two additional cycles to be masked
•
Setting CALM[2] to 1 causes four additional cycles to be masked
•
and so on up to CALM[8] set to 1 which causes 256 clocks to be masked.
Note:
CALM[8:0] (RTC_CALR) specifies the number of ck_cal pulses to be masked during the
calibration cycle. Setting the bit CALM[0] to 1 causes exactly one pulse to be masked during
the calibration cycle at the moment when cal_cnt[19:0] is 0x80000; CALM[1] = 1 causes two
other cycles to be masked (when cal_cnt is 0x40000 and 0xC0000); CALM[2] = 1 causes
four other cycles to be masked (cal_cnt = 0x20000/0x60000/0xA0000/ 0xE0000); and so on
up to CALM[8] = 1 which causes 256 clocks to be masked (cal_cnt = 0xXX800).
While CALM allows the RTC frequency to be reduced by up to 487.1 ppm with fine
resolution, the bit CALP can be used to increase the frequency by 488.5 ppm. Setting CALP
to 1 effectively inserts an extra ck_cal pulse every 2
11
ck_cal cycles, which means that 512
clocks are added during every calibration cycle.
Using CALM together with CALP, an offset ranging from -511 to +512 ck_cal cycles can be
added during the calibration cycle, which translates to a calibration range of -487.1 ppm to
+488.5 ppm with a resolution of about 0.954 ppm.