GD32W51x User Manual
407
This calibration is equally executed in a period time and the cycle number of the RTC clock
in the period time will be added or subtracted. The resolution of the calibration is about
0.954PPM with the range from -487.1PPM to +488.5PPM.
The calibration period time can be configured to the 220/219/218 RTC clock cycles which
stands for 32/16/8 seconds if RTC input frequency is 32.768 KHz.
The High resolution frequency compensation register (RTC_HRFC) specifies the number of
RTCCLK clock cycles to be calibrated during the period time:
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
)
(17.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
)
(17.4)
Note:
N=20/19/18 for 32/16/8 seconds window period