2 Overview

The auto-tune feature is enabled by setting the AUTOTUNE bit in the internal high-frequency oscillator Control A (CLKCTRL.OSCHFCTRLA) register. For as long as the bit is set, the auto-tune feature compares the internal high-frequency oscillator to a 1.024 kHz reference from the external crystal oscillator. If the calibration is performed, the auto-tune system checks for a clock drift every 64 ms. The value required for the tuning is stored in the internal high-frequency oscillator Frequency Tune (CLKCTRL.OSCHFTUNE) register when the auto-tune feature is turned off.

The tuning register has 6 bits that provide 64 steps for adjusting the frequency. The bits for the up/down adjustment are stored in two’s complement. The OSCHFTUNE register has 8 bits where the first 5 bits represent the value, the sixth one is the sign, and the seventh and the eight are a mirror to the sign. The tuning register starts with the default value of 0x00. One step increases or decreases the clock speed by a percentage of the clock. If the error between the reference and the clock is less than one step, then the auto-tune feature will not activate, yet if the difference is more significant, it will activate and make the approximation for the next step. For example, if the default value of the clock is close to the correct value, auto-tune will not modify the default value, but if the clock is tuned into a different incorrect value, the auto-tune feature might set the tuning register to one step from the default value, for example, 0x01 instead of 0x00.