18.3.10.1 CFM Operation

The clock source to be measured is chosen in the CFMSRC bit field in the CLKCTRL.MCLKCFMnCTRLA register, and the reference clock is chosen in the CFMREF bit field in the CLKCTRL.MCLKCFMnCTRLB register. The CFM works by incrementing a counter VALUE in the CLKCTRL.MCLKCFMnVALUE register on every clock period of main clock. The measurement is done over a span of REFNUM reference clock cycles. Once REFNUM reference clock cycles have passed, the number in VALUE is compared to the expected value range given by WINLT in the CLKCTRL.MCLKCFMnWINLT register and WINHT in the CLKCTRL.MCLKCFMnWINHT register. If VALUE is not within the configured window, the frequency is wrong and the Error Controller is notified. If the TYPE bit field in the CLKCTRL.MCLKCFMnCTRLA register is configured to CONTINUOUS mode, this measurement sequence is continuously repeated. Otherwise, only a single measurement period is performed.

If the reference clock is stopped, the measurement period will never complete. This can be detected by observing the reference clock with a CFD.

If VALUE reaches its maximum value, it will stop counting, regardless of how many reference clock cycles has passed. To ensure reliable measurements, REFNUM must be configured to a low enough value such that VALUE never reaches its maximum value.

The CFM will detect if the source clock has stopped (i.e. no transition within the measurement interval) and reports this as a CFM error by setting the CFMDn and CFMn bits in the CLKCTRL.MCLKINTFLAGS register.

Figure 18-6. Clock Frequency Measure (CFM) Block Diagram