7 Configure OSCHF to Run at 4 MHz with Incorrect Tuning Value

To better highlight the auto-tune feature, an incorrect value, 0x0F is placed in the OSCHFTUNE register. This increases the clock frequency to a level above the error threshold. The following line of code loads the OSCHFTUNE register with the desired value:

_PROTECTED_WRITE (CLKCTRL.OSCHFTUNE, 0x0F);

Figure 7-1 shows the CLKOUT when 0xF is written into OSCHFTUNE register and Figure 7-2 displays the CLKOUT after the auto-tune feature compensated the frequency drift.

Figure 7-1. 4 MHz Clock With Incorrect Tuning Value
Figure 7-2. 4 MHz Clock After Auto-Tune from Incorrect Starting Value

At the end of the auto-tune procedure, the value in the tuning register is 0x01. This is different from the previous test, where the value was 0x00. As explained in the Overview section, this is normal behavior when the error is smaller than what a single step would correct.