AVR351 Runtime calibration and compensation of oscillators Documentation

Atmel AVR Application Notes

Introduction

Here is the source documentation the software for application note AVR351. This is routines for calibration and compensation of RC oscillators in Atmel ATmega8HVA/16HVA, but might also be relevant for other Atmel AVR devices especially the smart battery devices.

The application is planned run on a STK506 in a STK500. with PortB1-3 connected to the switches. Pushing a switch means pulling the pin to ground. PortB0 outputs System Clock/2.

The application measures the temperature to check for changes and checks if a switch have been pushed. If the temperature hase changed more than a defined limit (TEMP_DIFF_LIMIT) or switch PB3 has been pushed, a measurement and calibration sequence will be initiated. First the Slow RC oscillator period is calculated from the temperature measurement, then the ULP RC oscillator is measured against the Slow RC and the period calculated. Lastly the Fast RC Oscillator is calibrated against the Slow RC Oscillator. If switch PB1 is pressed the FOSCCAL is adjusted one step down (decreasing frequency) and if PB2 is pressed FOSCCAL is adjusted one step up (increasing frequency). The key reading routine waits util the buttons have been released and returns an error if multiple have been pressed.

Compilation Info

This software was compiled with IAR Embedded Workbench, 4.30D. To use GCC the source have to be modified.
To make project on IAR EWAVR:
Add the .c files to project (main.c and RC_oscsampleif.c). Select device --cpu=m16hva, ATmega16HVA. Enable bit definitions in I/O include files, output format: ubrof8 for Debug and intel_extended for Release.

Device Info

ATMega8HVA/16HVA in STK506 on a STK500.

Contact Info

For more info about Atmel AVR visit http://www.atmel.com/products/AVR/
For application notes visit http://www.atmel.com/dyn/products/app_notes.asp?family_id=607
Support mail: avr@atmel.com

Generated on Tue Nov 4 14:58:57 2008 for AVR351 Runtime calibration and compensation of oscillators by  doxygen 1.5.5