2025-03-25 7:10 AM
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:
2025-04-03 7:30 AM
Hi @YChen.9 ,
Several tips to optimize ADC accuracy for STM32 products are provided in the application note AN2834: How 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.
2025-04-03 1:28 PM
> the data returned is always returned as 0xXXFF
Show.
Is it 0xXXFF also in ADC data register?
JW
2025-04-04 4:30 PM
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:
Where ADCvalue is 0xXXFF and Vref is VDDA=VDD by default in nucleo board and 4095 is 0xFFF for 12 bits resolution.
Best regards