Showing results for 
Search instead for 
Did you mean: 

using internal Vrefbuf : HAL Code generation issue


I try to VREFPIN in internal mode (so VREFPIN is an output).

Based on IDE STM32CUBEIDE 1.3.0 and using a STM32G071 MCU.

The generated code is :

void HAL_MspInit(void)




 /* System interrupt init*/

 /* SVC_IRQn interrupt configuration */

 HAL_NVIC_SetPriority(SVC_IRQn, 3, 0);

 /* PendSV_IRQn interrupt configuration */

 HAL_NVIC_SetPriority(PendSV_IRQn, 2, 0);

 /** Configure the internal voltage reference buffer voltage scale 



 /** Enable the Internal Voltage Reference buffer 



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



 /** Disable the internal Pull-Up in Dead Battery pins of UCPD peripheral 




I guess there is an issue in HAL code generation because :

  • default value of bit HIZ is '1' (i.e. : HIZ enabled)
  • Function HAL_SYSCFG_EnableVREFBUF pool bit VRR until timeout which
  • VRR bit is never setted to '1' because Vref never reach requested level, because HIZ mode is setted after polling VRR bit. It should be done before enabling ENVR and pooling bit.

NB: it's hard to catch this issue because in debug mode using CUBEIDE, Vrefpin have x100 times to reach requested level.

Associate III

facing the same issue on a STM32WB55; using the genuine HAL code, it sometimes hang in HAL_SYSCFG_EnableVREFBUF()

By adding a call to HAL_SYSCFG_VREFBUF_HighImpedanceConfig(SYSCFG_VREFBUF_HIGH_IMPEDANCE_DISABLE) before, it works

Can maybe ST confirm this is a bug in HAL ?