GD32F3x0 User Manual
229
When reference detection function is running while the external reference clock is removed
(no reference clock edge found in 3 ck_apre window), the calendar updating still can be
performed by LXTAL clock only. If the reference clock is recovered later, detection function
will use 7 ck_apre window to identify the reference clock and use 3 ck_apre window to adjust
the 1Hz clock (ck_spre) edge.
Note: Software must configure the FACTOR_A = 0x7F and FACTOR_S = 0xFF before
enabling reference detection function (REFEN = 1)
Reference detection function does not work in Standby Mode.
15.3.10. RTC smooth digital calibration
RTC smooth calibration function is a way to calibrate the RTC frequency based on RTC
clock in a configurable period time.
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 2
20
/2
19
/2
18
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 2
11
/2
10
/2
0
9
(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:
f
cal
=f
rtcclk×(1+
FREQI×512-CMSK
2
N
+CMSK-FREQI×512
) (15-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.