LL OPAMP Functions

Configuration of OPAMP hierarchical scope: common OPAMP instances

group OPAMP_LL_EF_Configuration_opamp_common

Functions

void LL_OPAMP_SetCommonPowerRange ( OPAMP_Common_TypeDef * p_opamp_common , uint32_t power_range )

Set OPAMP power range.

Reference Manual to LL API cross reference (Register Field Functions)

CSR OPARANGE LL_OPAMP_SetCommonPowerRange

Note

The OPAMP power range applies to several OPAMP instances (if several OPAMP instances available on the selected device). It is mandatory to set already the power range to high for performance purpose.

Note

On this STM32 series, setting of this feature is conditioned to OPAMP state: All OPAMP instances of the OPAMP common group must be disabled. This check can be done with function LL_OPAMP_IsEnabled() for each OPAMP instance.

Note

LL_OPAMP_POWERSUPPLY_RANGE_HIGH parameter is highly recommended for performance purpose.

Parameters :
uint32_t LL_OPAMP_GetCommonPowerRange ( const OPAMP_Common_TypeDef * p_opamp_common )

Get OPAMP power range.

Reference Manual to LL API cross reference (Register Field Functions)

CSR OPARANGE LL_OPAMP_GetCommonPowerRange

Note

The OPAMP power range applies to several OPAMP instances (if several OPAMP instances available on the selected device).

Parameters :

p_opamp_common – OPAMP common instance

Return values :

Returned – value can be one of the following values:

Configuration of OPAMP hierarchical scope: OPAMP instance

group OPAMP_LL_EF_CONFIGURATION_OPAMP_INSTANCE

Functions

void LL_OPAMP_ResetConfig ( OPAMP_TypeDef * p_opamp )

Reset OPAMP CSR register, reset all bits except USERTRIM and OPA_RANGE.

Reference Manual to LL API cross reference (Register Field Functions)

CSR OPAHSM LL_OPAMP_ResetConfig

CSR CALOUT LL_OPAMP_ResetConfig

CSR USERTRIM LL_OPAMP_ResetConfig

CSR CALSEL LL_OPAMP_ResetConfig

CSR CALON LL_OPAMP_ResetConfig

CSR VP_SEL LL_OPAMP_ResetConfig

Note

The OPAMP must be disabled to change this configuration.

Parameters :

p_opamp – OPAMP instance

void LL_OPAMP_Set_LowPower_Speed_Mode ( OPAMP_TypeDef * p_opamp , uint32_t power_mode , uint32_t speed_mode )

Set OPAMP low power and speed mode.

Reference Manual to LL API cross reference (Register Field Functions)

CSR OPALPM LL_OPAMP_Set_LowPower_Speed_Mode

CSR OPAHSM LL_OPAMP_Set_LowPower_Speed_Mode

Note

The OPAMP must be disabled to change this configuration.

Parameters :
void LL_OPAMP_SetLowPowerMode ( OPAMP_TypeDef * p_opamp , uint32_t power_mode )

Set OPAMP low or normal power mode.

Reference Manual to LL API cross reference (Register Field Functions)

CSR OPALPM LL_OPAMP_SetLowPowerMode

Note

The OPAMP must be disabled to change this configuration.

Parameters :
uint32_t LL_OPAMP_GetLowPowerMode ( const OPAMP_TypeDef * p_opamp )

Get OPAMP low or normal power mode.

Reference Manual to LL API cross reference (Register Field Functions)

CSR OPALPM LL_OPAMP_GetLowPowerMode

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values:

void LL_OPAMP_SetSpeedMode ( OPAMP_TypeDef * p_opamp , uint32_t speed_mode )

Set OPAMP speed mode.

Reference Manual to LL API cross reference (Register Field Functions)

CSR HSM LL_OPAMP_SetSpeedMode

Note

The OPAMP must be disabled to change this configuration.

Parameters :
uint32_t LL_OPAMP_GetSpeedMode ( const OPAMP_TypeDef * p_opamp )

Get OPAMP speed mode.

Reference Manual to LL API cross reference (Register Field Functions)

CSR HSM LL_OPAMP_GetSpeedMode

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values:

void LL_OPAMP_SetMode ( OPAMP_TypeDef * p_opamp , uint32_t mode )

Set OPAMP mode calibration or functional.

Reference Manual to LL API cross reference (Register Field Functions)

CSR CALON LL_OPAMP_SetMode

Note

OPAMP mode corresponds to functional or calibration mode:

  • functional mode: OPAMP operation in standalone, follower, … Set functional mode using function LL_OPAMP_SetConfigurationMode() .

  • calibration mode: offset calibration of the selected transistors differential pair NMOS or PMOS.

Note

On this STM32 series, during calibration, OPAMP functional mode must be set to standalone or follower mode (in order to open internal connections to resistors of PGA mode). Refer to function LL_OPAMP_SetConfigurationMode() .

Parameters :
uint32_t LL_OPAMP_GetMode ( const OPAMP_TypeDef * p_opamp )

Get OPAMP mode calibration or functional.

Reference Manual to LL API cross reference (Register Field Functions)

CSR CALON LL_OPAMP_GetMode

Note

OPAMP mode corresponds to functional or calibration mode:

  • functional mode: OPAMP operation in standalone, follower, … Set functional mode using function LL_OPAMP_SetConfigurationMode() .

  • calibration mode: offset calibration of the selected transistors differential pair NMOS or PMOS.

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values:

void LL_OPAMP_SetConfigurationMode ( OPAMP_TypeDef * p_opamp , uint32_t mode )

Set OPAMP configuration mode by setting internal connections.

Reference Manual to LL API cross reference (Register Field Functions)

CSR OPAMODE LL_OPAMP_SetConfigurationMode

Note

This function reset bit of calibration mode to ensure to be in functional mode, in order to have OPAMP parameters (inputs selection, …) set with the corresponding OPAMP mode to be effective.

Parameters :
uint32_t LL_OPAMP_GetConfigurationMode ( const OPAMP_TypeDef * p_opamp )

Get OPAMP configuration mode from setting of internal connections. OPAMP operation in standalone, follower, …

Reference Manual to LL API cross reference (Register Field Functions)

CSR OPAMODE LL_OPAMP_GetConfigurationMode

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values:

void LL_OPAMP_SetPGAGain ( OPAMP_TypeDef * p_opamp , uint32_t gain )

Set OPAMP PGA gain.

Reference Manual to LL API cross reference (Register Field Functions)

CSR gain LL_OPAMP_SetPGAGain

Note

Preliminarily, OPAMP must be set in mode PGA using function LL_OPAMP_SetConfigurationMode() .

Parameters :
uint32_t LL_OPAMP_GetPGAGain ( const OPAMP_TypeDef * p_opamp )

Get OPAMP PGA gain.

Reference Manual to LL API cross reference (Register Field Functions)

CSR PGA_GAIN LL_OPAMP_GetPGAGain

Note

Preliminarily, OPAMP must be set in mode PGA using function LL_OPAMP_SetConfigurationMode() .

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values:

void LL_OPAMP_SetConfig ( OPAMP_TypeDef * p_opamp , uint32_t reg_value )

Set OPAMP in one time configuration parameters.

Reference Manual to LL API cross reference (Register Field Functions)

CSR CALON LL_OPAMP_SetConfig

CSR OPAMODE LL_OPAMP_SetConfig

CSR OPALPM LL_OPAMP_SetConfig

CSR HSM LL_OPAMP_SetConfig

CSR VM_SEL LL_OPAMP_SetConfig

CSR VP_SEL LL_OPAMP_SetConfig

Note

Preliminarily, OPAMP must be disabled.

Parameters :
  • p_opamp – OPAMP instance

  • reg_value – This parameter is a concatenation of bits CALON, OPAMODE, OPALPM, HSM, VM_SEL, VP_SEL

uint32_t LL_OPAMP_GetConfig ( const OPAMP_TypeDef * p_opamp )

Get OPAMP configuration parameters bit fields.

Reference Manual to LL API cross reference (Register Field Functions)

CSR CALON LL_OPAMP_GetConfig

CSR OPAMODE LL_OPAMP_GetConfig

CSR OPALPM LL_OPAMP_GetConfig

CSR HSM LL_OPAMP_GetConfig

CSR VM_SEL LL_OPAMP_GetConfig

CSR VP_SEL LL_OPAMP_GetConfig

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value is the contents of CSR register

Configuration of OPAMP inputs

group OPAMP_LL_EF_CONFIGURATION_INPUTS

Functions

void LL_OPAMP_SetInputNonInverting ( OPAMP_TypeDef * p_opamp , uint32_t input_non_inverting )

Set OPAMP non-inverting input connection.

Reference Manual to LL API cross reference (Register Field Functions)

CSR VPSEL LL_OPAMP_SetInputNonInverting

Parameters :
uint32_t LL_OPAMP_GetInputNonInverting ( const OPAMP_TypeDef * p_opamp )

Get OPAMP non-inverting input connection.

Reference Manual to LL API cross reference (Register Field Functions)

CSR VPSEL LL_OPAMP_GetInputNonInverting

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values: This parameter can be one of the following values:

void LL_OPAMP_SetInputInverting ( OPAMP_TypeDef * p_opamp , uint32_t input_inverting )

Set OPAMP inverting input connection.

Reference Manual to LL API cross reference (Register Field Functions)

CSR VMSEL LL_OPAMP_SetInputInverting

Note

OPAMP inverting input is used with OPAMP in mode standalone or PGA with external capacitors for filtering circuit. Otherwise (OPAMP in mode follower), OPAMP inverting input is not used (not connected to GPIO pin).

Parameters :
uint32_t LL_OPAMP_GetInputInverting ( const OPAMP_TypeDef * p_opamp )

Get OPAMP inverting input connection.

Reference Manual to LL API cross reference (Register Field Functions)

CSR VMSEL LL_OPAMP_GetInputInverting

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values:

void LL_OPAMP_SetInputs ( OPAMP_TypeDef * p_opamp , uint32_t input_non_inverting , uint32_t input_inverting )

Set OPAMP both inverting input and non-inverting input connections.

Reference Manual to LL API cross reference (Register Field Functions)

CSR VPSEL LL_OPAMP_SetInputs

CSR VMSEL LL_OPAMP_SetInputs

Note

OPAMP inverting input is used with OPAMP in mode standalone or PGA with external capacitors for filtering circuit. Otherwise (OPAMP in mode follower), OPAMP inverting input is not used (not connected to GPIO pin).

Parameters :
uint32_t LL_OPAMP_GetInputs ( const OPAMP_TypeDef * p_opamp )

Get OPAMP both non-inverting input and inverting input connection.

Reference Manual to LL API cross reference (Register Field Functions)

CSR VPSEL LL_OPAMP_GetInputs

CSR VMSEL LL_OPAMP_GetInputs

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value is inverting input and non-inverting input both contained in an uint32_t. This bit field contains the following values inside the [31,0] bit field: VP_SEL bit [10] VM_SEL bit [9,8] Those parameters can be one of the following values for VP_SEL:

Configuration of OPAMP, legacy functions name

group OPAMP_LL_EF_Configuration_Legacy_Functions

Functions

void LL_OPAMP_SetNonInvertingInput ( OPAMP_TypeDef * p_opamp , uint32_t non_inverting_input )
void LL_OPAMP_SetInvertingInput ( OPAMP_TypeDef * p_opamp , uint32_t inverting_input )
void LL_OPAMP_SetFunctionalMode ( OPAMP_TypeDef * p_opamp , uint32_t mode )
uint32_t LL_OPAMP_GetFunctionalMode ( const OPAMP_TypeDef * p_opamp )

Configuration and operation of OPAMP trimming

group OPAMP_LL_EF_OPAMP_TRIMMING

Functions

void LL_OPAMP_SetTrimmingMode ( OPAMP_TypeDef * p_opamp , uint32_t trimming_mode )

Set OPAMP trimming mode.

Reference Manual to LL API cross reference (Register Field Functions)

CSR USERTRIM LL_OPAMP_SetTrimmingMode

Parameters :
uint32_t LL_OPAMP_GetTrimmingMode ( const OPAMP_TypeDef * p_opamp )

Get OPAMP trimming mode.

Reference Manual to LL API cross reference (Register Field Functions)

CSR USERTRIM LL_OPAMP_GetTrimmingMode

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values:

void LL_OPAMP_SetCalibrationSelection ( OPAMP_TypeDef * p_opamp , uint32_t transistors_diff_pair )

Set OPAMP offset to calibrate the selected transistors differential pair NMOS or PMOS.

Reference Manual to LL API cross reference (Register Field Functions)

CSR CALSEL LL_OPAMP_SetCalibrationSelection

Note

Preliminarily, OPAMP must be set in mode calibration using function LL_OPAMP_SetMode() .

Parameters :
uint32_t LL_OPAMP_GetCalibrationSelection ( const OPAMP_TypeDef * p_opamp )

Get OPAMP offset to calibrate the selected transistors differential pair NMOS or PMOS.

Reference Manual to LL API cross reference (Register Field Functions)

CSR CALSEL LL_OPAMP_GetCalibrationSelection

Note

Preliminarily, OPAMP must be set in mode calibration using function LL_OPAMP_SetMode() .

Parameters :

p_opamp – OPAMP instance

Return values :

Returned – value can be one of the following values:

uint32_t LL_OPAMP_IsCalibrationOutputSet ( const OPAMP_TypeDef * p_opamp )

Get OPAMP calibration result of toggling output.

Reference Manual to LL API cross reference (Register Field Functions)

CSR CALOUT LL_OPAMP_IsCalibrationOutputSet

Parameters :

p_opamp – OPAMP instance

Return values :
  • 0 – If the offset is not enough compensated with the current trim offset value.

  • 1 – If the offset is enough compensated.

void LL_OPAMP_SetTrimmingValue ( OPAMP_TypeDef * p_opamp , uint32_t power_mode , uint32_t transistors_diff_pair , uint32_t trimming_value )

Set OPAMP trimming factor for the selected transistors differential pair NMOS or PMOS, corresponding to the selected power mode.

Reference Manual to LL API cross reference (Register Field Functions)

OTR TRIMOFFSETN LL_OPAMP_SetTrimmingValue

OTR TRIMOFFSETP LL_OPAMP_SetTrimmingValue

LPOTR TRIMLPOFFSETN LL_OPAMP_SetTrimmingValue

LPOTR TRIMLPOFFSETP LL_OPAMP_SetTrimmingValue

Parameters :
uint32_t LL_OPAMP_GetTrimmingValue ( const OPAMP_TypeDef * p_opamp , uint32_t power_mode , uint32_t transistors_diff_pair )

Get OPAMP trimming factor for the selected transistors differential pair NMOS or PMOS, corresponding to the selected power mode.

Reference Manual to LL API cross reference (Register Field Functions)

OTR TRIMOFFSETN LL_OPAMP_GetTrimmingValue

OTR TRIMOFFSETP LL_OPAMP_GetTrimmingValue

LPOTR TRIMLPOFFSETN LL_OPAMP_GetTrimmingValue

LPOTR TRIMLPOFFSETP LL_OPAMP_GetTrimmingValue

Parameters :
Return values :

0x0...0x1F

void LL_OPAMP_SetOffsetTrimValue ( OPAMP_TypeDef * p_opamp , uint32_t power_mode , uint32_t transistors_diff_pair , uint32_t trimming_value )

Set OPAMP trimming factor for the selected transistors differential pair NMOS or PMOS, corresponding to the selected power mode.

Reference Manual to LL API cross reference (Register Field Functions)

OTR TRIMOFFSETN LL_OPAMP_SetOffsetTrimValue

OTR TRIMOFFSETP LL_OPAMP_SetOffsetTrimValue

LPOTR TRIMLPOFFSETN LL_OPAMP_SetOffsetTrimValue

LPOTR TRIMLPOFFSETP LL_OPAMP_SetOffsetTrimValue

Parameters :
uint32_t LL_OPAMP_GetOffsetTrimValue ( const OPAMP_TypeDef * p_opamp , uint32_t power_mode , uint32_t transistors_diff_pair )

Get OPAMP trimming factor for the selected transistors differential pair NMOS or PMOS, corresponding to the selected power mode.

Reference Manual to LL API cross reference (Register Field Functions)

OTR TRIMOFFSETN LL_OPAMP_GetOffsetTrimValue

OTR TRIMOFFSETP LL_OPAMP_GetOffsetTrimValue

LPOTR TRIMLPOFFSETN LL_OPAMP_GetOffsetTrimValue

LPOTR TRIMLPOFFSETP LL_OPAMP_GetOffsetTrimValue

Parameters :
Return values :

0x0...0x1F

void LL_OPAMP_SetOffsetTrimAllValue ( OPAMP_TypeDef * p_opamp , uint32_t power_mode , uint32_t p_trim_value , uint32_t n_trim_value )

Set OPAMP all differential pair trimming (PMOS and NMOS) values for the selected power mode.

Reference Manual to LL API cross reference (Register Field Functions)

OTR TRIMOFFSETN LL_OPAMP_SetOffsetTrimAllValue

OTR TRIMOFFSETP LL_OPAMP_SetOffsetTrimAllValue

LPOTR TRIMLPOFFSETN LL_OPAMP_SetOffsetTrimAllValue

LPOTR TRIMLPOFFSETP LL_OPAMP_SetOffsetTrimAllValue

Parameters :
uint32_t LL_OPAMP_GetOffsetTrimAllValue ( const OPAMP_TypeDef * p_opamp , uint32_t power_mode )

Get OPAMP PMOS and NMOS differential pair trimming values for the selected power mode.

Reference Manual to LL API cross reference (Register Field Functions)

OTR TRIMOFFSETN LL_OPAMP_GetOffsetTrimAllValue

OTR TRIMOFFSETP LL_OPAMP_GetOffsetTrimAllValue

LPOTR TRIMLPOFFSETN LL_OPAMP_GetOffsetTrimAllValue

LPOTR TRIMLPOFFSETP LL_OPAMP_GetOffsetTrimAllValue

Parameters :
Return values :

0x0...0x1F

Operation on OPAMP instance

group OPAMP_LL_EF_OPERATION

Functions

void LL_OPAMP_Enable ( OPAMP_TypeDef * p_opamp )

Enable OPAMP instance.

Reference Manual to LL API cross reference (Register Field Functions)

CSR OPAMPXEN LL_OPAMP_Enable

Note

After enable from off state, OPAMP requires a delay to fulfill wake up time specification. Refer to device datasheet, parameter “tWAKEUP”.

Parameters :

p_opamp – OPAMP instance

void LL_OPAMP_Disable ( OPAMP_TypeDef * p_opamp )

Disable OPAMP instance.

Reference Manual to LL API cross reference (Register Field Functions)

CSR OPAMPXEN LL_OPAMP_Disable

Parameters :

p_opamp – OPAMP instance

uint32_t LL_OPAMP_IsEnabled ( const OPAMP_TypeDef * p_opamp )

Get OPAMP instance enable state.

Reference Manual to LL API cross reference (Register Field Functions)

CSR OPAMPXEN LL_OPAMP_IsEnabled

Parameters :

p_opamp – OPAMP instance

Return values :
  • 1 – if OPAMP is enabled.

  • 0 – if OPAMP is disabled.