cancel
Showing results for 
Search instead for 
Did you mean: 

2 bugs with VREFBUF and STM32Cube on at least STM32G491

Osto
Senior

Hi ST,

There are 2 bugs in Initialization of VREFBUF.in STM32CubeIDE V1.11.0.

I use FreeRTOS, but it shouldn't have any inffluence on these bugs.

1.) At function main, the firsr call is to Hal Init and when VREFBuF ist activated, in function HAL_MspInit, Enabling the SYSCFG Clock sets the HiZ bit of CSR. the call to HAL_SYSCFG_EnableVREFBUF sets the ENVR bit in CSR and waits for VRR set which indicates the Reached the desired voltage. This will never happen. Only when I clear the HiZ bit manually, the VREFBUF wil reach the voltage (measured on VREF+ Pin), the VRR wil be set and it can continue.

2.) in function HAL_SYSCFG_EnableVREFBUF, it waits for Tick Count to reach VREFBUF_TIMEOUT_VALUE (wait max 10ms) but no count of HAL Tick will happen. The Tick is initialised before, but it seems that something ist not configured correct or too late. There is no Tick increment at all.

The combination of above bugs ends in Dead System. Nothing else will habben after the call of HAL_SYSCFG_EnableVREFBUF. Because at that time also the watchdog is not enabled, the system hangs forever. This shall not happen in an Embedded system.

Best regards,

Osto

4 REPLIES 4
FBL
ST Employee

Hello @Osto​,

  1. Could you please precise full product package? Is it STM32G491 UK ? Because I can see for example in UFQFPN32 package, the voltage reference buffer is not available and must be kept disabled. As referenced in RM0440 section 23.1 Introduction : When the VREF+ pin is double-bonded with VDDA pin in a package, the voltage reference buffer is not available and must be kept disabled (refer to datasheet for packages pinout description).0693W00000Y7PfsQAF.png
  2. If not this package, could you precise how do you implement the VREFBUF in the application where do you call the HAL_SYSCFG_EnableVREFBUF(); ? a screenshot of VRR enabled? Tick count is not incrementing?

Actually, I am testing on Nucleo G474RE, and I'm not getting the same result as you do !

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Osto
Senior

Hi,

sorry for late answer.

Its with STM32G491RET6. So, there is a VREF Pin on package.

please send me an email to email address behind my account from your ST email address, then I will send you the schematics, IOC file and the work around.

Best regards,

Osto

bobert
Associate III

Hi,

I'm having these exact same issues with a G473VET with a fresh CubeMX generated project firmware FW_G4V1.5.1.

Enabling low impedance mode before enabling the VREFBUF allows it to come up.

Getting systick to work, everything to work really, required uncommenting:

#define USER_VECT_TAB_ADDRESS

Thanks,

Rob

Hi @bobert 

Thanks to your comment i make it work my code. I took the low impedance mode before enabling the vrefbuf in there and it worked.

void HAL_MspInit(void)
{
  /* USER CODE BEGIN MspInit 0 */
  __HAL_RCC_SYSCFG_CLK_ENABLE();
  __HAL_RCC_PWR_CLK_ENABLE();
  HAL_SYSCFG_VREFBUF_HighImpedanceConfig(SYSCFG_VREFBUF_HIGH_IMPEDANCE_DISABLE);
  /* USER CODE END MspInit 0 */

  __HAL_RCC_SYSCFG_CLK_ENABLE();
  __HAL_RCC_PWR_CLK_ENABLE();

  /* System interrupt init*/
  /* PendSV_IRQn interrupt configuration */
  HAL_NVIC_SetPriority(PendSV_IRQn, 15, 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);

  /* USER CODE BEGIN MspInit 1 */

  /* USER CODE END MspInit 1 */
}

  But this feels like kinda wrong cause i can't exacly change the order just duplicate it. Do you know better way to do it? Or is there any hardware way to pull the vref+ pin to low impedance?