cancel
Showing results for 
Search instead for 
Did you mean: 

VREFBUF configuring based on GPIO state with CubeMx

DNYAR.1
Associate II

I am using a G474RE nucleo board and i have 2 separate interface boards which i ca connect to it.

One board requires a VREFBUS of 2.5V and the other  2.90 .

Currently i modify the .IOC file and select the appropriate VREFBUS, compile the code. So currently i have 2 separate .elf files, one for each scenario.

I will want a single code version so that on start up based on the status of a switch connected to a GPIO,

it will configure the correct VREFBUF value.

The attachment shows my setup for the 2.90V internal voltage reference.

Thanks

Davidg474re_vrefbuf_2900mv.jpg

 

1 ACCEPTED SOLUTION

Accepted Solutions

@DNYAR.1 wrote:

I do not see where the appropriate cubeMX code is created. It is not in my main.c file (like the other peripheral initializations).

Is there another file i need to look into for that?

Thanks


A thread related to the same subject you've already created in 2023 Example code to configure internal Vrefbuf on STM32G474RE (Nucleo -G474RE) ;)

screenshot.png

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

View solution in original post

5 REPLIES 5
mƎALLEm
ST Employee

Hello,

That's not possible to set two configurations for two different voltage reference in CubeMx.

You need to do that in the user code i.e. configure the VREFBUF in the user code section based on the GPIO state.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
DNYAR.1
Associate II

Sorry i did not come across clearly. What i want is user code to set that up using a GPIO pin to select between the

2 possible internal buffer voltages.

 

In the user code:

if (GPIO_pin_status == SET)
{
configure VREF_Buff to 2.5
}
else
{
configure VREF_Buff to 2.9
}
        

Generate the code with cubeMx for both configurations and paste the VREFBUF config related code in the respective condition.

And here is a thread related to the same subject you've already created in 2023 Example code to configure internal Vrefbuf on STM32G474RE (Nucleo -G474RE)

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

I do not see where the appropriate cubeMX code is created. It is not in my main.c file (like the other peripheral initializations).

Is there another file i need to look into for that?

Thanks


@DNYAR.1 wrote:

I do not see where the appropriate cubeMX code is created. It is not in my main.c file (like the other peripheral initializations).

Is there another file i need to look into for that?

Thanks


A thread related to the same subject you've already created in 2023 Example code to configure internal Vrefbuf on STM32G474RE (Nucleo -G474RE) ;)

screenshot.png

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.