GD32W51x User Manual
404
calendar counter directly. The benefit of this configuration is that software can get the real
current time without any delay after wakeup from power saving mode (Deep-sleep /Standby
Mode).
Because of no RSYNF bit periodic assertion, the results of the different calendar registers
(RTC_SS/RTC_TIME/RTC_DATE) might not be coherent with each other when clock
ck_apre edge occurs between two reading calendar registers.
In addition, if current calendar register is changing and at the same time the APB bus reading
calendar register is also performing, the value of the calendar register read out might be not
correct.
To ensure the correctness and consistency of the calendar value, software must perform
reading operation as this: read all calendar registers continuously, if the last two values are
the same, the data is coherent and correct.
16.3.8.
Resetting the RTC
There are two reset sources used in RTC unit: system reset and backup domain reset.
System reset will affect calendar shadow registers and some bits of the RTC_STAT. When
system reset is valid, the bits or registers mentioned before are reset to the default value.
Backup domain reset will affect the following registers and system reset will not affect them:
-
RTC current real-time calendar registers
-
RTC Control register (RTC_CTL)
-
RTC Prescaler register (RTC_PSC)
-
RTC Wakeup timer register (RTC_WUT)
-
RTC Coarse calibration register (RTC_COSC)
-
RTC High resolution frequency compensation register (RTC_HRFC)
-
RTC Shift control register (RTC_SHIFTCTL)
-
RTC Time stamp registers (RTC_SSTS/RTC_TTS/RTC_DTS)
-
RTC Tamper register (RTC_TAMP)
-
RTC Backup registers (RTC_BKPx)
-
RTC Alarm registers (RTC_ALRMxSS/RTC_ALRMxTD)
The RTC unit will go on running when system reset occurs or enter power saving mode, but
if backup domain reset occurs, RTC will stop counting and all registers will reset.
16.3.9.
RTC shift function
When there is a remote clock with higher degree of precision and RTC 1Hz clock (ck_spre)
has an offset (in a fraction of a second) with the remote clock, RTC unit provides a function
named shift function to remove this offset and thus make second precision higher.
RTC_SS register indicates the fraction of a second in binary format and is down counting
when RTC is running. Therefore by adding the SFS[14:0] value to the synchronous prescaler