![Geehy SEMICONDUCTOR APM32F405 Series User Manual Download Page 277](http://html1.mh-extra.com/html/geehy-semiconductor/apm32f405-series/apm32f405-series_user-manual_573630277.webp)
www.geehy.com Page 276
f
APB1
is too small, to ensure the normal reading of date value, it is required to
read the shadow register twice. If the date obtained twice is the same, the date
is read successfully.
After the shadow register is updated, the flag bit RSFLG will be set. The
software can read the date only after the bit RSFLG is set. Every time the date
is read, the RSFLG flag should be cleared manually.
When waking up from stop or standby mode, since the shadow register is not
updated, the RSFLG flag should be cleared immediately.
RCMCFG=1, read the date from the date register
When f
APB1
is less than 7*f
RTCCLK
or the system is woken from low-power mode,
it is recommended to read the date directly from the date register.
If RSFLG flag bit is not set to 1 when reading the date just at the stage of date
register change, it is required to read the date twice. Therefore, it is also
recommended to read the date register twice. When the read date value is the
same twice, it means that the date is read successfully.
Time compensation
Due to seasonal changes, time compensation is sometimes needed to make it
more suitable for daily needs. RTC is integrated with time compensation unit
and its summer time flag. Users can choose whether to turn on time
compensation according to their own needs.
By setting STCCFG bit of the register RTC_CTRL, the summer time will
increase by 1 hour; by setting WTCCFG bit of the register RTC_CTRL, the
winter time will will decrease by 1. BAKP flag is used to record whether the
summer time is set.
Programmable alarm
As a real-time clock, RTC integrates alarm function, and it runs mainly through
alarm configuration register and alarm mask, in combination with date register.
Configure the alarm and alarm mask through the register
RTC_ALRMA/RTC_ALRMASS and RTC_ALRMB/RTC_ALRMBSS, and the
alarm mask informs RTC to pay attention to the time period of the alarm. After
the alarm function is enabled, the alarm will be triggered only when the
concerned time period reaches the set value. At this time, the alarm flag is set. If
the alarm interrupt is enabled, the interrupt processing will be triggered.
Select "seconds" as the time period of the alarm, and only when the
synchronous prescaler value is greater than 3, can the alarm operate normally.
Timestamp
RTC supports timestamp function and the RTC_TS pin works together with the