cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G070 ADC Accuracy Issues

YChen.9
Associate II

Hi,

I am using an STM32G070CB. while using the ADC, I found that the accuracy of the data I get is very poor, the data returned is always returned as 0xXXFF, but the data for VREF and GND is correct. I think I must have something wrong with the settings somewhere, but I have changed the modes a lot and I still get data with terrible accuracy.

Please help to see where the settings are wrong.

Thanks.

Here is my setting:

ADC.png

clock.png

DMA.png

main.png

3 REPLIES 3
Amel NASRI
ST Employee

Hi @YChen.9 ,

Several tips to optimize ADC accuracy for STM32 products are provided in the application note AN2834How to optimize the ADC accuracy in the STM32 MCUs.

In case you don't find a way, retry following the step by step article Getting started with ADC - stm32mcu. Check if it works properly with a configuration similar to the one used in this article.

Last point to consider: if you are using a Rev.A device, you may be facing the limitation "ADC offset may be out of specification"  described with more details in the product errata sheet.

-Amel

 

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.

> the data returned is always returned as 0xXXFF

Show.

Is it 0xXXFF also in ADC data register?

JW

CMYL
ST Employee

Hello,

For the settings you can refer to the following example provided by STM32Cube firmware for STM32G0:

~\STM32Cube\Repository\STM32Cube_FW_G0_V1.6.2\Projects\STM32G081B-EVAL\Examples\ADC\ADC_MultiChannelSingleConversion

Otherwise, what is the voltage range of your input ? You can check if you got the correct result using this formula:

CMYL_0-1743809223981.png

Where ADCvalue is 0xXXFF and Vref is VDDA=VDD by default in nucleo board and 4095 is 0xFFF for 12 bits resolution.

Best regards