Example code is generated by STM32CubeMX, if you set the VREFBUF Mode in the peripheral module SYS to Internal voltage reference and then set the Internal Voltage reference scale in Parameter Settings to SCALE 1: around 2.5V. The STM32G474 will then be generated correctly in stm32g4xx_hal_msp.c, function HAL_MspInit():
__HAL_RCC_SYSCFG_CLK_ENABLE(); // necessary so that SYSCFG can be configured and switched on
[...]
/* System interrupt init */
/** Configure the internal voltage reference buffer voltage scale */
// for SYSCFG_VREFBUF_VOLTAGE_SCALE1 see RM0440, section 23.4.1, bits VRS
HAL_SYSCFG_VREFBUF_VoltageScalingConfig(SYSCFG_VREFBUF_VOLTAGE_SCALE1);
/** 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);
Hope that helps?
Regards
/Peter