401
/
838
Nations Technologies Inc.
Tel
:
+86-755-86309900
:
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
f
ck_spre =
𝑓𝑅𝑇𝐶𝐶𝐿𝐾
(𝑅𝑇𝐶_𝑃𝑅𝐸.𝐷𝐼𝑉𝑆[14:0]+1)∗(𝑅𝑇𝐶_𝑃𝑅𝐸.𝐷𝐼𝑉𝐴[6:0]+1)
The ck_apre clock is used to driven RTC_SUBS sub-second down counter. When it reaches 0, reload RTC_SUBS
with the value of RTC_PRE.DIVS[14:0].
14.2.5
RTC calendar
There are three shadow registers, they are RTC_DATE, RTC_TSH and RTC_SUBS. The RTC time and date registers
can be accessed through the shadow registers. It is also possible to access them directly to avoid the synchronization
waiting time. The three shadow registers are as follow:
RTC_DATE: set and read date
RTC_TSH: set and read time
RTC_SUBS: read sub-second
After every two RTCCLK cycles, the current calendar value is copied to the shadow register, and
RTC_INITSTS.RSYF bit is set to 1. This process is not performed in low power (stop & standby) modes. While
exiting these modes, the shadow register updates the values after 2 RTCCLK cycles.
By default, when user try to access the calendar register, it accesses the contents of the shadow register instead. User
can access the calendar register directly by setting the RTC_CTRL.BYPS bit.
When RTC_CTRL.BYPS=0, calendar values are from shadow registers, when reading RTC_SUBS, RTC_TSH or
RTC_DATE register, it is necessary to make ensure the frequency of APB1 clock (f
APB1
) is at least 7 times the
frequency of RTC clock (f
RTCCLK
), and APB1 clock frequency lower than RTC clock frequency is not allowed in any
case. System reset will reset shadow registers.
14.2.6
Calendar initialization and configuration
The value of prescaler and calendar can be initialized by the following steps:
Enter initialization mode by setting “1” to RTC_INITSTS.INITM bit, then wait for RTC_INITSTS.INITF flag
to be set 1.
Set RTC_PRE.DIVS[14:0] and RTC_PRE.DIVA[6:0] value.
Write the initial calendar values include time and date into the shadow registers (RTC_TSH and RTC_DATE)
and configure the time format (12 or 24 hours) by the RTC_CTRL.HFMT bit.
Exit initialization mode by clearing the RTC_INITSTS.INITM bit.
The values of calendar counter will automatically loaded from shadow registers after 4 RTCCLK clock cycles, then
the calendar counter restarts.
14.2.7
Calendar reading
1. Reading calendar value when RTC_CTRL.BYPS=0
Calendar value is read from shadow registers if RTC_CTRL.BYPS=0. In order to read RTC calendar registers