1.4 Oscillator Characteristics

The specific frequency of the internal 32.768 kHz RC oscillator depends on operating temperature and voltage. An example of this dependency is seen in Figure 1-1, which shows the output frequency of the internal 32.768 kHz RC oscillator on an ATxmega128A1U microcontroller. As seen from the figure, the frequency increases with increasing temperature, and decreases slightly with increasing operating voltage. These characteristics will vary from device to device. For details on a specific device refer to its data sheet.

Figure 1-1. Internal 32.768kHz Oscillator Output Frequency vs. Temperature

All XMEGA devices with tunable 32.768 kHz RC oscillators have an RC32KCAL register for tuning the oscillator frequency. An increasing value in RC32KCAL will result in an increase in frequency. This information is very relevant when searching for the best calibration value to fit a given frequency.

The two built-in DFLLs in all XMEGA devices can be used to improve the accuracy of the 2 MHz and 32 MHz internal oscillators. The reference clock sources can be selected to be the internal 32.768 kHz RC oscillator or an external 32.768 kHz watch crystal. That means the precision of the 2 MHz and 32 MHz internal oscillators will be decided by the reference clock accuracy. When the DFLL is enabled it will count each oscillator clock cycle, and for each reference clock edge, the counter value is compared to the fixed ideal relationship between the reference clock and the oscillator frequency. If the internal oscillator runs too fast or too slow, the DFLL will decrement or increment the corresponding DFLL Calibration register value by one to adjust the oscillator frequency slightly. For details refer to the XMEGA manual.

Knowing the fundamental characteristics of the RC oscillators, it is possible to make an efficient calibration routine that calibrates the RC oscillator to a given frequency at any operating voltage and at any temperature with an accuracy of +/-1%.