Skip to main content
Graduate
June 12, 2025
Question

STM32F103C6 DMA ADC reads 753 on all 8 adc

  • June 12, 2025
  • 5 replies
  • 438 views

Can any one please assist me.

I have all 8 ADC down to GRND 0V I am using this command:
HAL_ADC_Start_DMA(&hadc1, AD_RES_BUFFER, 8);

 

The arry is:
volatile uint32_t AD_RES_BUFFER[19] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

All 8 ADC returns between 752 & 759.

The ADC configuration is 

erastusC_0-1749722331189.png

 

erastusC_1-1749722368774.png

 

This is the buffer from the IDE

 

erastusC_2-1749722959738.png

 

 

 

    This topic has been closed for replies.

    5 replies

    Super User
    June 12, 2025

    You appear to convert the same channel over and over, or all channels are at the same voltage.

    Read out and check/post the ADC registers content, especially the ADC_SQRx registers.

    Do you perform calibration before the conversions, as per the reference manual?

    JW

    erastusCAuthor
    Graduate
    June 12, 2025

    I did one calibration before the for(;;) loop.

    I did not know I must do a calibration for each read.

    I don't know what I have done but all of a sudden it is reading correct and I had to ground the input of ADC not connected.

    Where can I get the manual you are referring to.

     

    erastusC_1-1749743520435.png

     

    What I did notice is that I earthed the 

    erastusCAuthor
    Graduate
    June 13, 2025

    Crazy,

     

    I removed the DMA settings compiled the code, put the DMA settings back compiled the code and now it is working:

    Does not make sense at all.

    I hope it keeps on working.  But I wonder how stable the IDE is.

    erastusC_0-1749807208982.png

     

    Super User
    June 14, 2025

    > I did not know I must do a calibration for each read.

    No, I formulated it confusingly, sorry. One calibration at the beginning is enough.

    JW

    erastusCAuthor
    Graduate
    June 26, 2025

    I switched back to STM32F411 and the code worked 100%.

    So I am sure its not the code