VREF = 3.3 V instead of 2.5 V

Hello,

I am using the P-L496AG-CELL02 board and am creating a program to read the value of ADC1 at pin PC_4. I want the VREF to be 3.3 V and not the internal 2.5 V. I have inserted the necessary solder bridge at R18. However, I get an error when initializing the AnalogIn because of the 3.3 V applied and I cannot adapt the analogin_device.c file.

#if defined(TARGET_DISCO_L496AG)
/* VREF+ is not connected to VDDA by default /
/
Use 2.5V as reference (instead of 3.3V) for internal channels calculation /
__HAL_RCC_SYSCFG_CLK_ENABLE();
HAL_SYSCFG_VREFBUF_VoltageScalingConfig(SYSCFG_VREFBUF_VOLTAGE_SCALE1); /
VREF_OUT2 = 2.5 V /
HAL_SYSCFG_VREFBUF_HighImpedanceConfig(SYSCFG_VREFBUF_HIGH_IMPEDANCE_DISABLE);
if (HAL_SYSCFG_EnableVREFBUF() != HAL_OK) {
error(“HAL_SYSCFG_EnableVREFBUF issue\n”);
}
#endif /
TARGET_DISCO_L496AG */

I would like to change HAL_SYSCFG_VREFBUF_HighImpedanceConfig(SYSCFG_VREFBUF_HIGH_IMPEDANCE_DISABLE) to HAL_SYSCFG_VREFBUF_HighImpedanceConfig(SYSCFG_VREFBUF_HIGH_IMPEDANCE_ENABLE); and HAL_SYSCFG_EnableVREFBUF() to HAL_SYSCFG_DisableVREFBUF().

Can anyone help me with this problem?

Hello,
Your question seems to be hardware dependent and concerns the ST HAL.
We recommend you to get in touch with the ST community.
Thank you.