The MCUXpresso SDK provides a peripheral driver for the Frequency Measure function of MCUXpresso SDK devices' SYSCON module.
It measures frequency of any on-chip or off-chip clock signal. The more precise and higher accuracy clock is selected as a reference clock. The resulting frequency is internally computed from the ratio of value of selected target and reference clock counters.
Frequency Measure Driver operation
INPUTMUX_AttachSignal() function has to be used to select reference and target clock signal sources.
FMEAS_StartMeasure() function starts the measurement cycle.
FMEAS_IsMeasureComplete() can be polled to check if the measurement cycle has finished.
FMEAS_GetFrequency() returns the frequency of the target clock. Frequency of the reference clock has to be provided as a parameter.
Typical use case
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/fmeas
static void FMEAS_StartMeasure |
( |
FMEAS_SYSCON_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | : SYSCON peripheral base address. |
Set the reference clock count cycle to 2^20 times
static bool FMEAS_IsMeasureComplete |
( |
FMEAS_SYSCON_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | : SYSCON peripheral base address. |
- Returns
- true if a measurement cycle is active, otherwise false.
uint32_t FMEAS_GetFrequency |
( |
FMEAS_SYSCON_Type * |
base, |
|
|
uint32_t |
refClockRate |
|
) |
| |
- Parameters
-
base | : SYSCON peripheral base address. |
refClockRate | : Reference clock rate used during the frequency measurement cycle. |
- Returns
- Frequency in Hz.