18.3.10.3 CFM Test

The CFM can be efficiently tested by the following software process:

  1. Stop the CFM by writing ‘0’ to the MEN bit in the CLKCTRL.MCLKCFMnCTRLA register.
  2. Select the fastest possible reference clock by writing the CFMREF bit field in the CLKCTRL.MCLKCFMnCTRLB register to the fastest of OSCHF or XOSCHF, and write the REFCEN bit to ‘1’.
  3. Write the value in REFNUM to the value 8, so that comparison completes after 8 reference clock cycles. The expected value of the CLKCTRL.MCLKCFMnVALUE register will then be 8 ± 2, i.e. in the range 6 to 10.
  4. Set the value in the CLKCTRL.MCLKCFMnWINLT register to the value 5.
  5. Set the value in CLKCTRL.MCLKCFMnWINHT register to the value 11.
  6. Start a measurement by configuring CLKCTRL.MCLKCFMnCTRLA to:
    1. ONESHOT in the TYPE bit field.
    2. The same source as selected in CLKCTRL.MCLKCFMnCTRLB in the CFMSRC bit field.
    3. ENABLE in the MEN bit.
  7. Observe that no clock failure is detected.
  8. Repeat this process steps 1-6 but with selecting WINLT=2 and WINHT=5 so that a window is configured below the measurement, and observe that a clock measurement failure is detected.
  9. Repeat this process steps 1-6 but with selecting WINLT=12 and WINHT=15 so that a window is configured above the measurement, and observe that a clock measurement failure is detected.