Enable and use VREFBUF for ADC measures
Hi,
I am following the instructions in STM32 reference manual to configure VREFBUF to use in my ADC measures. In chapter 17, it explains that it is needed to set ENVR to enable VREFBUF, then reset HIZ and set VRS (in my case for VREFBUF = 2.5V), then it is needed to wait until voltage reference output has reached its expected value. In my case, the code is stopped checking it, returning TIMEOUT_ERROR.
We tried to do it with ST functions and thru ST registers, both options failed in the same point:
Option 1:
VREFBUF->CSR |= VREFBUF_CSR_ENVR;
VREFBUF->CSR &= ~VREFBUF_CSR_HIZ;
VREFBUF->CSR |= VREFBUF_CSR_VRS;
while( !( VREFBUF->CSR & VREFBUF_CSR_VRR ) );
Option 2:
HAL_SYSCFG_VREFBUF_VoltageScalingConfig(SYSCFG_VREFBUF_VOLTAGE_SCALE1);
HAL_SYSCFG_EnableVREFBUF();
HAL_SYSCFG_VREFBUF_HighImpedanceConfig(SYSCFG_VREFBUF_HIGH_IMPEDANCE_DISABLE);
In option 2, code is stopped inside HAL_SYSCFG_EnableVREFBUF() function, returning this TIMEOUT error:
while(READ_BIT(VREFBUF->CSR, VREFBUF_CSR_VRR) == 0U)
{
if((HAL_GetTick() - tickstart) > VREFBUF_TIMEOUT_VALUE)
{
return HAL_TIMEOUT;
}
}
Please, could you help me to configure it and make it work for my ADC measures?
Is there aything else I am nor including?
Thanks in advance