MCUXpresso SDK API Reference Manual  Rev 2.16.100
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
OPAMP: Operational Amplifier

Overview

The MCUXpresso SDK provides a peripheral driver for the OPAMP module of MCUXpresso SDK devices. OPAMP driver is created to help user to operate the OPAMP module. The APIs can use enable OPAMP module initialize it and de-initialize OPAMP module.

Function groups

The OPAMP driver supports operating the module as a operational amplifier.

Initialization and deinitialization

The OPAMP_Init() function will initialize the OPAMP and enable the clock for OPAMP. The OPAMP_Deinit() function will disable OPAMP module and shut down the bus clock of OPAMP.

OPAMP positive and negative port gain configuration

The OPAMP_DoPosGainConfig() function is used to set positive port gain. The OPAMP_DoNegGainConfig() function is used to set negative port gain.

OPAMP reference buffer

The OPAMP_EnableRefBuffer() is enable bias voltage input buffer.

OPAMP trigger mode

The OPAMP_EnableTriggerMode() is enable OPAMP trigger mode.

Typical use case

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

Data Structures

struct  opamp_config_t
 OPAMP configuraion, including mode, internal reference voltage, positive gain, negative gain and so on. More...
 

Enumerations

enum  opamp_mode_t {
  kOPAMP_LowNoiseMode = 0U,
  kOPAMP_HighSpeedMode
}
 The enumeration of OPAMP mode, including low noise mode and high speed mode. More...
 
enum  opamp_bias_current_trim_option_t {
  kOPAMP_TrimOptionDefault = 0U,
  kOPAMP_TrimOptionIncreaseCurrent,
  kOPAMP_TrimOptionDecreaseCurrent,
  kOPAMP_TrimOptionFurtherDecreaseCurrent
}
 The enumeration of bias current trim option. More...
 
enum  opamp_internal_ref_voltage_t {
  kOPAMP_IntRefVoltVddaDiv2 = 0U,
  kOPAMP_IntRefVoltVdda3V,
  kOPAMP_IntRefVoltVssa3V,
  kOPAMP_IntRefVoltNotAllowed
}
 The enumeration of internal reference voltage. More...
 
enum  opamp_positive_ref_voltage_t {
  kOPAMP_PosRefVoltVrefh3 = 0U,
  kOPAMP_PosRefVoltVrefh0 = 1U,
  kOPAMP_PosRefVoltVrefh1 = 2U,
  kOPAMP_PosRefVoltVrefh4 = 3U
}
 The enumeration of positive reference voltage(please refer to manual use). More...
 
enum  opamp_positive_gain_t {
  kOPAMP_PosGainReserved = 0U,
  kOPAMP_PosGainNonInvert1X = 1U,
  kOPAMP_PosGainNonInvert2X = 2U,
  kOPAMP_PosGainNonInvert4X = 3U,
  kOPAMP_PosGainNonInvert8X = 4U,
  kOPAMP_PosGainNonInvert16X = 5U,
  kOPAMP_PosGainNonInvert33X = 6U,
  kOPAMP_PosGainNonInvert64X = 7U,
  kOPAMP_PosGainNonInvertDisableBuffer2X = 8U,
  kOPAMP_PosGainNonInvertDisableBuffer3X = 9U,
  kOPAMP_PosGainNonInvertDisableBuffer5X = 10U,
  kOPAMP_PosGainNonInvertDisableBuffer9X = 11U,
  kOPAMP_PosGainNonInvertDisableBuffer17X = 12U,
  kOPAMP_PosGainNonInvertDisableBuffer34X = 13U,
  kOPAMP_PosGainNonInvertDisableBuffer65X = 14U
}
 The enumeration of positive programmable gain (please refer to manual use). More...
 
enum  opamp_negative_gain_t {
  kOPAMP_NegGainBufferMode = 0U,
  kOPAMP_NegGainInvert1X,
  kOPAMP_NegGainInvert2X,
  kOPAMP_NegGainInvert4X,
  kOPAMP_NegGainInvert8X,
  kOPAMP_NegGainInvert16X,
  kOPAMP_NegGainInvert33X,
  kOPAMP_NegGainInvert64X
}
 The enumeration of negative programmable gain. More...
 
enum  opamp_positive_input_channel_selection_t {
  kOPAMP_PosInputChannel0 = 0U,
  kOPAMP_PosInputChannel1 = 1U
}
 The enumeration of positive input channel selection. More...
 

Driver version

#define FSL_OPAMP_DRIVER_VERSION   (MAKE_VERSION(2, 2, 0))
 OPAMP driver version. More...
 

Initialization and deinitialization

void OPAMP_Init (OPAMP_Type *base, const opamp_config_t *config)
 Initialize OPAMP instance. More...
 
void OPAMP_Deinit (OPAMP_Type *base)
 De-initialize OPAMP instance. More...
 
void OPAMP_GetDefaultConfig (opamp_config_t *config)
 Get default configuration of OPAMP. More...
 

Positive port gain and negative gain configuration.

static void OPAMP_DoPosGainConfig (OPAMP_Type *base, opamp_positive_gain_t option)
 Configure OPAMP positive port gain. More...
 
static void OPAMP_DoNegGainConfig (OPAMP_Type *base, opamp_negative_gain_t option)
 Configure OPAMP negative port gain. More...
 

Reference Buffer Control Interface

static void OPAMP_EnableRefBuffer (OPAMP_Type *base, bool enable)
 Enable reference buffer. More...
 

Trigger Mode Control Interface

static void OPAMP_EnableTriggerMode (OPAMP_Type *base, bool enable)
 Enable OPAMP trigger mode. More...
 

Data Structure Documentation

struct opamp_config_t

Data Fields

bool enable
 Enable/disable OPAMP. More...
 
opamp_mode_t mode
 Opamp mode, available values are kOPAMP_LowNoiseMode and kOPAMP_HighSpeedMode. More...
 
opamp_bias_current_trim_option_t trimOption
 Bias current trim option, please refer to opamp_bias_current_trim_option_t. More...
 
opamp_internal_ref_voltage_t intRefVoltage
 Internal reference voltage, please refer to opamp_internal_ref_voltage_t. More...
 
opamp_positive_ref_voltage_t posRefVoltage
 Positive part reference voltage, please refer to opamp_positive_ref_voltage_t. More...
 
opamp_positive_gain_t posGain
 Positive part programmable gain, please refer to opamp_positive_gain_t. More...
 
opamp_negative_gain_t negGain
 Negative part programmable gain, please refer to opamp_negative_gain_t. More...
 
bool enableOutputSwitch
 OPAMP out to negative gain resistor ladder switch. More...
 
bool enablePosADCSw1
 Positive part reference voltage switch to ADC channel or not. More...
 
bool enablePosADCSw2
 Positive part reference voltage switch to ADC channel or not. More...
 
bool enableRefBuffer
 Reference buffer enable. More...
 
opamp_positive_input_channel_selection_t PosInputChannelSelection
 Positive Input Channel Selection.
 
bool enableTriggerMode
 Trigger Mode Enable. More...
 

Field Documentation

bool opamp_config_t::enable
opamp_mode_t opamp_config_t::mode
opamp_bias_current_trim_option_t opamp_config_t::trimOption
opamp_internal_ref_voltage_t opamp_config_t::intRefVoltage
opamp_positive_ref_voltage_t opamp_config_t::posRefVoltage
opamp_positive_gain_t opamp_config_t::posGain
opamp_negative_gain_t opamp_config_t::negGain
bool opamp_config_t::enableOutputSwitch
bool opamp_config_t::enablePosADCSw1
  • true Positive part reference voltage switch to ADC channel.
  • false Positive part reference voltage do not switch to ADC channel.
bool opamp_config_t::enablePosADCSw2
  • true Positive part reference voltage switch to ADC channel.
  • false Positive part reference voltage do not switch to ADC channel.
bool opamp_config_t::enableRefBuffer
bool opamp_config_t::enableTriggerMode

Macro Definition Documentation

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

Enumeration Type Documentation

Enumerator
kOPAMP_LowNoiseMode 

Set opamp mode as low noise mode.

kOPAMP_HighSpeedMode 

Set opamp mode as high speed mode.

Enumerator
kOPAMP_TrimOptionDefault 

Default Bias current trim option.

kOPAMP_TrimOptionIncreaseCurrent 

Trim option selected as increase current.

kOPAMP_TrimOptionDecreaseCurrent 

Trim option selected as decrease current.

kOPAMP_TrimOptionFurtherDecreaseCurrent 

Trim option selected as further decrease current.

Enumerator
kOPAMP_IntRefVoltVddaDiv2 

Internal reference voltage selected as Vdda/2.

kOPAMP_IntRefVoltVdda3V 

Internal reference voltage selected as Vdda_3V.

kOPAMP_IntRefVoltVssa3V 

Internal reference voltage selected as Vssa_3V.

kOPAMP_IntRefVoltNotAllowed 

Internal reference voltage not allowed.

Enumerator
kOPAMP_PosRefVoltVrefh3 

Positive part reference voltage select Vrefh3, connected from DAC output.

kOPAMP_PosRefVoltVrefh0 

Positive part reference voltage select Vrefh0, connected from VDDA supply.

kOPAMP_PosRefVoltVrefh1 

Positive part reference voltage select Vrefh1, connected from Voltage reference output.

kOPAMP_PosRefVoltVrefh4 

Positive part reference voltage select 520mv or reserved.

Enumerator
kOPAMP_PosGainReserved 

Positive Gain reserved.

kOPAMP_PosGainNonInvert1X 

Positive non-inverting gain application 1X.

kOPAMP_PosGainNonInvert2X 

Positive non-inverting gain application 2X.

kOPAMP_PosGainNonInvert4X 

Positive non-inverting gain application 4X.

kOPAMP_PosGainNonInvert8X 

Positive non-inverting gain application 8X.

kOPAMP_PosGainNonInvert16X 

Positive non-inverting gain application 16X.

kOPAMP_PosGainNonInvert33X 

Positive non-inverting gain application 33X.

kOPAMP_PosGainNonInvert64X 

Positive non-inverting gain application 64X.

kOPAMP_PosGainNonInvertDisableBuffer2X 

Positive non-inverting gain application 2X.

kOPAMP_PosGainNonInvertDisableBuffer3X 

Positive non-inverting gain application 3X.

kOPAMP_PosGainNonInvertDisableBuffer5X 

Positive non-inverting gain application 5X.

kOPAMP_PosGainNonInvertDisableBuffer9X 

Positive non-inverting gain application 9X.

kOPAMP_PosGainNonInvertDisableBuffer17X 

Positive non-inverting gain application 17X.

kOPAMP_PosGainNonInvertDisableBuffer34X 

Positive non-inverting gain application 34X.

kOPAMP_PosGainNonInvertDisableBuffer65X 

Positive non-inverting gain application 65X.

Enumerator
kOPAMP_NegGainBufferMode 

Negative Buffer Mode.

kOPAMP_NegGainInvert1X 

Negative inverting gain application -1X.

kOPAMP_NegGainInvert2X 

Negative inverting gain application -2X.

kOPAMP_NegGainInvert4X 

Negative inverting gain application -4X.

kOPAMP_NegGainInvert8X 

Negative inverting gain application -8X.

kOPAMP_NegGainInvert16X 

Negative inverting gain application -16X.

kOPAMP_NegGainInvert33X 

Negative inverting gain application -33X.

kOPAMP_NegGainInvert64X 

Negative inverting gain application -64X.

Enumerator
kOPAMP_PosInputChannel0 

When OPAMP not in trigger mode, select positive input 0 (INP0).

kOPAMP_PosInputChannel1 

When OPAMP not in trigger mode, select positive input 1 (INP1).

Function Documentation

void OPAMP_Init ( OPAMP_Type *  base,
const opamp_config_t config 
)
Parameters
baseOPAMP peripheral base address.
configThe pointer to opamp_config_t.
void OPAMP_Deinit ( OPAMP_Type *  base)
Parameters
baseOPAMP peripheral base address.
void OPAMP_GetDefaultConfig ( opamp_config_t config)
* config->enable = false;
* config->mode = kOPAMP_LowNoiseMode;
* config->trimOption = kOPAMP_TrimOptionDefault;
* config->intRefVoltage = kOPAMP_IntRefVoltVddaDiv2;
* config->enablePosADCSw = false;
* config->posRefVoltage = kOPAMP_PosRefVoltVrefh3;
* config->posGain = kOPAMP_PosGainReserved;
* config->negGain = kOPAMP_NegGainBufferMode;
*
Parameters
configThe pointer to opamp_config_t.
static void OPAMP_DoPosGainConfig ( OPAMP_Type *  base,
opamp_positive_gain_t  option 
)
inlinestatic
Parameters
baseOPAMP peripheral base address.
optionOPAMP positive port gain.
static void OPAMP_DoNegGainConfig ( OPAMP_Type *  base,
opamp_negative_gain_t  option 
)
inlinestatic
Parameters
baseOPAMP peripheral base address.
optionOPAMP negative port gain.
static void OPAMP_EnableRefBuffer ( OPAMP_Type *  base,
bool  enable 
)
inlinestatic
Parameters
baseOPAMP peripheral base address.
enabletrue to enable and false to disable.
static void OPAMP_EnableTriggerMode ( OPAMP_Type *  base,
bool  enable 
)
inlinestatic
Parameters
baseOPAMP peripheral base address.
enabletrue to enable and false to disable.