Introduction

This application note describes a fast and accurate way of calibrating the internal RC oscillators on XMEGA® devices. An easily adaptable calibration firmware example is available through Atmel® START , which can be used with any XMEGA with one or more tunable internal RC oscillators and a JTAG interface. The routine is based on using an AVR programming tool for generating a reference clock signal at a known frequency and comparing this to the frequency of the internal RC oscillator.

The internal RC oscillator frequency can be calibrated to within +/-1% of the frequency specified in the device data sheet. This feature offers great flexibility and significant cost savings compared to using an external oscillator.

The factory calibration is performed at a fixed operating voltage and temperature, typically at 3V and 85°C. As the frequency of internal RC oscillators are affected by both operating voltage and temperature, it may be desired to perform a secondary calibration in conditions matching the specific application environment. This secondary calibration can be performed to gain higher accuracy than the standard calibration offers, to match a specific operating voltage and/or temperature.

The calibration method described in this application note only takes a fraction of a second longer than reading the factory calibration byte from the signature row and writing it back to the to the device memory. Thus, the overall programming time is almost unaffected when performing calibration during the programming step in production.

In some systems it may be more beneficial to perform run-time oscillator calibration. This may be desirable in applications that need an accurate system clock over the entire temperature range and independent of operating voltage. In that case a 32.768 kHz watch crystal may offer a reliable and cost efficient solution.