Nations Technologies Inc.
Tel
:
+86-755-86309900
:
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
318
/
631
LSI clock
HSE/32 clock
For the purpose of reduction of power consumption, the prescaler is divided into 2 programmable prescalers, they
are asynchronous prescaler and synchronous prescaler. If both prescaler are used, it is recommended that the value
of the asynchronous divider be as large as possible.
A 7-bit asynchronous prescaler which is given by RTC_PRE.DIVA[6:0] bits
A 15-bit synchronous prescaler which is given by RTC_PRE.DIVS[14:0] bits
The formula for f
ck_apre
and f
ck_spre
are given below:
f
ck_apre
=
𝑓
𝑅𝑇𝐶𝐶𝐿𝐾
𝑅𝑇𝐶_𝑃𝑅𝐸.𝐷𝐼𝑉𝐴[6:0]+1
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].
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.
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