Introduction

This application note describes a fast and accurate method to calibrate the internal RC oscillator of the Atmel® tinyAVR® and megaAVR® devices that have ISP or JTAG interfaces. It offers firmware source code that allows calibration using the AVRISP mkII, JTAGICE mkII, JTAGICE3, or Atmel-ICE programming tools. It could also be adapted to production programmers. These are covered in the “AT06015: Production Programming of Atmel Microcontrollers” application note.

Many tinyAVR and megaAVR devices offer the possibility to run from an internal RC oscillator. Typically, this oscillator can be user calibrated to within ±1% of the frequency specified in the datasheet. This feature offers significant cost savings compared to using an external oscillator.

Factory calibration is performed at a fixed operating voltage and temperature. The calibration technique in this application note can be performed by the user to achieve higher accuracy than the standard calibration offers, to match a specific operating voltage or temperature, or even to tune the oscillator to a different frequency.

In some systems it may be necessary to perform run-time calibration of the oscillator using an external crystal. This is covered in the “AVR055: Using a 32kHz XTAL for run-time calibration of the internal RC” application note.