18.3.10.3 CFM Test
The CFM can be efficiently tested by the following software process:
- Stop the CFM by writing ‘
0
’ to the MEN bit in the CLKCTRL.MCLKCFMnCTRLA register. - 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
’. - 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.
- Set the value in the CLKCTRL.MCLKCFMnWINLT register to the value 5.
- Set the value in CLKCTRL.MCLKCFMnWINHT register to the value 11.
- Start a measurement by configuring CLKCTRL.MCLKCFMnCTRLA to:
- ONESHOT in the TYPE bit field.
- The same source as selected in CLKCTRL.MCLKCFMnCTRLB in the CFMSRC bit field.
- ENABLE in the MEN bit.
- Observe that no clock failure is detected.
- 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.
- 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.