MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
FMEAS: Frequency Measure Driver

Overview

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

uint32_t freqRef = ...;
uint32_t freq;
/* Setup reference clock */
INPUTMUX_AttachSignal(INPUTMUX, EXAMPLE_REFERENCE_CLOCK_REGISTRY_INDEX, EXAMPLE_REFERENCE_CLOCK);
/* Setup to measure the selected target */
INPUTMUX_AttachSignal(INPUTMUX, EXAMPLE_TARGET_CLOCK_REGISTRY_INDEX, EXAMPLE_TARGET_CLOCK);
/* Start a measurement cycle and wait for it to complete. If the target
clock is not running, the measurement cycle will remain active
forever, so a timeout may be necessary if the target clock can stop. */
while (!FMEAS_IsMeasureComplete(SYSCON)) {}
/* Get computed frequency */
freq = FMEAS_GetFrequency(SYSCON, freqRef);

Files

file  fsl_fmeas.h
 

Driver version

#define FSL_FMEAS_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))
 Defines LPC Frequency Measure driver version 2.0.0. More...
 

FMEAS Functional Operation

static void FMEAS_StartMeasure (SYSCON_Type *base)
 Starts a frequency measurement cycle. More...
 
static bool FMEAS_IsMeasureComplete (SYSCON_Type *base)
 Indicates when a frequency measurement cycle is complete. More...
 
uint32_t FMEAS_GetFrequency (SYSCON_Type *base, uint32_t refClockRate)
 Returns the computed value for a frequency measurement cycle. More...
 

Macro Definition Documentation

#define FSL_FMEAS_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))

Change log:

  • Version 2.0.0
    • initial version

Function Documentation

static void FMEAS_StartMeasure ( SYSCON_Type *  base)
inlinestatic
Parameters
base: SYSCON peripheral base address.
static bool FMEAS_IsMeasureComplete ( SYSCON_Type *  base)
inlinestatic
Parameters
base: SYSCON peripheral base address.
Returns
true if a measurement cycle is active, otherwise false.
uint32_t FMEAS_GetFrequency ( 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.