Skip to main content
Visitor II
January 7, 2025
Solved

Bad voltage on VREF+ pin (VDD instead of VREFBUF)

  • January 7, 2025
  • 7 replies
  • 2644 views

I'm using an STM32H743VIT6 (rev V in LQFP100 package), powered at 3.3V and programmed with STM32CubeIDE.

I'm using the ADC2 and ADC3, and also want to use the VREFBUF voltage (available on VREF+ pin) programmed for 2.5V.

 

The *.ioc file is generated with:

VREFBUF Mode -> internal voltage reference

Internal Voltage reference scale -> SCALE 0: around 2.5V

Unfortunately I measure 3.3V on pin 20 (VREF+) instead of 2.5V!

In the generated file stm32h7xx_hal_msp.c,  in the HAL_MspInit(void) function I see:

 /** Enable the VREF clock */

  __HAL_RCC_VREF_CLK_ENABLE();

 

  /** Configure the internal voltage reference buffer voltage scale */

  HAL_SYSCFG_VREFBUF_VoltageScalingConfig(SYSCFG_VREFBUF_VOLTAGE_SCALE0);

 

  /** Enable the Internal Voltage Reference buffer*/

  HAL_SYSCFG_EnableVREFBUF();

 

  /** Configure the internal voltage reference buffer high impedance mode*/

  HAL_SYSCFG_VREFBUF_HighImpedanceConfig(SYSCFG_VREFBUF_HIGH_IMPEDANCE_DISABLE);

 

In my main() function I've added the reading of the VREFBUF_CSR register to check what's going on:

uint32_t status = VREFBUF->CSR;

 

I get status = 9:

 

Bit 0 ENVR = 1 -> Internal voltage reference mode (reference buffer enable or hold mode) enable.

Bit 1 HIZ = 0 -> VREF+ pin is internally connected to the voltage reference buffer output.

Bit 2 NA

Bit 3 VRR = 1 -> the voltage reference buffer output reached the requested level.

Bit 6:4 VRS[2:0] = 000 -> Voltage reference set to 2.5 V

 

Everything seems OK!

 

If I change VREFBUF Mode to -> Disable, the voltage at pin 20 becomes 0V.

What is wrong?

    This topic has been closed for replies.
    Best answer by FRAUBRY

    Continuing my investigations, I ran the program in Debug mode.

    Before the function MX_GPIO_Init() I have 2.5V in VREF+, but 3.3V after!

    In the function, it's after the HAL_GPIO_Init(GPIOE, &GPIO_InitStruct) function that the value changes!

    On Port E I have 7 outputs used in GPIO_Output mode.

    Putting the outputs one after the other into Reset_State mode, I discovered that one of the pins on Port E was causing the problem.

    This pin controlled two circuits of type 74LVC2G66. I changed the two circuits and everything is now OK!

    I don't quite see what that has to do with it, but the main thing is to have found the solution.
    Thanks for all your help.

    JJA

    7 replies

    Super User
    January 7, 2025

    Missing capacitor (of a quite particular value)?

    JW

    FRAUBRYAuthor
    Visitor II
    January 7, 2025

    Thank you for your reply, but I have 1uF // 100nF connected to pin VREF+.

    JJA

    Super User
    January 7, 2025

    Is there anything else connected to VREF+ pin?

    How are VDDA/VSSA connected?

    Can you try this on some "known good" board like Nucleo?

    JW

    FRAUBRYAuthor
    Visitor II
    January 7, 2025

    On VREF+ pin I have a voltage divider (10k + 10k) to ground and a voltage follower to have 1.25V

    Attached is part of my MCU schematic.

    I've been working on my project for several years (!!!) with several iterations of the PCB, and as far as I remember it worked well (perhaps with an STM32H753 instead of the STM32H743 that was nowhere to be found at the time of the COVID-19 shortage).
    I have an old NUCLEO-H743ZI2 (144 pins).
    I'll see if I can get it working again.

    JJA

    Super User
    January 7, 2025

    Try to disconnect the voltage divider.

    JW

    FRAUBRYAuthor
    Visitor II
    January 7, 2025

    Voltage divider disconnected, always 3.3V on VREF+ pin!

    JJA

    Super User
    January 7, 2025

    Can you try the same example as on the Nucleo also on your board?

    JW

    FRAUBRYAuthorAnswer
    Visitor II
    January 8, 2025

    Continuing my investigations, I ran the program in Debug mode.

    Before the function MX_GPIO_Init() I have 2.5V in VREF+, but 3.3V after!

    In the function, it's after the HAL_GPIO_Init(GPIOE, &GPIO_InitStruct) function that the value changes!

    On Port E I have 7 outputs used in GPIO_Output mode.

    Putting the outputs one after the other into Reset_State mode, I discovered that one of the pins on Port E was causing the problem.

    This pin controlled two circuits of type 74LVC2G66. I changed the two circuits and everything is now OK!

    I don't quite see what that has to do with it, but the main thing is to have found the solution.
    Thanks for all your help.

    JJA

    FRAUBRYAuthor
    Visitor II
    January 8, 2025

    I don't think this is possible without modifying the initialisation code because I'm using the internal oscillator (HSI RC at 64MHz) and not a 32.768kHz Xtal (X2 on the NUCLEO board)!
    Without the use of an *.ioc file I won't get started!

    JJA

    Graduate II
    September 23, 2025

    I had the same problem.
    It appears negative voltage on any input (digital or analog) below -0.2V switches off Vrefbuf.

    It is shame this degraded condition of Vrefbuf cannot be seen from software.

    It is also very dangerous Vrefbuf will gradually climb up from your reference voltage to Vcc.

    It is not an on/off condition.

     

    Super User
    September 23, 2025

    @trzeci,

    I don't think @FRAUBRY has ever mentioned negative voltages.

    Can you please elaborate, what is exactly your hardware, and how did you observe the problem?

    Thanks,

    JW

    Graduate II
    September 23, 2025

    ST32H743 with 5 ADC channels active.

    Small negative voltage on one of single-ended channels caused switch off of Vrefbuf.

    The Vrefbuf migrated slowly from 2.5V to Vcc (3.3V) while the negative voltage dropped below -0.2V

    I understand it might be correct safety mechanism, but there is no feedback.
    Every bit in Vrefbuf config were correct. The only symptom of malfunction was a drop in the measured value and increasing noise.

    Graduate II
    September 23, 2025

    That's why it's safer to always use only single-supply buffers with the same voltage supply as the ADC for ADC inputs.

    No matter if external ADC IC or an MCU's ADC.