![ARTERY AT32F435 Series Reference Manual Download Page 342](http://html1.mh-extra.com/html/artery/at32f435-series/at32f435-series_reference-manual_2977592342.webp)
AT32F435/437
Series Reference Manual
2022.11.11
Page 342
Rev 2.03
17.3.4 ERTC calibration
Two calibration methods are available: coarse and fine calibration. But the two calibration methods
cannot be used together.
Coarse digital calibration:
Coarse digital calibration can be used to advance or delay the calendar updates by increasing or
decreasing ck_a cycles.
When positive calibration is enabled (CALDIR=0), 2 ck_a cycles are added every minute (around 15360
ck_a cycles) for the first 2xCALVAL minutes of the 64-minute cycle. This causes the calendar to be
updated sooner.
When negative calibration is enabled (CALDIR=1), 1 ck_a cycle is ignored every minute (around ck_a
cycles) for the first 2xCALVAL minutes of the 64-minute cycle. This causes the calendar to be updated
later.
Note: Coarse digital calibration can work correctly only when the DIVA is 6 or above.
Smooth digital calibration:
Smooth digital calibration has a higher and well-distributed performance than the coarse digital
calibration. The calibration is performed by increasing or decreasing ERTC_CLK in an evenly manner.
The smooth digital calibration period is around 220 ERTC_CLK (32 seconds) when the ERTC_CLK is
32.768 kHz. The DEC[8: 0] bit specifies the number of pulses to be masked during the 220 ERTC_CLK
cycles. A maximum of 511 pulses can be removed. When the ADD is set, 512 pulses can be inserted
during the 220 ERTC_CLK cycles. When DEC[8: 0] and ADD are sued together, a deviation ranging
from -511 to +512 ERTC_CLK cycles can be added during the 220 ERTC_CLK cycles.
The effective calibrated frequency (F
SCAL)
:
F
SCAL
= F
ERTC_CLK
× [ 1 +
512
x
ADD
DEC
2
DEC
512
x
ADD
20
]
When the divider A is less than 3, the calibration operates as if ADD was equal to 0. The divider B value
should be reduced so that each second is accelerated by 8 ERTC_CLK cycles, which means that 256
ERTC_CLK cycles are added every 32 seconds. When DEC[8: 0] and ADD are sued together, a
deviation ranging from -255 to +256 ERTC_CLK cycles can be added during the 220 ERTC_CLK cycles.
At this point, the effective calibrated frequency (F
SCAL)
F
SCAL
= F
ERTC_CLK
× [ 1 +
256
DEC
2
DEC
256
20
]
It is also possible to select 8 or 16-second digital calibration period through the CAL8 and CAL16 bits.
The 8-second period takes priority over 16-second. In other words, when both 8-second and 16-second
are enabled, 8-second calibration period prevails.
The CALUPDF flag in the ERTC indicates the calibration status. During the configuration of ERTC_SCAL
registers, the CALUPDF bit is set, indicating that the calibration value is being updated; Once the
calibration value is successfully applied, this bit is cleared automatically, indicating the completion of the
calibration value update.