cancel
Showing results for 
Search instead for 
Did you mean: 

ADC multi channel configuration(STM32F410)

Advance_tech
Associate III

Hello,

I'm using STM32F410 for ADC in which i have configured two channels means two conversions.

For IN7 channel the input voltage is 1.89V and for IN8 input voltage is 2.0v(This channel we have connected trimpot voltage can varied ) 

Please  check the configuration snap attached.

 when we configure  IN8 channel alone the conversion is happening properly  as per the input voltage(single conversion).

the problem is when we configure both channel at a time for both channel conversion if EOC Is set for single conversion means both channel value are coming same with same configuration if we set the EOC after all channel conversion both channel values are drifting drastically.

please guide me what is problem and what are parameter to consider while using multi channel 

Please  check the configuration snap attached.

 

Advance_tech_0-1702636700536.png

12bit ADC clock freq = 6.25MHZ

Advance_tech_1-1702636828356.png

This is program 

please check and correct where i'm doing wrong

 

 

 

 

  

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Use DMA to convert multiple ADC channels in sequence. You could also do one conversion, then switch channels, then do the other. But there's no good way to convert both channels in a sequence in polling mode on this chip.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

7 REPLIES 7
TDK
Guru

Use DMA to convert multiple ADC channels in sequence. You could also do one conversion, then switch channels, then do the other. But there's no good way to convert both channels in a sequence in polling mode on this chip.

If you feel a post has answered your question, please click "Accept as Solution".

Hello @TDK Thanks for solution.  

I have another problem.

 In one of channel the  ADC values are shifting drastically i have checked voltage going to controller is correct (1.89v)

but I'm not getting desired output whereas another channel values as per input voltage.

 

please check the snap attached how the values changing in 7th channel.

ADC_MULTI_CHANNEL_18-12-23.png

 what can cause this problem?

How is that channel connected? What is the desired output you're expecting?

 

See here for general ADC accuracy tips:

https://www.st.com/resource/en/application_note/an2834-how-to-optimize-the-adc-accuracy-in-the-stm32-mcus-stmicroelectronics.pdf

In particular, sampling time can increase accuracy for high impedance signals.

 

Connecting that signal to GND and verifying ADC output is near 0 can also help to double check that it's connected correctly and that the pin is initialized properly.

If you feel a post has answered your question, please click "Accept as Solution".

hi @TDK 

I have some Douts regarding the ADC configuration in STM32F410 chip.

We have connected three channels to ADC peripheral.

The hardware is NTC thermistor as temperature sensor.

we are using 12-bit ADC.

please tell me correct configuration for these channels.

1) what is continues conversion mode? is this suitable for our above requirement.

2) discontinues conversion mode. Is this suitable for our above requirement.

3) what is scan conversion mode?  is this suitable for our above requirement.

4) EOC at end all conversion is suitable or EOC and end single conversion suitable.?

5) DMA requirement? 

6)how calculate the sampling time for channels? what happens with wrong sampling time?

7)what is ideal frequency for application?

I have gone through the data sheet and reference manual, but I couldn't understand   much

please explain it will be helpful. 

 

 

If you cannot understand those things, then you have to step back and first learn something basic that you can understand.

https://www.embeddedrelated.com/showarticle/453.php

hello @Piranha 

I understand these things just I not getting desired I wanted.

one channel values are coming properly, and other channels values are changing even it has fixed voltage as input.

 

please check previous topics.   

There is no "correct" way to do things. It can be accomplished in multiple ways. I would suggest using an existing ADC DMA if you have no other experience or preference on how to do things.

 

> The hardware is NTC thermistor as temperature sensor.

Okay, you have a thermistor, attached in some unspecified manner, and you're taking readings on 3 ADC channels. A lot of details are missing here.

 

> I have gone through the data sheet and reference manual, but I couldn't understand   much

Perhaps go from some existing code then. Or re-read. Not sure how me explaining it here will have different results.

If you feel a post has answered your question, please click "Accept as Solution".