2023-07-06 05:52 AM
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.
Solved! Go to Solution.
2023-07-07 06:09 AM
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
2023-07-06 06:30 AM - edited 2023-07-06 07:14 AM
The STM32G070 doesn't have a VREFBUF. Neither the datasheet nor the reference manual have any reference to "VREFBUF".
2023-07-06 06:52 AM - edited 2023-07-06 06:53 AM
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
2023-07-07 05:37 AM
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?
2023-07-07 05:44 AM - edited 2023-07-07 05:57 AM
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.
2023-07-07 06:09 AM
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
2023-07-08 03:49 AM
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?
2023-07-08 11:48 AM - edited 2023-07-08 11:49 AM
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