![ARTERY AT32F435 Series Скачать руководство пользователя страница 339](http://html1.mh-extra.com/html/artery/at32f435-series/at32f435-series_reference-manual_2977592339.webp)
AT32F435/437
Series Reference Manual
2022.11.11
Page 339
Rev 2.03
17.3 ERTC function overview
17.3.1 ERTC clock
ERTC clock source (ERTC_CLK) is selected via clock controller from a LEXT, LICK, and a divided HEXT
clock (By setting the ERTCSEL[1: 0] in the CRM_BPDC register). The HEXT divider value is configured
through the ERTC_DIV[4: 0] bit in the CRM_CFG register.
The ERTC embeds two dividers: A and B, programmed by the DIVA[6: 0] and DIVB[14: 0] respectively.
It is recommended that the DIVA is configured to a higher value in order to minimum power consumption
.
After being divided by prescaler A and B, the ERTC_CLK generates ck_a and ck_b clocks, respectively.
The ck_a is used for subsecond update, while the ck_b is used for calendar update and periodic auto
wakeup. The clock frequency of ck_a and ck_b can be obtained from the following equation:
F
ck_a
=
1
DIVA
f
ERTC_CLK
F
ck_b
=
1)
(DIVA
x
1)
(DIVB
f
ERTC_CLK
To obtain ck_b with frequency of 1 Hz, DIVA=127, DIVB=255, and 32.768 kHz LEXT should be used.
This ck_b is then used for calendar update.
Note: To use a divided HEXT by the ERTC_CLK, it is necessary to configure a HEXT divider value before
switching a clock source to the HEXT.
17.3.2 ERTC initialization
ERTC register write protection
After a power-on reset, all ERTC registers are write protected. Such protection mechanism is not affected
by the system reset. Write access to the ERTC registers (except the ERTC_STS[14: 8], ERTC_TAMP
and ERTC_BPRx registers) can be enabled by unlocking it.
To unlick the write protection of ERTC registers, the steps below should be respected:
1. Enable power interface clock by setting PW CEN=1 in the CRM_APB1EN register
2. Unlock write protection of the battery powered domain by setting BPWEN=1 in the PWC_CTRL
register
3. Write 0xCA and 0x53 to the ERTC_WP register in sequence. Writing an incorrect key will activate
the write protection again.
Table 17-1 lists the ERTC registers that can be configured only after the write protection is unlocked and
when the initialization mode is entered.
Table 17-1 RTC register m ap and reset values
Register
ERTC_WP enabled
Whether to enter initialization
mode
Others
ERTC_TIME
Y
Y
-
ERTC_DATE
Y
Y
-
ERTC_CTRL
Y
Bit 7, bit 6 and 4 only
-
ERTC_STS
Y, except [14: 8]
-
-
ERTC_DIV
Y
Y
-
ERTC_WAT
Y
N
Configurable
when
WATWF=1
ERTC_CCAL
Y
Y
-
ERTC_ALA
Y
N
Configurable
when
ALAWF =1
ERTC_ALB
Y
N
Configurable
when
ALAWF =1