Operational Amplifier#

Introduction#

The OPAMP peripheral is a versatile analog component that can be configured for various applications such as signal amplification, buffering, and voltage comparison. This APIs provides a step-by-step guide to initialize, configure and utilized the OPAMP peripheral based on the selected instance,ensuring optimal performance for various use cases.

Key Features:

  1. Support for both inverting and non-inverting inputs.

  2. Supports for two input terminals and single output.

  3. Supports multiple operational modes, including:

    • Unity Gain Buffer

    • Inverting and Non-Inverting Programmable Gain Amplifiers

    • Inverting and Non-Inverting with hysteresis comparators

    • Cascaded Inverting and Non-Inverting Programmable Gain Amplifiers

    • Two Opamps Differential Amplifier

  4. Provides programmable hysteresis for stable voltage comparison.

  5. Configurable GPIO pins for input and output signals.

  6. Provides flexible configuration through software APIs.

Configuration#

The OPAMP can be configured using several features, including:

  • Unity Gain Buffer: Operates as a voltage follower with no amplification.

  • Inverting Programmable Gain Amplifier: Amplifies signal with inversion.

  • Non-Inverting Programmable Gain Amplifier: Amplifies signal without inversion.

  • Inverting Programmable with Hysteresis Comparator: The output switches when the input crosses a threshold and hysteresis helps prevent noise-induced toggling.

  • Non-Inverting Programmable with Hysteresis Comparator: The output switches when the input exceeds a reference, with hysteresis for noise immunity.

  • Cascaded Inverting Programmable Gain Amplifier: Supports cascaded inverting amplifier stages for increased gain and signal inversion.

  • Cascaded Non-Inverting Programmable Gain Amplifier: Supports cascaded non-inverting amplifier stages for increased gain without signal inversion.

  • Two Opamps Differential Amplifier: Amplifies the difference between two input signals using two OPAMPs, providing high common-mode noise rejection. Useful for extracting small differential signals in the presence of large common-mode voltages. These configurations are encapsulated in the sl_opamp_config_t structure and initialized using the sl_si91x_opamp_set_configuration API.

For more details on configuration parameters, see the respective peripheral example readme document.

Usage#

After defining the OPAMP configuration structures and passing an instance of sl_opamp_config_t, the following functions can be used to initiate and configure the OPAMP features. The typical flow for implementation is as follows:

  1. Initialize the OPAMP driver: sl_si91x_opamp_init

  2. Set desired GPIO pins for input and output: sl_si91x_opamp_pin_init

  3. Set OPAMP instance and desired feature configuration: sl_si91x_opamp_set_configuration

  4. Deinitialize the OPAMP driver: sl_si91x_opamp_deinit

Modules#

sl_opamp_config_t

sl_opamp_pin_config_t

Enumerations#

enum
SL_OPAMP_1 = 1
SL_OPAMP_2
SL_OPAMP_3
SL_OPAMP_LAST
}

Enumeration to represent the opamp number.

enum
SL_OPAMP_UNITY_GAIN
SL_OPAMP_TRANS_IMPEDANCE_AMPLIFIER
SL_OPAMP_INVERTING_PROGRAMMABLE_GAIN_AMPLIFIER
SL_OPAMP_NON_INVERTING_PROGRAMMABLE_GAIN_AMPLIFIER
SL_OPAMP_INVERTING_PROGRAMMABLE_HYST_COMP
SL_OPAMP_NON_INVERTING_PROGRAMMABLE_HYST_COMP
SL_OPAMP_INSTRUMENTATION_AMPLIFIER
SL_OPAMP_CASCADED_INVERTING_PROGRAMMABLE_GAIN_AMPLIFIER
SL_OPAMP_CASCADED_NON_INVERTING_PROGRAMMABLE_GAIN_AMPLIFIER
SL_OPAMP_TWO_OPAMPS_DIFFERENTIAL_AMPLIFIER
SL_OPAMP_CONFIGURATION_LAST
}

Enumeration to represent OPAMP features.

Functions#

sl_status_t

Initialize the OPAMP module.

void

Deinitialize the OPAMP module.

sl_status_t
sl_si91x_opamp_pin_init(sl_opamp_pin_config_t *opamp_config_ptr)

Configure the OPAMP GPIOs by selecting pins for input and output.

sl_status_t
sl_si91x_opamp_set_configuration(sl_opamp_config_t *opamp_config)

Configure the OPAMP features and instance number.

Enumeration Documentation#

sl_opamp_number_t#

sl_opamp_number_t

Enumeration to represent the opamp number.

This enumeration defines the available OPAMP instances in the hardware. Each OPAMP instance corresponds to a specific hardware block.

Enumerator
SL_OPAMP_1

OPAMP 1 - First OPAMP instance.

SL_OPAMP_2

OPAMP 2 - Second OPAMP instance.

SL_OPAMP_3

OPAMP 3 - Third OPAMP instance.

SL_OPAMP_LAST

Last member of enum for validation purposes.


sl_opamp_feature_config_t#

sl_opamp_feature_config_t

Enumeration to represent OPAMP features.

This enumeration defines the various features and configurations supported by the OPAMP module. These features allow the OPAMP to be used in different operational modes depending on the application requirements.

Enumerator
SL_OPAMP_UNITY_GAIN

Unity gain - OPAMP operates as a buffer.

SL_OPAMP_TRANS_IMPEDANCE_AMPLIFIER

Trans-Impedance Amplifier - Converts current to voltage.

SL_OPAMP_INVERTING_PROGRAMMABLE_GAIN_AMPLIFIER

Inverting Programmable Gain Amplifier - Amplifies signal with inversion.

SL_OPAMP_NON_INVERTING_PROGRAMMABLE_GAIN_AMPLIFIER

Non-inverting Programmable Gain Amplifier - Amplifies signal without inversion.

SL_OPAMP_INVERTING_PROGRAMMABLE_HYST_COMP

Inverting Programmable Hysteresis Comparator - Comparator with hysteresis.

SL_OPAMP_NON_INVERTING_PROGRAMMABLE_HYST_COMP

Non-inverting Programmable Hysteresis Comparator - Comparator with hysteresis.

SL_OPAMP_INSTRUMENTATION_AMPLIFIER

Instrumentation Amplifier - High precision differential amplifier.

SL_OPAMP_CASCADED_INVERTING_PROGRAMMABLE_GAIN_AMPLIFIER

Cascaded Inverting Programmable Gain Amp - Multi-stage amplification.

SL_OPAMP_CASCADED_NON_INVERTING_PROGRAMMABLE_GAIN_AMPLIFIER

Cascaded Non-inverting Programmable Gain Amp - Multi-stage amplification.

SL_OPAMP_TWO_OPAMPS_DIFFERENTIAL_AMPLIFIER

Two OPAMPs Differential Amplifier - Differential signal amplification.

SL_OPAMP_CONFIGURATION_LAST

Last member of enum for validation purposes.


Function Documentation#

sl_si91x_opamp_init#

sl_status_t sl_si91x_opamp_init (void )

Initialize the OPAMP module.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This API initializes the OPAMP module and prepares it for operation. It sets up the necessary hardware configurations and enables the OPAMP. This function must be called before using any other OPAMP-related APIs. Configures OPAMP reference voltage as 2.5V or 3.3V

Returns

  • Status of the OPAMP initialization operation:

    • SL_STATUS_OK if the initialization was successful.

    • SL_STATUS_FAIL if the initialization failed.

For more information on the status documentation, see SL STATUS DOCUMENTATION.


sl_si91x_opamp_deinit#

void sl_si91x_opamp_deinit (void )

Deinitialize the OPAMP module.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This API deinitializes the OPAMP module and releases any resources used. It disables the OPAMP and resets its configuration to default values. This function should be called to clean up resources when OPAMP is no longer needed.


sl_si91x_opamp_pin_init#

sl_status_t sl_si91x_opamp_pin_init (sl_opamp_pin_config_t * opamp_config_ptr)

Configure the OPAMP GPIOs by selecting pins for input and output.

Parameters
TypeDirectionArgument NameDescription
sl_opamp_pin_config_t *[in]opamp_config_ptr

GPIO inputs and outputs pins selections Pointer to structure sl_opamp_pin_config_t

This API sets up the configuration multiplexing for the OPAMP peripheral, ensuring the correct GPIO pins are configured for OPAMP operation. It maps the OPAMP input and output pins to the appropriate hardware pins.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK if the OPAMP parameters were configured properly.

    • SL_STATUS_INVALID_PARAMETER if the configuration structure contains invalid values.

For more information on the status documentation, see SL STATUS DOCUMENTATION.


sl_si91x_opamp_set_configuration#

sl_status_t sl_si91x_opamp_set_configuration (sl_opamp_config_t * opamp_config)

Configure the OPAMP features and instance number.

Parameters
TypeDirectionArgument NameDescription
sl_opamp_config_t *[in]opamp_config

OPAMP instance number and features selection Pointer to structure. sl_opamp_config_t

This API configures the OPAMP by selecting features such as unity gain, non-inverting and inverting inputs, enabling/disabling hysteresis, and cascaded configurations based on the selected OPAMP instance number.

Returns

  • Status of the OPAMP configuration operation:

    • SL_STATUS_OK if the configuration was successful.

    • SL_STATUS_INVALID_PARAMETER if the configuration structure contains invalid values.

For more information on the status documentation, see SL STATUS DOCUMENTATION.