cancel
Showing results for 
Search instead for 
Did you mean: 

VREFBUF Configuration NOT Available in Cube MX for STM32G070RB

RPate.11
Associate III

I am trying to work ADC Module. I was hoping to use Internal Reference Voltage of 2.5V for ADC Reference Valve. 

STM32G070RB does have VREF+ Pin on Pin Number 7. But there is no way to Configure VREFBUF to scale voltage around 2.5V. Cube MX Does not have any option to do so, nor that can be does via code. 

In generated code VREFBUF flag is not defines and so its functions, like 

 

#if defined(VREFBUF) --- NOT Defined

HAL_StatusTypeDef HAL_SYSCFG_EnableVREFBUF(void) --- Can not be Used

 

are disabled and con not be used. 

STM32G070RB is on my custom board with LQFP64 Package. It does support VREFBUF as per datasheet but can not find any way to do so in Cube MX or in IDE. 

Please suggest how can I achieve this.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @RPate.11 

I misread your question.

STM32G070RB don't have VREFBUFF , you can't configurate it.

You can used STM32G071RB that have VREFBUF.

Regards

Diane

 

View solution in original post

7 REPLIES 7
TDK
Guru

The STM32G070 doesn't have a VREFBUF. Neither the datasheet nor the reference manual have any reference to "VREFBUF".

If you feel a post has answered your question, please click "Accept as Solution".
Diane POMABIA
ST Employee

Hello @RPate.11 

You have to add defined  VREFBUF in your define symbol (if your are using IAR as IDE) or add "#define VREFBUF" in main.h to be able to :

(+) Configure the Voltage reference buffer
(+) Enable/Disable the Voltage reference buffer

All Hal SYSCFG Config funtions is in stm32g0xx_hal.c file.

Let me know if you are other question.

Regards

Diane 

That seems promising. 

I have tried to do it as you said. But still I am not getting reference for 

HAL_SYSCFG_EnableVREFBUF(); --- Undefines reference Error

in main.c. Those functions are in stm32G0xx_hal.c and its related definitions are in respective header file. These files are not allowed to be edited by user. stm32G0xx_hal.c takes header reference from stm32G0xx_hal.h only. If I put define statements before stm32G0xx_hal.h in main.h, definitions are enabled in g0xx_hal.h file but not in g0xx_hal.c.

I have to put it in start of stm32G0xx_hal.h to get its full effect.

What is you opinion on this? How to proceed?  

RPate.11
Associate III

I am using CubeIDE.

I have added a Symbol in build Options and it does enabled all functions in all files. There is a second level problem comes after defined. Register definitions to set and clear bit such as VREFBUF->CSR and VREFBUF_CSR_VRR are not to be find. It throws undefined error. 

READ_BIT(VREFBUF->CSR, VREFBUF_CSR_VRR)    --- Undefines Error
CLEAR_BIT(VREFBUF->CSR, VREFBUF_CSR_ENVR)    --- Undefines Error

Please look into it. Thanks. 

Hi @RPate.11 

I misread your question.

STM32G070RB don't have VREFBUFF , you can't configurate it.

You can used STM32G071RB that have VREFBUF.

Regards

Diane

 

I think it don't have. Yes Thanks. 

One More thing - VREF+ pin can be used as TOP Voltage reference for ADC. Right? I can place an external 2.5 V voltage reference in VREF+ pin and My ADC could read from 0V to 2.5V. Correct? 

Correct. In devices with VREF+ that is led out, one can use the voltage applied to it as upper limit for the measurements of the ADC.

Regards, /Peter

In order 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.