2023-01-04 01:02 AM
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
2023-01-04 08:29 AM
Hello @Osto,
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.
2023-02-04 07:26 AM
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
2023-06-11 06:09 PM
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
2023-08-08 05:28 AM
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?