cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L431VC rading ADC value from 1 channel on multichannel set up

DominykasS
Visitor

Hello,

I am using ADC1 channel 1, 3 and 5. All these three inputs are connected to different sensors and I want to create a driver to read those sensors. The problem is that I don't want to read all input channels at once, I want to be able to select which channel value to get. Also I want to use DMA and conversion complete interrupt. Is this possible?  Which mode should I use to be able to tell ADC1 which channel value to convert? I am using HAL library. Right now I enabled scan mode, so after running HAL_ADC_Start_DMA() I get all sensors data. 

2 REPLIES 2
SofLit
ST Employee

Hello,


Right now I enabled scan mode, so after running HAL_ADC_Start_DMA() I get all sensors data. 

Why Scan mode is not suitable for you? As you can read all the channels but at final you use the value you need.

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.
TDK
Guru

You can convert a single channel at a time. After conversion, stop the ADC and reconfigure it to convert the next channel. You will need to reconfigure it on every conversion.

Seems easier to convert all channels at the same time. What's the drawback there?

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