Skip to main content
Associate III
Jun 12, 2025 10:10 AM UTC
Question

STM32F103C6 DMA ADC reads 753 on all 8 adc

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

waclawek.jan
Super User
Jun 12, 2025 11:37 AM UTC

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
Associate III
Jun 12, 2025 3:54 PM UTC

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
Associate III
Jun 13, 2025 9:34 AM UTC

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

 

waclawek.jan
Super User
Jun 14, 2025 9:36 AM UTC

> 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
Associate III
Jun 26, 2025 1:10 PM UTC

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

So I am sure its not the code