11.3.2.8 RC Oscillator Calibration
The CMU has built-in HW support to efficiently calibrate the RC oscillators (LFRCO, HFRCO, AUXHFRCO, etc) at run-time. For a com-
plete list of supported oscillators, refer to DOWNSEL and UPSEL fields in CMU_CALCTRL. See
Figure 11.13 HW-support for RC Oscil-
for an illustration of this circuit. The concept is to select a reference and compare the RC frequency with
the reference frequency. When the calibration circuit is started, one down-counter running on a selectable clock (DOWNSEL in
CMU_CALCTRL) and one up-counter running on a selectable clock (UPSEL in CMU_CALCTRL) are started simultaneously. The top
value for the down-counter must be written to CMU_CALCNT before calibration is started. The down-counter counts for CMU_CALCNT
+1 cycles. When the down-counter has reached 0, the up-counter is sampled and the CALRDY interrupt flag is set. If CONT in
CMU_CALCTRL is cleared, the counters are stopped after finishing the ongoing calibration. If continuous mode is selected by setting
CONT in CMU_CALCTRL the down-counter reloads the top value and continues counting and the up-counter restarts from 0. Software
can then read out the sampled up-counter value from CMU_CALCNT. The up-counter has counted (the sampled value)+1 cycles. The
ratio between the reference and the oscillator subject to the calibration can easily be found using top+1 and 1. Overflows of the
up-counter will not occur. If the up-counter reaches its top value before the down-counter reaches 0, the up-counter stays at its top
value. Calibration can be stopped by writing CALSTOP in CMU_CMD. With this HW support, it is simple to write efficient calibration
algorithms in software.
CMU_CALCTRL.UPSEL
AUXHFRCO
HFRCO
LFRCO
HFXO
LFXO
20-bit up-counter
CMU_CALCTRL.DOWNSEL
AUXHFRCO
HFRCO
LFRCO
HFXO
LFXO
TOP
Write top-value using
CMU_CALCNT before
starting calibration.
DOWNCLK Domain
UPCLK Domain
HFCLK Domain
= 0 ?
SYNC
(Default) HFCLK
SYNC
20-bit up-counter
buffer
SYNC
20-bit down-counter
Set CMU_IF.CALRDY
CMU_CALCNT
DOWNCLK
UPCLK
Reload down-counter with
top value in continuous
mode.
Take snapshot of up-counter
in up-counter bufffer. If in
continuous mode, restart up-
counter from 0.
PRS[PRSUPSEL]
PRS[PRSDOWNSEL]
Figure 11.13. HW-support for RC Oscillator Calibration
The counter operation for single and continuous mode are shown in
Figure 11.14 Single Calibration (CONT=0) on page 301
and
11.15 Continuous Calibration (CONT=1) on page 301
respectively.
Reference Manual
CMU - Clock Management Unit
silabs.com
| Building a more connected world.
Rev. 1.1 | 300