Nucleo STM32H7: Setting VRefBuf

All about boards manufactured by ST
Post Reply
erognal
Posts: 2
Joined: Wed Apr 27, 2022 9:44 am

Nucleo STM32H7: Setting VRefBuf

Post by erognal »

Dear stm32duino community,

maybe you can help me out with this question.

1) How to set internal VREF with stm32duino? analogReference() is not implemented.

Thank you very much,
erognal
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: Nucleo STM32H7: Setting VRefBuf

Post by fpiSTM »

Hi, right it is not implemented. Maybe you could use LL or HAL driver to set it directly.
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: Nucleo STM32H7: Setting VRefBuf

Post by ag123 »

in stm32 VREFINT is a fixed voltage measured off a constant voltage source.
if that is what you want to read, you may be able to read that using analogRead().
https://github.com/stm32duino/wiki/wiki ... l-channels

stm32 ADCs don't have a feature that set a vref as like a comparator. Check the datasheets for your chip
and the range would normally be from 0-vdd (3v3) based on how the chip is wired or wired internally.
GonzoG
Posts: 403
Joined: Wed Jan 15, 2020 11:30 am
Answers: 27
Location: Prudnik, Poland

Re: Nucleo STM32H7: Setting VRefBuf

Post by GonzoG »

erognal wrote: Wed Apr 27, 2022 4:23 pm Dear stm32duino community,

maybe you can help me out with this question.

1) How to set internal VREF with stm32duino? analogReference() is not implemented.

Thank you very much,
erognal
I think that STM32 MCUs don't have internal ADC reference, they use external (or on MCUs without Vref pins, it's connected to power supply pins).
VREFBUF can be used only for DAC.
User avatar
MasterT
Posts: 33
Joined: Mon Apr 20, 2020 12:02 am

Re: Nucleo STM32H7: Setting VRefBuf

Post by MasterT »

Something like:

Code: Select all

  
    __HAL_RCC_VREF_CLK_ENABLE();
    HAL_SYSCFG_VREFBUF_HighImpedanceConfig(SYSCFG_VREFBUF_HIGH_IMPEDANCE_DISABLE);
    HAL_SYSCFG_EnableVREFBUF();
More options in stm32h7xx_hal.h

Code: Select all

#define SYSCFG_VREFBUF_HIGH_IMPEDANCE_DISABLE  ((uint32_t)0x00000000) /*!< VREF_plus pin is internally connected to Voltage reference buffer output */
#define SYSCFG_VREFBUF_HIGH_IMPEDANCE_ENABLE   VREFBUF_CSR_HIZ        /*!< VREF_plus pin is high impedance */

#define IS_SYSCFG_VREFBUF_HIGH_IMPEDANCE(__VALUE__)  (((__VALUE__) == SYSCFG_VREFBUF_HIGH_IMPEDANCE_DISABLE) || \
                                                      ((__VALUE__) == SYSCFG_VREFBUF_HIGH_IMPEDANCE_ENABLE))

#define IS_SYSCFG_VREFBUF_TRIMMING(__VALUE__)  (((__VALUE__) > 0UL) && ((__VALUE__) <= VREFBUF_CCR_TRIM))
Post Reply

Return to “STM boards (Discovery, Eval, Nucleo, ...)”