Skip to main content
MScho.1
Associate III
February 6, 2020
Solved

Setting VREF voltage in CubeMX not working for STM32G4

  • February 6, 2020
  • 6 replies
  • 2009 views

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

This topic has been closed for replies.
Best answer by Khouloud ZEMMELI

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

Best Regards,

Khouloud​

6 replies

Khouloud ZEMMELI
ST Employee
February 6, 2020

​Hello @MScho.1​ 

Thanks for the feedback , i'll check it,

Best Regards,

Khouloud

Khouloud ZEMMELI
Khouloud ZEMMELIBest answer
ST Employee
February 6, 2020

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

Best Regards,

Khouloud​

MScho.1
MScho.1Author
Associate III
February 6, 2020

Thanks for the quick reponse and checking!

Khouloud ZEMMELI
ST Employee
February 17, 2020

​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

MScho.1
MScho.1Author
Associate III
February 17, 2020

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.