English
Language : 

SAM4L Datasheet, PDF (518/1185 Pages) ATMEL Corporation – ATSAM ARM-based Flash MCU
ATSAM4L4/L2
FREQM interrupts can wake up the device from sleep modes when the measurement is done,
but only from sleep modes where CLK_FREQM is running. Refer to Section 10. ”Power Man-
ager (PM)” on page 102 for details.
22.4.2 Clocks
The clock for the FREQM bus interface (CLK_FREQM) is generated by the Power Manager. It is
recommended to disable the FREQM before disabling the clock, to avoid freezing the FREQM ia
an undefined state.
A set of clocks can be selected as reference (CLK_REF) and another set of clocks can be
selected for measurement (CLK_MSR). Refer to the CLKSEL and REFSEL tables in the Module
Configuration section for details.
22.4.3
Debug Operation
When an external debugger forces the CPU into debug mode, the FREQM continues normal
operation. If the FREQM is configured in a way that requires it to be periodically serviced by the
CPU through interrupts or similar, improper operation or data loss may result during debugging.
22.4.4 Interrupts
The FREQM interrupt request line is connected to the internal source of the NVIC. Using the
FREQM interrupt requires the NVIC to be programmed first.
22.5 Functional Description
The FREQM accuratly measures the frequency of a clock by comparing the frequency to a
known frequency:
fCLK_MSR = (VALUE/REFNUM)*fCLK_REF
22.5.1
Reference Clock
The Reference Clock Selection (REFSEL) field in the Mode Register (MODE) selects the clock
source for CLK_REF. The reference clock is enabled by writing a one to the Reference Clock
Enable (REFCEN) bit in the Mode Register. This clock should have a known frequency.
CLK_REF needs to be disabled before switching to another clock. The RCLKBUSY bit in the
Status Register (SR) indicates whether the clock is busy or not. This bit is set when the
MODE.REFCEN bit is written.
To change CLK_REF:
• Write a zero to the MODE.REFCEN bit to disable the clock, without changing the other
bits/fields in the Mode Register.
• Wait until the SR.RCLKBUSY bit reads as zero.
• Change the MODE.REFSEL field.
• Write a one to the MODE.REFCEN bit to enable the clock, without changing the other
bits/fields in the Mode Register.
• Wait until the SR.RCLKBUSY bit reads as zero.
To enable CLK_REF:
• Write the correct value to the MODE.REFSEL field.
• Write a one to the MODE.REFCEN to enable the clock, without changing the other bits/fields
in the Mode Register.
42023C–SAM–02/2013
518