![ARTERY AT32WB415 Series Reference Manual Download Page 234](http://html1.mh-extra.com/html/artery/at32wb415-series/at32wb415-series_reference-manual_2977599234.webp)
AT32WB415
Series Reference Manual
2022.04.13
Page 234
Ver 2.00
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 divided HEXT
(selected through the ERTCSEL[1: 0] bit in the CRM_BPDC 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 subseond update, while the ck_b is usd for calendar update and periodic
autowakeup. The clock frequencys of ck_a and ck_b can be obtained from thef 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 kH LEXT should be used. This
ck_b is then used for calendar update.
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 PWCEN=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. Wrting an incorrect key will activate
the write protection again.
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 ERTC register map and reset values
Register
ERTC_WP enabled
Whether to enter initilization mode Others
ERTC_TIME
Y
Y
-
ERTC_DATE
Y
Y
-
ERTC_CTRL
Y
Bit 7, 6 and 4 only
-
ERTC_STS
Y, except [14: 8]
-
-
ERTC_DIV
Y
Y
-
ERTC_WAT
Y
N
Configurable
when
WATWF=1
ERTC_ALA
Y
N
Configurable
when
ALAWF =1
ERTC_ALB
Y
N
Configurable
when
ALAWF =1
ERTC_WP
ERTC_SBS
-
-
-
ERTC_TADJ
Y
N
Configurable
when
TADJF=0