HAL VREFBUF How to Use ¶
- group VREFBUF_How_To_Use
-
VREFBUF : module in STM32 microcontrollers that provides a reference voltage to both the internal analog peripherals and external pins used in applications.
Main features ¶
VREFBUF is a programmable gain operational amplifier that is composed of:
-
Input VREFBUF : VREFINT (internal reference voltage in STM32 created from a diode-based circuit).
-
Output VREFBUF : Voltage reference buffer which can be used as voltage reference for internal peripherals (ADCs, DACs) and for external components.
-
Power supply: VDDA (pin connected to an external power source) and VSSA (pin connected to ground).
How to use the HAL VREFBUF ¶
Before enabling VREFBUF, several key settings must be configured.
-
HAL_RCC_VREFBUF_EnableClock(): The user must first enable the RCC Clock to access VREFBUF registers.
-
HAL_VREFBUF_SetConfig() : The user must configure the VREFBUF by setting the voltage scale and functional mode of the VREFBUF.
If the user wants to change the VREFBUF’s parameters during application runtime, two distinct functions are available for this purpose :
-
HAL_VREFBUF_SetVoltageScale() to modify the voltage scale of VREFBUF.
-
HAL_VREFBUF_SetMode() to modify the functional mode of VREFBUF.
VREFBUF can be configured in various modes based on the configuration of each of the voltage reference buffer mode and the high impedance mode.
-
HAL_VREFBUF_SetTrimming() : It provides the user with the option to modify the trimming value of VREFBUF (for more detailed information, refer to the function description).
-