31.5.5 Main Frequency Counter
The main frequency counter measures the Main RC oscillator and the Main crystal oscillator against TD_SLCK and is managed by CKGR_MCFR.
During the measurement period, the main frequency counter increments at the speed of the clock defined by CKGR_MCFR.CCSS.
A measurement is started in the following cases:
- When CKGR_MCFR.RCMEAS is written to ‘1’.
- When the 12 MHz RC oscillator is selected as the source of the Main clock and when this oscillator becomes stable (i.e., when MOSCRCS is set)
- When the 8 to 24 MHz crystal oscillator is selected as the source of the Main clock and when this oscillator becomes stable (i.e., when MOSCXTS is set)
- When the Main clock source selection is modified
The measurement period ends at the 16th falling edge of the Slow clock, CKGR_MCFR.MAINFRDY is set and the counter stops counting. Its value can be read in the CKGR_MCFR.MAINF and gives the number of Main clock cycles during 16 periods of Slow clock, so that the frequency of the 12 MHz RC oscillator or the crystal oscillator can be determined.