cancel
Showing results for 
Search instead for 
Did you mean: 

Setting VREF voltage in CubeMX not working for STM32G4

MScho.1
Associate III

I'd like to report 2 bugs/errors in CubeMx and the documentation in the stm32g4xx LL driver file:

Setting the "Internal Voltage reference scale" in the "SYS" menu of CubeMX to SCALE2 (2.9V), won't take effect and the selected value always falls back to SCALE0. I'm working with an STM32G474 device.

Also the values of the scales in CubeMX are wrong, where it's written:

SCALE0: 2.5V

SCALE1: 2.048V

SCALE2: 2.9V

Whereas the correct asignments are:

SCALE0: 2.048V

SCALE1: 2.5V

SCALE2: 2.9V

Furthermore the documentation in the LL driver in "stm32g4xx_ll_system.h" has the documentation wrong for LL_VREFBUF_VOLTAGE_SCALE2, where a voltage is 2.8V is documented instead of the correct value 2.9V

1 ACCEPTED SOLUTION

Accepted Solutions
Khouloud ZEMMELI
ST Employee

You're right @MScho.1​  issue will be fixed in the CubeMX release,

Best Regards,

Khouloud​

View solution in original post

6 REPLIES 6
Khouloud ZEMMELI
ST Employee

​Hello @MScho.1​ 

Thanks for the feedback , i'll check it,

Best Regards,

Khouloud

Khouloud ZEMMELI
ST Employee

You're right @MScho.1​  issue will be fixed in the CubeMX release,

Best Regards,

Khouloud​

MScho.1
Associate III

Thanks for the quick reponse and checking!

​Hi @MScho.1​ , after check, the issue is only in the "stm32g4xx_ll_system.h" and not in CubeMX ,

According the Ref Man of STM32G4, the bit VRS has these values:

Bits 3:2 VRS[1:0]: Voltage reference scale

These bits select the value generated by the voltage reference buffer.

000: Voltage reference set to 2.5 V

001: Voltage reference set to 2.048 V

010: Voltage reference set to 2.90 V

Best Regards,

Khouloud

I'm sorry to disagree. When "SCALE0 around 2.5V" is selected in CubeMX, the output voltage after code generation on VREF is 2.048V.

There is some changes in the reference, and this value has been changed, the right one will be in the 6.0.0 MX version.

You are right and thanks for bringing this confusion to our attention.

Best Regards,

Khouloud