Introduction

Author: Ioan Pop, Microchip Technology Inc.

The purpose of this document is to provide more details on the internal high-frequency oscillator (OSCHF) auto-tune feature of the AVR® DA MCU (AVR DA) family and how to activate it. The auto-tune feature allows OSCHF to adjust its frequency, comparing it to an external 32.768 kHz crystal oscillator to better match the desired value.

This document describes four use cases in which the internal high-frequency oscillator will be used to drive the main clock, each use case containing two scenarios. For the first three use cases the two scenarios are: with auto-tune feature activated and deactivated. The purpose of the last use case is to check the auto-tune feature against an incorrect tuning value provided by the user, therefore the two scenarios for the last use case are: incorrect tune value setting and auto-tune enabled. The switch between the two scenarios is made using the PC7 pin (the on-board SW0 button of the AVR128DA48 Curiosity Nano board). Additionally, the main clock will be output to the CLKOUT pin (PA7) in order to showcase the auto-tune feature improvement on the OSCHF output frequency precision. The use cases described in this technical brief are:

  • Configure OSCHF to run at 1 MHz and activate/deactivate the auto-tune feature:

    The purpose of this use case is to configure the OSCHF to run at 1 MHz and drive the main clock, and enable frequency output on the CLKOUT pin. Two frequency measurements on the CLKOUT pin will be made using an oscilloscope - with auto-tune feature activated and deactivated.

  • Configure OSCHF to run at 4 MHz and activate/deactivate the auto-tune feature:

    The purpose of this use case is to configure the OSCHF to run at 4 MHz and drive the main clock, and enable frequency output on the CLKOUT pin. Two frequency measurements on the CLKOUT pin will be made using an oscilloscope - with auto-tune feature activated and deactivated.

  • Configure OSCHF to run at 24 MHz and activate/deactivate the auto-tune feature:

    The purpose of this use case is to configure the OSCHF to run at 24 MHz and drive the main clock, and enable frequency output on the CLKOUT pin. Two frequency measurements on the CLKOUT pin will be made using an oscilloscope - with auto-tune feature activated and deactivated.

  • Configure OSCHF to run at 4 MHz with incorrect tuning value:

    The purpose of this use case is to configure the OSCHF to run at 4 MHz and drive the main clock, and enable frequency output on the CLKOUT pin. An error injection will be made to the tune register to check if the auto-tune mechanism will be able to correct it. Two frequency measurements on the CLKOUT pin will be made using an oscilloscope - with the incorrect frequency tune input and with auto-tune feature activated

Note: The AVR128DA48 Curiosity Nano was used for the tests performed and described in this document.