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

Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/fmeas

Files

file  fsl_fmeas.h
 

Macros

#define FMEAS_INDEX   20
 The calibration duration is 2^FMEAS_INDEX times the reference clock period.
 

Driver version

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

FMEAS Functional Operation

static void FMEAS_StartMeasure (FMEAS_SYSCON_Type *base)
 Starts a frequency measurement cycle. More...
 
static void FMEAS_StartMeasureWithScale (FMEAS_SYSCON_Type *base, uint8_t scale)
 Starts a frequency measurement cycle with specific time. More...
 
static bool FMEAS_IsMeasureComplete (FMEAS_SYSCON_Type *base)
 Indicates when a frequency measurement cycle is complete. More...
 
uint32_t FMEAS_GetFrequency (FMEAS_SYSCON_Type *base, uint32_t refClockRate)
 Returns the computed value for a frequency measurement cycle. More...
 
void FMEAS_GetCountWithScale (FMEAS_SYSCON_Type *base, uint8_t scale, uint32_t *refClockCount, uint32_t *targetClockCount)
 Get the clock count during the measurement time. More...
 

Macro Definition Documentation

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

Function Documentation

static void FMEAS_StartMeasure ( FMEAS_SYSCON_Type *  base)
inlinestatic
Parameters
base: SYSCON peripheral base address.
static void FMEAS_StartMeasureWithScale ( FMEAS_SYSCON_Type *  base,
uint8_t  scale 
)
inlinestatic
Parameters
base: SYSCON peripheral base address.
scale: measurement time is 2^scale cycle of reference clock, value is from 2 to 31.
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.
void FMEAS_GetCountWithScale ( FMEAS_SYSCON_Type *  base,
uint8_t  scale,
uint32_t *  refClockCount,
uint32_t *  targetClockCount 
)
Parameters
base: SYSCON peripheral base address.
scale: measurement time is 2^scale cycle of reference clock, value is from 2 to 31.
refClockCount: Reference clock cycle during the measurement time.
targetClockCount: Target clock cycle during the measurement time.