Real-time clock (RTC) RM0033
572/1381 RM0033 Rev 9
Figure 215. RTC block diagram
1. On STM32F20x and STM32F21x devices, the RTC_AF1 and RTC_AF2 alternate functions are connected
to PC13 and PI8, respectively.
22.3 RTC functional description
22.3.1 Clock and prescalers
The RTC clock source (RTCCLK) is selected through the clock controller among the LSE
clock, the LSI oscillator clock, and the HSE clock. For more information on the RTC clock
source configuration, refer to Section
5: Reset and clock control (RCC).
A programmable prescaler stage generates a 1 Hz clock which is used to update the
calendar. To minimize power consumption, the prescaler is split into 2 programmable
prescalers (see
Figure 215: RTC block diagram):
• A 7-bit asynchronous prescaler configured through the PREDIV_A bits of the
RTC_PRER register.
• A 13-bit synchronous prescaler configured through the PREDIV_S bits of the
RTC_PRER register.
Note: When both prescalers are used, it is recommended to configure the asynchronous prescaler
to a high value to minimize consumption.
The asynchronous prescaler division factor is set to 128, and the synchronous division
factor to 256, to obtain an internal clock frequency of 1
Hz (ck_spre) with an LSE frequency
of 32.768
kHz.
The minimum division factor is 2 and the maximum division factor is 2
20
.
This corresponds to a maximum input frequency of around 1 MHz.
ai17724c
ck_apre
(default 256 Hz)
ck_spre
(default 1 Hz)
AFO_CALIB
(512 Hz)
RTC_WUTR
RTCCLK
WUTF
HSE (1 MHz max)
LSE (32.768 Hz)
LSI
Asyn ch.
7-bit prescaler
(default = 128)
Synchronous
13-bit prescaler
(default = 256)
Calendar
Prescaler
/2,4,8,16
16-bit wakeup
auto-reload timer
=
Alarm
(RTC_ALRMAR
register)
ALRAF
AFO_ALARM
RTC_PRER
RTC_PRER
Shadow registers
(RTC_TR,
RTC_DR)
ck
=
Alarm
(RTC_ALRMBR
register)
ALRBF
Backup registe rs
and RTC tamper
control registers
AFI_TAMPER
Time stamp
registe rs
AFI_TIMESTAMP
Time stamp flag
Output
control
TAMPE
TSE
RTC_AF1
RTC_AF2
RTC_AFO
RTC_AFI
RTC_AFI
WUCKSEL[2]
WUCKSEL[1:0]
Periodic wakeup flag
Coarse
calibration
RTC_50Hz