10.3.2.8 RC Oscillator Calibration
The CMU has built-in HW support to efficiently calibrate the RC oscillators (LFRCO, HFRCO, AUXHFRCO) at run-time, see
10.10 HW-support for RC Oscillator Calibration on page 222
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 selecta-
ble 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 CMU1 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 re-
starts 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 sam-
ple+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 10.10. HW-support for RC Oscillator Calibration
The counter operation for single and continuous mode are shown in
Figure 10.11 Single Calibration (CONT=0) on page 223
and
10.12 Continuous Calibration (CONT=1) on page 223
respectively.
EFM32JG1 Reference Manual
CMU - Clock Management Unit
silabs.com
| Smart. Connected. Energy-friendly.
Preliminary Rev. 0.6 | 222