330
32145C–06/2013
AT32UC3L0128/256
17.4.2
Clocks
The clock for the FREQM bus interface (CLK_FREQM) is generated by the Power Manager.
This clock is enabled at reset, and can be disabled in 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). Please refer to the CLKSEL and REFSEL tables in the
Module Configuration section for details.
17.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.
17.4.4
Interrupts
The FREQM interrupt request line is connected to the internal source of the interrupt controller.
Using the FREQM interrupt requires the interrupt controller to be programmed first.
17.5
Functional Description
The FREQM accuratly measures the frequency of a clock by comparing the frequency to a
known frequency:
f
CLK_MSR = (VALUE/REFNUM)*fCLK_REF
17.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.
Wait until the SR.RCLKBUSY bit reads as zero.
To disable CLK_REF: