
GD32L23x User Manual
265
So using CMSK can mask clock cycles from 0 to 511 and thus the RTC frequency can be
reduced by up to 487.1PPM.
To increase the RTC frequency the FREQI bit can be set. If FREQI bit is set, there will be 512
additional cycles to be added during period time which means every 211/210/29(32/16/8
seconds) RTC clock insert one cycle.
So using FREQI can increase the RTC frequency by 488.5PPM.
The combined using of CMSK and FREQI can adjust the RTC cycles from -511 to +512 cycles
in the period time which means the calibration range is -487.1PPM to +488.5PPM with a
resolution of about 0.954PPM.
When calibration function is running, the output frequency of calibration is calculated by the
following formula:
𝑓
cal
= 𝑓
rtcclk
× (1 +
𝐹𝑅𝐸𝑄𝐼×512−𝐶𝑀𝑆𝐾
2
𝑁
+𝐶𝑀𝑆𝐾−𝐹𝑅𝐸𝑄𝐼×512
)
(16-3)
Note:
N=20/19/18 for 32/16/8 seconds window period
Calibration when FACTOR_A < 3
When asynchronous prescaler value (FACTOR_A) is set to less than 3, software should not
set FREQI bit to 1 when using calibration function. FREQI setting will be ignored when
FACTOR_A<3.
When the FACTOR_A is less than 3, the FACTOR_S value should be set to a value less than
the nominal value. Assuming that RTC clock frequency is nominal 32.768 KHz, the
corresponding FACTOR_S should be set as following rule:
FACTOR_A = 2: 2 less than nominal FACTOR_S (8189 with 32.768 KHz)
FACTOR_A = 1: 4 less than nominal FACTOR_S (16379 with 32.768 KHz)
FACTOR_A = 0: 8 less than nominal FACTOR_S (32759 with 32.768 KHz)
When the FACTOR_A is less than 3, CMSK is 0x100
,
the formula of calibration frequency is
as follows:
𝑓
cal
= 𝑓
rtcclk
× (1 +
256−𝐶𝑀𝑆𝐾
2
𝑁
+𝐶𝑀𝑆𝐾−256
)
(16-4)
Note:
N=20/19/18 for 32/16/8 seconds window period
Verifying the RTC calibration
Calibration 1Hz output is provided to assist software to measure and verify the RTC precision.
Up to 2 RTC clock cycles measurement error may occur when measuring the RTC frequency
over a limited measurement period. To eliminate this measurement error the measurement
period should be the same as the calibration period.
When the calibration period is 32 seconds(this is default configuration)
Using exactly 32s period to measure the accuracy of the calibration 1Hz output can guarantee