![Geehy SEMICONDUCTOR APM32F405 Series Скачать руководство пользователя страница 276](http://html1.mh-extra.com/html/geehy-semiconductor/apm32f405-series/apm32f405-series_user-manual_573630276.webp)
www.geehy.com Page 275
RTC uses 2
20
RTCCLK as a calibration cycle by default. In addition, 2
19
and 2
18
RTCCLK can be set as a calibration cycle through the registers CALW16 and
CALW8. When LSECLK is used as RTCCLK clock source, the calibration cycle
of RTC is 32s, 16s, 8s.
16s calibration cycle; the hardware sets RECALF[0] to "0"
8s calibration cycle; the hardware sets RECALF[1:0] to "00"
Take 32s calibration cycle as an example, the calibration mechanism is to add
or reduce some RTCCLK signals in the calibration cycle.
When RECALF is used, RECALF RTCCLK are reduced every 2
20
RTCCLK
When ICALFEN is used and ICALFEN=1, one RTCCLK is added
every 2
11
RTCCLK
When RECALF is used and ICALFEN, (512 * ICALFEN - RECALF)
RTCCLK are added every 2
20
RTCCLK
RTC write protection
In order to prevent counting exception caused by accidental write, RTC register
adopts write protection mechanism. Only when the write protection is removed,
can the register with write protection function be operated.
After power-on, RTC register will enter the write protection state and the
protection cannot be removed by system reset. The write protection can be
removed by writing special keywords '0xCA' and '0x53' to the register
RTC_WRPROT. If the wrong keyword is written, RTC will immediately enable
write protection.
Date register
RTC has subsecond, time and date shadow registers encoded by BCD, which
are RTC_SUBSEC, RTC_TIME and RTC_DATE respectively. The current date
can be obtained by accessing the shadow register or obtained directly from the
date register. The time system of 24 hours and 12 hours can be selected by
TIMEFCFG bit of configuration register RTC_CTRL.
RTC updates the shadow register every two RTCCLK cycles, and sets the flag
bit RSFLG. When waking up from stop or standby mode, generally the shadow
register will not be updated, which requires waiting for 1-2 RTCCLK cycles. The
reset of shadow register is caused by system reset.
The shadow register is synchronized with f
APB1
.
The way to read the date can be selected by RCMCFG bit of configuration
register RTC_CTRL.
RCMCFG=0, read the date from the shadow register
In this mode, it is recommended that f
APB1
should be greater than 7*f
RTCCLK
. If