MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
ANACTRL: Analog Control Driver

Function groups

The ANACTRL driver supports initialization/configuration/operation for optimization/customization purpose.

More...

Overview

This function group is to enable/disable the clock for the ANACTRL module.

The function ANACTRL_SetFro192M sets the on-chip high-speed Free Running Oscillator. The function ANACTRL_GetDefaultFro192MConfig() gets the default configuration.

The function ANACTRL_SetXo32M sets the 32 MHz Crystal oscillator. The function ANACTRL_GetDefaultXo32MConfig() gets the default configuration.

The function ANACTRL_SetRingOsc sets the three ring oscillators for RNG. The function ANACTRL_GetDefaultRingoConfig() gets the default configuration.

The function ANACTRL_EnableAdcVBATDivider() switches On/Off VBAT divider branch.

This function measures the target frequency according to the reference frequency.

Provides functions to enable/disable ANACTRL interrupts.

Provides functions to get the ANACTRL status.

Data Structures

struct  anactrl_fro192M_config_t
 Configuration for FRO192M More...
 
struct  anactrl_xo32M_config_t
 Configuration for XO32M More...
 
struct  anactrl_ring_osc_config_t
 Configuration for ring oscillator More...
 

Macros

#define FSL_ANACTRL_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0)) /*!< Version 2.0.0. */`
 ANACTRL driver version. More...
 

Enumerations

enum  _anactrl_interrupt_flags {
  kANACTRL_BodVbatFlag,
  kANACTRL_BodVbatInterruptFlag,
  kANACTRL_BodVbatPowerFlag,
  kANACTRL_BodCoreFlag,
  kANACTRL_BodCoreInterruptFlag,
  kANACTRL_BodCorePowerFlag,
  kANACTRL_DcdcFlag,
  kANACTRL_DcdcInterruptFlag,
  kANACTRL_DcdcPowerFlag
}
 ANACTRL interrupt flags. More...
 
enum  _anactrl_interrupt {
  kANACTRL_BodVbatInterruptEnable,
  kANACTRL_BodCoreInterruptEnable,
  kANACTRL_DcdcInterruptEnable = ANACTRL_BOD_DCDC_INT_CTRL_DCDC_INT_ENABLE_MASK,
  kANACTRL_BodVbatInterruptClear,
  kANACTRL_BodCoreInterruptClear,
  kANACTRL_DcdcInterruptClear = ANACTRL_BOD_DCDC_INT_CTRL_DCDC_INT_CLEAR_MASK
}
 ANACTRL interrupt control. More...
 
enum  _anactrl_flags {
  kANACTRL_PMUId = ANACTRL_ANALOG_CTRL_STATUS_PMU_ID_MASK,
  kANACTRL_OSCId,
  kANACTRL_FlashPowerDownFlag = ANACTRL_ANALOG_CTRL_STATUS_FLASH_PWRDWN_MASK,
  kANACTRL_FlashInitErrorFlag,
  kANACTRL_FinalTestFlag
}
 ANACTRL status flags. More...
 
enum  _anactrl_osc_flags {
  kANACTRL_OutputClkValidFlag = ANACTRL_FRO192M_STATUS_CLK_VALID_MASK,
  kANACTRL_CCOThresholdVoltageFlag,
  kANACTRL_XO32MOutputReadyFlag
}
 ANACTRL FRO192M and XO32M status flags. More...
 
enum  anactrl_ldo_output_mode_t {
  kANACTRL_LDOOutputHighNormalMode = 0U,
  kANACTRL_LDOOutputHighImpedanceMode = 1U
}
 LDO output mode. More...
 
enum  anactrl_ldo_output_level_t {
  kANACTRL_LDOOutputLevel0 = 0U,
  kANACTRL_LDOOutputLevel1,
  kANACTRL_LDOOutputLevel2,
  kANACTRL_LDOOutputLevel3,
  kANACTRL_LDOOutputLevel4,
  kANACTRL_LDOOutputLevel5,
  kANACTRL_LDOOutputLevel6,
  kANACTRL_LDOOutputLevel7
}
 LDO output level. More...
 
enum  anactrl_ring_osc_selector_t {
  kANACTRL_ShortRingOsc = 0U,
  kANACTRL_LongRingOsc = 1U
}
 Select short or long ring osc. More...
 
enum  anactrl_ring_osc_freq_output_divider_t {
  kANACTRL_HighFreqOutput = 0U,
  kANACTRL_LowFreqOutput = 1U
}
 Ring osc frequency output divider. More...
 
enum  anactrl_pn_ring_osc_mode_t {
  kANACTRL_NormalMode = 0U,
  kANACTRL_PMonitorPTransistorMode = 1U,
  kANACTRL_PMonitorNTransistorMode = 2U,
  kANACTRL_NotUse = 3U
}
 PN-Ring osc (P-Transistor and N-Transistor processing) control. More...
 

Initialization and deinitialization

void ANACTRL_Init (ANACTRL_Type *base)
 Enable the access to ANACTRL registers and initialize ANACTRL module. More...
 
void ANACTRL_Deinit (ANACTRL_Type *base)
 De-initialize ANACTRL module. More...
 

Set oscillators

void ANACTRL_SetFro192M (ANACTRL_Type *base, anactrl_fro192M_config_t *config)
 Set the on-chip high-speed Free Running Oscillator. More...
 
void ANACTRL_GetDefaultFro192MConfig (anactrl_fro192M_config_t *config)
 Get the default configuration of FRO192M. More...
 
void ANACTRL_SetXo32M (ANACTRL_Type *base, anactrl_xo32M_config_t *config)
 Set the 32 MHz Crystal oscillator. More...
 
void ANACTRL_GetDefaultXo32MConfig (anactrl_xo32M_config_t *config)
 Get the default configuration of XO32M. More...
 
void ANACTRL_SetRingOsc (ANACTRL_Type *base, anactrl_ring_osc_config_t *config)
 Set the ring oscillators. More...
 
void ANACTRL_GetDefaultRingOscConfig (anactrl_ring_osc_config_t *config)
 Get the default configuration of ring oscillators. More...
 

ADC control

static void ANACTRL_EnableAdcVBATDivider (ANACTRL_Type *base, bool enable)
 Enable VBAT divider branch. More...
 

Measure Frequency

uint32_t ANACTRL_MeasureFrequency (ANACTRL_Type *base, uint8_t scale, uint32_t refClkFreq)
 Measure Frequency. More...
 

Interrupt Interface

static void ANACTRL_EnableInterrupt (ANACTRL_Type *base, uint32_t mask)
 Enable the ANACTRL interrupts. More...
 
static void ANACTRL_DisableInterrupt (ANACTRL_Type *base, uint32_t mask)
 Disable the ANACTRL interrupts. More...
 

Status Interface

static uint32_t ANACTRL_GetStatusFlags (ANACTRL_Type *base)
 Get ANACTRL status flags. More...
 
static uint32_t ANACTRL_GetOscStatusFlags (ANACTRL_Type *base)
 Get ANACTRL oscillators status flags. More...
 
static uint32_t ANACTRL_GetInterruptStatusFlags (ANACTRL_Type *base)
 Get ANACTRL interrupt status flags. More...
 

Data Structure Documentation

struct anactrl_fro192M_config_t

This structure holds the configuration settings for the on-chip high-speed Free Running Oscillator. To initialize this structure to reasonable defaults, call the ANACTRL_GetDefaultFro192MConfig() function and pass a pointer to your config structure instance.

Data Fields

uint8_t biasTrim
 Set bias trimming value (course frequency trimming). More...
 
uint8_t tempTrim
 Set temperature coefficient trimming value. More...
 
uint8_t dacTrim
 
                       Set curdac trimming value (fine frequency trimming) This trim is used to

adjust the frequency, given that the bias and temperature trim are set. More...

 
bool enable12MHzClk
 Enable 12MHz clock. More...
 
bool enable48MhzClk
 Enable 48MHz clock. More...
 
bool enable96MHzClk
 Enable 96MHz clock. More...
 
bool enableAnalogTestBus
 Enable analog test bus. More...
 

Field Documentation

uint8_t anactrl_fro192M_config_t::biasTrim
uint8_t anactrl_fro192M_config_t::tempTrim
uint8_t anactrl_fro192M_config_t::dacTrim
bool anactrl_fro192M_config_t::enable12MHzClk
bool anactrl_fro192M_config_t::enable48MhzClk
bool anactrl_fro192M_config_t::enable96MHzClk
bool anactrl_fro192M_config_t::enableAnalogTestBus
struct anactrl_xo32M_config_t

This structure holds the configuration settings for the 32 MHz crystal oscillator. To initialize this structure to reasonable defaults, call the ANACTRL_GetDefaultXo32MConfig() function and pass a pointer to your config structure instance.

Data Fields

bool enableACBufferBypass
 Enable XO AC buffer bypass in pll and top level. More...
 
bool enablePllUsbOutput
 Enable XO 32 MHz output to USB HS PLL. More...
 
bool enableSysCLkOutput
 Enable XO 32 MHz output to CPU system, SCT, and CLKOUT.
 
bool enableLDOBypass
 Activate LDO bypass. More...
 
anactrl_ldo_output_mode_t LDOOutputMode
 Set LDO output mode. More...
 
anactrl_ldo_output_level_t LDOOutputLevel
 Set LDO output level. More...
 
uint8_t bias
 Adjust the biasing current. More...
 
uint8_t stability
 Stability configuration. More...
 

Field Documentation

bool anactrl_xo32M_config_t::enableACBufferBypass
bool anactrl_xo32M_config_t::enablePllUsbOutput
bool anactrl_xo32M_config_t::enableLDOBypass
anactrl_ldo_output_mode_t anactrl_xo32M_config_t::LDOOutputMode
anactrl_ldo_output_level_t anactrl_xo32M_config_t::LDOOutputLevel
uint8_t anactrl_xo32M_config_t::bias
uint8_t anactrl_xo32M_config_t::stability
struct anactrl_ring_osc_config_t

This structure holds the configuration settings for the three ring oscillators. To initialize this structure to reasonable defaults, call the ANACTRL_GetDefaultRingOscConfig() function and pass a pointer to your config structure instance.

Macro Definition Documentation

#define FSL_ANACTRL_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0)) /*!< Version 2.0.0. */`

Enumeration Type Documentation

Enumerator
kANACTRL_BodVbatFlag 

BOD VBAT Interrupt status before Interrupt Enable.

kANACTRL_BodVbatInterruptFlag 

BOD VBAT Interrupt status after Interrupt Enable.

kANACTRL_BodVbatPowerFlag 

Current value of BOD VBAT power status output.

kANACTRL_BodCoreFlag 

BOD CORE Interrupt status before Interrupt Enable.

kANACTRL_BodCoreInterruptFlag 

BOD CORE Interrupt status after Interrupt Enable.

kANACTRL_BodCorePowerFlag 

Current value of BOD CORE power status output.

kANACTRL_DcdcFlag 

DCDC Interrupt status before Interrupt Enable.

kANACTRL_DcdcInterruptFlag 

DCDC Interrupt status after Interrupt Enable.

kANACTRL_DcdcPowerFlag 

Current value of DCDC power status output.

Enumerator
kANACTRL_BodVbatInterruptEnable 

BOD VBAT interrupt control.

kANACTRL_BodCoreInterruptEnable 

BOD CORE interrupt control.

kANACTRL_DcdcInterruptEnable 

DCDC interrupt control.

kANACTRL_BodVbatInterruptClear 

BOD VBAT interrupt clear.1: Clear the interrupt.

Self-cleared bit.

kANACTRL_BodCoreInterruptClear 

BOD CORE interrupt clear.1: Clear the interrupt.

Self-cleared bit.

kANACTRL_DcdcInterruptClear 

DCDC interrupt clear.1: Clear the interrupt.

Self-cleared bit.

Enumerator
kANACTRL_PMUId 

Power Management Unit (PMU) analog macro-bloc identification number.

kANACTRL_OSCId 

Oscillators analog macro-bloc identification number.

kANACTRL_FlashPowerDownFlag 

Flash power-down status.

kANACTRL_FlashInitErrorFlag 

Flash initialization error status.

kANACTRL_FinalTestFlag 

Indicates current status of final test.

Enumerator
kANACTRL_OutputClkValidFlag 

Output clock valid signal.

kANACTRL_CCOThresholdVoltageFlag 

CCO threshold voltage detector output (signal vcco_ok).

kANACTRL_XO32MOutputReadyFlag 

Indicates XO out frequency statibilty.

Enumerator
kANACTRL_LDOOutputHighNormalMode 

Output in High normal state.

kANACTRL_LDOOutputHighImpedanceMode 

Output in High Impedance state.

Enumerator
kANACTRL_LDOOutputLevel0 

Output level 0.750 V.

kANACTRL_LDOOutputLevel1 

Output level 0.775 V.

kANACTRL_LDOOutputLevel2 

Output level 0.800 V.

kANACTRL_LDOOutputLevel3 

Output level 0.825 V.

kANACTRL_LDOOutputLevel4 

Output level 0.850 V.

kANACTRL_LDOOutputLevel5 

Output level 0.875 V.

kANACTRL_LDOOutputLevel6 

Output level 0.900 V.

kANACTRL_LDOOutputLevel7 

Output level 0.925 V.

Enumerator
kANACTRL_ShortRingOsc 

Select short ring osc (few elements).

kANACTRL_LongRingOsc 

Select long ring osc (many elements).

Enumerator
kANACTRL_HighFreqOutput 

High frequency output (frequency lower than 100 MHz).

kANACTRL_LowFreqOutput 

Low frequency output (frequency lower than 10 MHz).

Enumerator
kANACTRL_NormalMode 

Normal mode.

kANACTRL_PMonitorPTransistorMode 

P-Monitor mode.

Measure with weak P transistor.

kANACTRL_PMonitorNTransistorMode 

P-Monitor mode.

Measure with weak N transistor.

kANACTRL_NotUse 

Do not use.

Function Documentation

void ANACTRL_Init ( ANACTRL_Type *  base)
Parameters
baseANACTRL peripheral base address.
void ANACTRL_Deinit ( ANACTRL_Type *  base)
Parameters
baseANACTRL peripheral base address.
void ANACTRL_SetFro192M ( ANACTRL_Type *  base,
anactrl_fro192M_config_t config 
)
Parameters
baseANACTRL peripheral base address.
configPointer to FRO192M configuration structure. Refer to "anactrl_fro192M_config_t" structure.
void ANACTRL_GetDefaultFro192MConfig ( anactrl_fro192M_config_t config)

The default values are: code config->biasTrim = 0x1AU; config->tempTrim = 0x20U; config->enable12MHzClk = true; config->enable48MhzClk = true; config->dacTrim = 0x80U; config->enableAnalogTestBus = false; config->enable96MHzClk = false; encode

Parameters
configPointer to FRO192M configuration structure. Refer to "anactrl_fro192M_config_t" structure.
void ANACTRL_SetXo32M ( ANACTRL_Type *  base,
anactrl_xo32M_config_t config 
)
Parameters
baseANACTRL peripheral base address.
configPointer to XO32M configuration structure. Refer to "anactrl_xo32M_config_t" structure.
void ANACTRL_GetDefaultXo32MConfig ( anactrl_xo32M_config_t config)

The default values are: code config->enableACBufferBypass = false; config->enablePllUsbOutput = false; config->enableSysCLkOutput = false; config->enableLDOBypass = false; config->LDOOutputMode = kANACTRL_LDOOutputHighNormalMode; config->LDOOutputLevel = kANACTRL_LDOOutputLevel4; config->bias = 2U; config->stability = 3U; encode

Parameters
configPointer to XO32M configuration structure. Refer to "anactrl_xo32M_config_t" structure.
void ANACTRL_SetRingOsc ( ANACTRL_Type *  base,
anactrl_ring_osc_config_t config 
)
Parameters
baseANACTRL peripheral base address.
configPointer to ring osc configuration structure. Refer to "anactrl_ring_osc_config_t" structure.
void ANACTRL_GetDefaultRingOscConfig ( anactrl_ring_osc_config_t config)

The default values are: code config->ringOscSel = kANACTRL_ShortRingOsc; config->ringOscFreqOutputDiv = kANACTRL_HighFreqOutput; config->pnRingOscMode = kANACTRL_NormalMode; config->ringOscOutClkDiv = 0U; encode

Parameters
configPointer to ring oscillator configuration structure. Refer to "anactrl_ring_osc_config_t" structure.
static void ANACTRL_EnableAdcVBATDivider ( ANACTRL_Type *  base,
bool  enable 
)
inlinestatic
Parameters
baseANACTRL peripheral base address.
enableswitcher to the function.
uint32_t ANACTRL_MeasureFrequency ( ANACTRL_Type *  base,
uint8_t  scale,
uint32_t  refClkFreq 
)

This function measures target frequency according to a accurate reference frequency.The formula is: Ftarget = (CAPVAL * Freference) / ((1<<SCALE)-1)

Parameters
baseANACTRL peripheral base address. Define the power of 2 count that ref counter counts to during measurement. frequency of the reference clock.
Returns
frequency of the target clock.

the minimum count (scale) is 2.

static void ANACTRL_EnableInterrupt ( ANACTRL_Type *  base,
uint32_t  mask 
)
inlinestatic
Parameters
basANACTRL peripheral base address.
maskThe interrupt mask. Refer to "_anactrl_interrupt" enumeration.
static void ANACTRL_DisableInterrupt ( ANACTRL_Type *  base,
uint32_t  mask 
)
inlinestatic
Parameters
basANACTRL peripheral base address.
maskThe interrupt mask. Refer to "_anactrl_interrupt" enumeration.
static uint32_t ANACTRL_GetStatusFlags ( ANACTRL_Type *  base)
inlinestatic

This function gets Analog control status flags. The flags are returned as the logical OR value of the enumerators _anactrl_flags. To check for a specific status, compare the return value with enumerators in the _anactrl_flags. For example, to check whether the flash is in power down mode:

* if (kANACTRL_FlashPowerDownFlag & ANACTRL_ANACTRL_GetStatusFlags(ANACTRL))
* {
* ...
* }
*
Parameters
baseANACTRL peripheral base address.
Returns
ANACTRL status flags which are given in the enumerators in the _anactrl_flags.
static uint32_t ANACTRL_GetOscStatusFlags ( ANACTRL_Type *  base)
inlinestatic

This function gets Anactrl oscillators status flags. The flags are returned as the logical OR value of the enumerators _anactrl_osc_flags. To check for a specific status, compare the return value with enumerators in the _anactrl_osc_flags. For example, to check whether the FRO192M clock output is valid:

* if (kANACTRL_OutputClkValidFlag & ANACTRL_ANACTRL_GetOscStatusFlags(ANACTRL))
* {
* ...
* }
*
Parameters
baseANACTRL peripheral base address.
Returns
ANACTRL oscillators status flags which are given in the enumerators in the _anactrl_osc_flags.
static uint32_t ANACTRL_GetInterruptStatusFlags ( ANACTRL_Type *  base)
inlinestatic

This function gets Anactrl interrupt status flags. The flags are returned as the logical OR value of the enumerators _anactrl_interrupt_flags. To check for a specific status, compare the return value with enumerators in the _anactrl_interrupt_flags. For example, to check whether the VBAT voltage level is above the threshold:

* if (kANACTRL_BodVbatPowerFlag & ANACTRL_ANACTRL_GetInterruptStatusFlags(ANACTRL))
* {
* ...
* }
*
Parameters
baseANACTRL peripheral base address.
Returns
ANACTRL oscillators status flags which are given in the enumerators in the _anactrl_osc_flags.