cancel
Showing results for 
Search instead for 
Did you mean: 

using internal Vrefbuf : HAL Code generation issue

THAUS.1
Associate

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)

{

 __HAL_RCC_SYSCFG_CLK_ENABLE();

 __HAL_RCC_PWR_CLK_ENABLE();

 /* 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 

 */

 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);

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

 */

 LL_SYSCFG_DisableDBATT(LL_SYSCFG_UCPD1_STROBE | LL_SYSCFG_UCPD2_STROBE);

}

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.

1 REPLY 1
LVers.1
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 ?