Showing results for 
Search instead for 
Did you mean: 

How to configure VREFBUF on my STM32

Stefanie LAU
ST Employee
How can I configure the internal voltage reference on my STM32 microcontroller using STM32CubeMX? The voltage reference buffer embedded in most STM32 devices serve two main purposes: 
1. used as a voltage reference for ADCs, and DACs 
2. used as a voltage reference for external components through the VREF+ pin 
Note that as each product family is unique, it is highly recommended that you check your device's reference manual to verify the inclusion of this voltage reference buffer and the different voltage levels supported. 
Most STM32 has a configurable internal voltage reference buffer that supports the following four voltages:
  • Around 2.5V
  • Around 2.048V
  • Around 1.8V
  • Around 1.5V
The internal voltage reference can be configured in four different modes as shown below in the table found in the STM32H723’s reference manual:  
As an example, we will focus on configuring the VREFBUF buffer in the Nucleo-H723ZG in internal voltage reference mode using STM32CubeMX.
By default, the STM32’s VREFBUF buffer is off, and the VREF+ input supply used for the STM32’s ADCs and DACs are supplied by VDDA. We will modify the Nucleo-H723ZG’s VREF+ input source to connect to the VREFBUF buffer output (configured as 2.5V via STM32CubeMX) instead of the default VDDA (3.3V).
Step 1. On your STM32 board’s schematic, locate the connection between VREFP and VDDA. You will want to make sure that this connection between VREFP and VDDA is removed, as this could cause a short and damage to the microcontroller when configuring the internal voltage reference mode.
Each STM32’s respective board schematic can be found on the board’s landing page under the CAD resources tab.
In our case, checking the Nucleo-H723ZG’s schematic, there’s a 0-ohm resistor connection between VDDA and VREFP that must be removed.
Step 2. Using STM32CubeMX start a new project with your selected STM32.
Step 3. The VREFBUF configuration is found under the ‘analog’ drop down category. By default, the VREFBUF mode is disabled.

Step 4. From the dropdown menu, select the ‘internal voltage reference’ option.
Step 5. Under the ‘parameter settings’ tab below, select the scale that you want for the VREFBUF value. In our example case, we will select SCALE0: around 2.5V. 
Step 6. Under the ‘project manager’ tab, give your project a name, save the project and generate the code in STM32CubeMX. Then flash the newly STM32CubeMX’s generated code to your STM32 board.

Step 7. To verify the new VREF+ value configured, locate the VREF+ pin on your STM32 board and use a multimeter to probe and read the newly configured VREF+ pin value.
Relevant Links and Documentation:
Version history
Last update:
‎2021-12-21 02:24 AM
Updated by: