cancel
Showing results for 
Search instead for 
Did you mean: 

Setting VREF voltage in CubeMX not working correctly for STM32H7

Simon Sq
Associate III

CubeMX Version : 6.0.1.202008101643 com.st.stm32cube.common.feature.mx

Device: STM32H743

I believe there may be an issue when setting the VREFBUF output voltage in CubeMX. The definitions for VREFOUT in CubeMX are inconsistent with the definitions given in the stm32H7xx_hal.c file.

CubeMX uses the following in the dropdown:

Scale 0 - 2.5V

Scale 1 - 2.048V

Scale 2 - 1.8V

Scale 3 - 1.5V

However the function description for

HAL_SYSCFG_VREFBUF_VoltageScalingConfig()

in the stm32h7xx_hal.c indicates the following:

SYSCFG_VREFBUF_VOLTAGE_SCALE0 = 2.048V
SYSCFG_VREFBUF_VOLTAGE_SCALE1 = 2.5V
SYSCFG_VREFBUF_VOLTAGE_SCALE2 = 1.5V
SYSCFG_VREFBUF_VOLTAGE_SCALE3 = 1.8V

This issue leads to the incorrect voltage being present on VREF+ pin once the code is generated. I believe this is a similar issue to that reported on other STM32 devices. Setting of scale 0 in CubeMX results in scale 0 being used in the generated code, but the voltage is incorrect.

I don't know which set of scales is ultimately correct, but the scales listed in the stm327hxx_hal.c file do set the value of the CSR register correctly inline with method description.

My hunch is that the descriptions in the CubeMX dropdown are incorrect?

Kind Regards,

Simon

3 REPLIES 3

Hello @Simon Sq​ 

Thanks for the feedback, the problem is in the description in the stm32h7xx_hal.c file not in STM32CubeMX:

/**

 * @brief Configure the internal voltage reference buffer voltage scale.

 * @param VoltageScaling specifies the output voltage to achieve

 *     This parameter can be one of the following values:

 *      @arg SYSCFG_VREFBUF_VOLTAGE_SCALE0: VREF_OUT1 around 2.048 V.

 *                        This requires VDDA equal to or higher than 2.4 V.

 *      @arg SYSCFG_VREFBUF_VOLTAGE_SCALE1: VREF_OUT2 around 2.5 V.

 *                        This requires VDDA equal to or higher than 2.8 V.

 *      @arg SYSCFG_VREFBUF_VOLTAGE_SCALE2: VREF_OUT3 around 1.5 V.

 *                        This requires VDDA equal to or higher than 1.8 V.

 *      @arg SYSCFG_VREFBUF_VOLTAGE_SCALE3: VREF_OUT4 around 1.8 V.

 *                        This requires VDDA equal to or higher than 2.1 V.

 * @retval None

 */

So, issue reported to the tool development team that will plan the correction.

Best regards,

Nesrine

0693W000003Qu3FQAS.png

Simon Sq
Associate III

Thank you Nesrine.

I can work around it for now until the fix is realised at some point in the future.