The following configurations must be made for this project: Clock: - OSCHF as main clock source - OSCHF frequency set to 1 MHz - Enable external 32 kHz crystal oscillator - Enable CLKOUT on PA7 pin |Pin | Configuration | | :----------: | :----------------: | |PC7 (SW0) | Digital Input | ## Operation for Use Case #1 **Configure OSCHF to run at 1 MHz and activate/deactivate the auto-tune feature** 1. Connect the board to the PC. 2. Open the *Autotuning_feature.atsln* solution in Atmel Studio 3. Build the *Autotuning_feature* project: right click on *Autotuning_feature* and select Build
4. Select the AVR128DA48 Curiosity Nano on-board debugger in the *Tool* section of the *AVR-Dx_Bootloader* project settings:
- Right click on the project and click *Properties*;
- Click *Tool* tab on the left panel, select the corresponding debugger and save the configuration (Ctrl + S)
5. Program *Autotuning_feature* project to the board: select *Autotuning_feature* project and click *Start Without Debugging*:
Pressing the SW0 button on the AVR128DA48 Curiosity Nano will enable the auto-tune feature, then it will disable it.
**Results**
PA7 (CLKOUT) - with auto-tune feature deactivated (CLK configured to run at 1 MHz)
PA7 (CLKOUT) - with auto-tune feature activated (CLK configured to run at 1 MHz)
## Setup for Use Case #2
**Configure OSCHF to Run at 4 MHz and Activate/Deactivate the Auto-Tune Feature**
The following configurations must be made for this project: Clock: - OSCHF as main clock source - OSCHF frequency set to 4 MHz - Enable external 32 kHz crystal oscillator - Enable CLKOUT on PA7 pin |Pin | Configuration | | :----------: | :----------------: | |PC7 (SW0) | Digital Input | ## Operation for Use Case #2 **Configure OSCHF to Run at 4 MHz and Activate/Deactivate the Auto-Tune Feature** 1. Change the frequency settings to 4 MHz as described in TB3234 - Internal High-Frequency Oscillator Calibration Using the Auto-Tune Feature and program the project to the board (see instructions above).
**Results**
PA7 (CLKOUT) - with auto-tune feature deactivated (CLK configured to run at 4 MHz)
PA7 (CLKOUT) - with auto-tune feature activated (CLK configured to run at 4 MHz)
## Setup for Use Case #3
**Configure OSCHF to Run at 24 MHz and Activate/Deactivate the Auto-Tune Feature**
The following configurations must be made for this project: Clock: - OSCHF as main clock source - OSCHF frequency set to 24 MHz - Enable external 32 kHz crystal oscillator - Enable CLKOUT on PA7 pin |Pin | Configuration | | :----------: | :----------------: | |PC7 (SW0) | Digital Input | ## Operation for Use Case #3 **Configure OSCHF to Run at 24 MHz and Activate/Deactivate the Auto-Tune Feature** 1. Change the frequency settings to 24 MHz as described in TB3234 - Internal High-Frequency Oscillator Calibration Using the Auto-Tune Feature and program the project to the board (see instructions above).
**Results**
PA7 (CLKOUT) - with auto-tune feature deactivated (CLK configured to run at 24 MHz)
PA7 (CLKOUT) - with auto-tune feature activated (CLK configured to run at 24 MHz)
## Setup for Use Case #3
**Configure OSCHF to Run at 4 MHz with Incorrect Tuning Value**
The following configurations must be made for this project: Clock: - OSCHF as main clock source - OSCHF frequency set to 4 MHz - Enable external 32 kHz crystal oscillator - Enable CLKOUT on PA7 pin |Pin | Configuration | | :----------: | :----------------: | |PC7 (SW0) | Digital Input | ## Operation for Use Case #3 **Configure OSCHF to Run at 4 MHz with Incorrect Tuning Value** 1. Change the frequency settings to 4 MHz with incorrect tune value as described in TB3234 - Internal High-Frequency Oscillator Calibration Using the Auto-Tune Feature and program the project to the board (see instructions above).
**Results**
PA7 (CLKOUT) - with incorrect tuning value (CLK configured to run at 4 MHz)
PA7 (CLKOUT) - with auto-tune feature activated (CLK configured to run at 4 MHz)
## Summary
The [*TB3234 - Internal High-Frequency Oscillator Calibration Using the Auto-Tune Feature*](https://www.microchip.com/wwwappnotes/appnotes.aspx?appnote=en1001520) document provides four use cases for auto-tune implementation.