HAL OPAMP Overview

Introducing OPAMP

group OPAMP_Introduction

  • The OPAMP (Operational Amplifier) hardware abstraction layer provides a set of APIs to interface with the STM32 operational amplifier peripheral.

  • It simplifies the initialization, configuration and process of peripheral features

  • This abstraction layer ensures portability and ease of use across different STM32 series.

The HAL OPAMP driver includes the following features:

  • Support for multiple OPAMP modes: stand-alone, follower, inverting and non-inverting PGA

  • Programmable gain settings with internal or external filtering/bias

  • Timer-controlled operation for dynamic reconfiguration

Module and files

The following diagram illustrates the OPAMP module and its associated files.

Module and files diagram

Component diagram

The following diagram illustrates the software components involved in the OPAMP module. It shows the interactions between the user application, HAL drivers, low-level drivers, and the hardware components.

@startuml
<style>
componentDiagram {
   arrow {
      FontSize 8
   }
}
</style>

title OPAMP Software Component Diagram

package "HAL" {
    [HAL_SERVICE]
    [HAL_OPAMP]
}

package "Low Layer" {
    [LL_OPAMP]
    [CMSIS]

}

package "HW" {
    [STM32_HW]
}

[Appli] --> [HAL_OPAMP] : HAL OPAMP API
[HAL_OPAMP] --> [LL_OPAMP] : LL OPAMP API
[HAL_OPAMP] -l-> [HAL_SERVICE] : HAL_GetTick
[LL_OPAMP] --> [CMSIS]:OPAMP register def
[STM32_HW] <-u-- [LL_OPAMP] : OPAMP registers R/W
@enduml

Configuration table

The following table lists the configuration defines for the HAL OPAMP module, specifying their locations, default values, and descriptions:

group OPAMP_Configuration_Table

Configuration inside the OPAMP driver

Config defines

Description

Default value

Note

USE_HAL_OPAMP_MODULE

from hal_conf.h

1

When set, HAL OPAMP module is enabled

USE_HAL_OPAMP_CALIBRATE_PARALLEL

from hal_conf.h

0

Enable the parallel calibration

USE_HAL_OPAMP_USER_DATA

from hal_conf.h

0

Enable the user data

USE_HAL_OPAMP_CLK_ENABLE_MODEL

from hal_conf.h

HAL_CLK_ENABLE_NO

Periph. clock gating in HAL_OPAMP_Init()

USE_HAL_CHECK_PARAM

from hal_conf.h

0

Parameters (pointers or sizes) are checked in runtime

USE_HAL_CHECK_PROCESS_STATE

from hal_conf.h

0

When set, enable atomic access to process state check

USE_ASSERT_DBG_PARAM

from PreProcessor env

None

When defined, enable the params assert

USE_ASSERT_DBG_STATE

from PreProcessor env

None

When defined, enable the state assert