Skip to main content
Visitor II
March 25, 2025
Question

STM32G070 ADC Accuracy Issues

  • March 25, 2025
  • 3 replies
  • 534 views

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

    This topic has been closed for replies.

    3 replies

    Technical Moderator
    April 3, 2025

    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

     

    Super User
    April 3, 2025

    > the data returned is always returned as 0xXXFF

    Show.

    Is it 0xXXFF also in ADC data register?

    JW

    Technical Moderator
    April 4, 2025

    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