23.7.1.1 Initialization
Before enabling FREQM, the device and peripheral must be configured:
- The generic
reference clock (GCLK_FREQM_REF) must be configured and enabled.Important: The reference clock must be slower than the measurement clock.
- Write the number of Reference clock cycles for which the measurement is to be done in the Configuration A register (CFGA.REFNUM).
The following registers are enable-protected, meaning that they can only be written when the FREQM is disabled (CTRLA.ENABLE = 0):
- Configuration A register (CFGA)
- Control C register (CTRLC)
- Event Control register (EVCTRL)
- Window Monitor Lower Threshold register (WINLT)
- Window Monitor Upper Threshold register (WINUT)
Enable-protection is denoted by the "Enable-Protected" property in the register description.
The following register bits are enable-protected, meaning that they can only be written when the FREQM is disabled (CTRLA.ENABLE = 0):
- On Demand Control bit in Control A register (CTRLA.ONDEMAND)
- Run During Standby bit in Control A register (CTRLA.RUNSTDBY)
- Free Running Mode bit in Control A register (CTRLA.FREERUN)
The Enable-Protected bits in the CTRLA register can be written at the same time as CTRLA.ENABLE is written to '1', but not at the same time as CTRLA.ENABLE is written to '0'.