AT32F425
Series Reference Manual
2022.03.30
Page 420
Ver 2.01
21.5
Principle
USB_SOF period signal: 1ms of period must be accurate, which is a prerequisite of the normal operaion
of an auto calibration module.
cross-return algorithm: This is used to calculate a calibration value closest to the theoretic value. In
theory, the actual frequency after calibration can be adjusted to be within an accuracy range of about
0.5 steps from the target frequency (8MHz)
Figure 21-3 Cross-return algorithm
C1 = 7980
C3 = 8020
C2 = 8000
From the above figure, auto calibration function will adjust the HICKCAL or HICKTRIM according to the
specified step as soon as the condition for trigerring auo calibration is reached.
Cross:
If the auto calibration condition is met, the actual sampling data in the first 1ms period will be either less
than C2, or greater than C2.
When this value is less than C2, the auto calibration module will start increasing either the HICKCAL or
HICKTRIM according to the step definition until the actual sampling value is greater than C2. In this way,
the actual value will cross over C2 from small to large.
When this value is greater than C2, the auto calibration module will start decrease either the HICKCAL
or HICKTRIM according to the step definition until the actual sampling value become less than C1. In
this way, the actual value will cross over C2 from large to small.
Return:
After cross operation is completed, the actual value closest to C2 can be obtained by comparing the
difference (calculated as absolute value) between the actual sampling value and C2 before and after
crossing C2 so as to get the best calibration value HICKCAL or HICKTRIM.
If the difference after crossing is less than the one before crossing C2, the calibration value after crossing
prevails, and stops the calibration process until the next condition for auto calibration appears.
If the difference after crossing is greater than the one before crossing C2, the calibration value before
crossing prevails, and it will return by one step to the one before crossing, and stops the calibration
process until the next condition for auto calibration appears.
According to the cross-return strategy, in theory, it is possible to get the frequency accuracy that is 0.5
steps away from the center frequency.
Four conditions for enabling auto calibration function are as follows:
1.
The rising edge of the CANLON (from 0 to 1)
2.
When CALON=1, reference signal is lost and restored
3.
When the sample counter is less than C1
4.
When the sample counter is greater than C3
Even though the sampling counter is between C1 and C3, at the rising edge the CANLON, the auto
calibration module can also be activated so that the HICK frequency can be adjusted to be within a range
of 0.5 steps of the center frequency as soon as the CANLON is enabled.
U
nder one of the above-mentioned circumstances, the HICK frequency cal be calibrated to be within 0.5
steps of the center frequency. To achieve the best calibration accuracy, it is recommended to remain
step as 1 (defual value). If the steop is set to 0, either HICKCAL or HICKTRIM will not be able to be
calibrated.