UM1940
39.2.6
Initialization and de-initialization functions
This section provides functions allowing to initialize and configure the RTC Prescaler
(Synchronous and Asynchronous), RTC Hour format, disable RTC registers Write
protection, enter and exit the RTC initialization mode, RTC registers synchronization check
and reference clock detection enable.
1.
The RTC Prescaler is programmed to generate the RTC 1Hz time base. It is split into
2 programmable prescalers to minimize power consumption.
2.
All RTC registers are Write protected. Writing to the RTC registers is enabled by
writing a key into the Write Protection register, RTC_WPR.
3.
To configure the RTC Calendar, user application should enter initialization mode. In
this mode, the calendar counter is stopped and its value can be updated. When the
initialization sequence is complete, the calendar restarts counting after 4 RTCCLK
cycles.
4.
To read the calendar through the shadow registers after Calendar initialization,
calendar update or after wake-up from low power modes the software must first clear
the RSF flag. The software must then wait until it is set again before reading the
calendar, which means that the calendar registers have been correctly copied into the
RTC_TR and RTC_DR shadow registers.The HAL_RTC_WaitForSynchro() function
implements the above software sequence (RSF clear and RSF check).
This section contains the following APIs:
HAL_RTC_Init()
HAL_RTC_DeInit()
HAL_RTC_MspInit()
HAL_RTC_MspDeInit()
39.2.7
RTC Time and Date functions
This section provides functions allowing to configure Time and Date features
This section contains the following APIs:
HAL_RTC_SetTime()
HAL_RTC_GetTime()
HAL_RTC_SetDate()
HAL_RTC_GetDate()
39.2.8
RTC Alarm functions
This section provides functions allowing to configure Alarm feature
This section contains the following APIs:
HAL_RTC_SetAlarm()
HAL_RTC_SetAlarm_IT()
HAL_RTC_DeactivateAlarm()
HAL_RTC_GetAlarm()
HAL_RTC_AlarmIRQHandler()
HAL_RTC_AlarmAEventCallback()
HAL_RTC_PollForAlarmAEvent()
A 7-bit asynchronous prescaler and a 13-bit synchronous prescaler.
When both prescalers are used, it is recommended to configure the
asynchronous prescaler to a high value to minimize power consumption.
DocID028236 Rev 2
HAL RTC Generic Driver
469/1371
Need help?
Do you have a question about the STM32F2 and is the answer not in the manual?
Questions and answers