12.4.3.1 Auto-Tune Operation

The auto-tune feature is used to improve the accuracy of the internal oscillator. It compares its internal 1 MHz clock and a 1.024 kHz reference from the external 32.768 kHz crystal oscillator. If an error is detected, it adjusts the frequency calibrations accordingly. There is an hysteresis built into the hardware that avoids the auto-tuning jumping between two tune settings. The auto-tune system tunes the oscillator to a maximum error that is comparable to the calibration step size of the oscillator. For the step size, refer to the Electrical Characteristics section.

Figure 12-2. OSCHFTUNE Auto-Tune Block Diagram
The auto-tune algorithm operates as follows:
  1. Perform an auto-tune every millisecond. The algorithm will determine the change to OSCHFTUNE required to perfectly tune the oscillator, up to a maximum delta of 10.
  2. If a change greater than 10 is needed to tune the oscillator, several auto-tune attempts will be needed.
  3. When two auto-tune attempts have been made that resulted in no change in tuning, pause for 64 milliseconds before restarting from 1).