1、先看下 RTC 时钟源
2、RTC Control Register (CR)
LPO Select
When set, the RTC prescaler increments using the LPO 1 kHz clock and not the RTC 32.768 kHz clock.
The LPO increments the prescaler from bit TPR[5] (TPR[4:0] are ignored), supporting close to 1 second
increment of the seconds register. Although compensation is supported when clocked from the LPO,
TCR[4:0] of the compensation register are also ignored and only TCR[7:5] set the compensation value
(can overflow after 1020 to 1027 cycles).
0b - RTC prescaler increments using 32.768 kHz clock.
1b - RTC prescaler increments using 1 kHz LPO, bits [4:0] of the prescaler are ignored.
这里表示 :
0:RTC 经过 32.768KHZ 的 方式进行计数
1:RTC 经过 1KHZ 的方式进行计数
因为没有外部 32.768KHZ的 晶振,因此 这里选择 LPO 1KHZ 的时钟源。
3、LPO 1KHZ时钟源 需要 LPO Clock Select Register (LPOCLKS) 中 使能。
注意1: LPO Clock Select Register (LPOCLKS) 上电只能写入一次,软件复位 后都写不进去。
注意2: LPO Clock Select Register (LPOCLKS) 属于 System Integration Module, 只能特权模式写入。