Setting VREF voltage in CubeMX not working correctly for STM32H7
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.8VThis 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
