cancel
Showing results for 
Search instead for 
Did you mean: 

Sample sfecific ADC channel

Ariel G
Associate II
Posted on April 12, 2018 at 12:41

Hi,

I'm trying to work with the ADC of the STM32F072RB which have 1-ADC with 16 channels,

what I'm trying to do is to take 1000 samples of ADC_CH1 every X second and take 1000 samples of ADC_CH2 every Y seconds and once in few minutes sample the temperature sensor.

I'm using DMA the problem as I understand it is that the ADC is working in a scan mode and I can't distinguish between the channels so what is happening is when I sample 1000 times the result is [ADC_CH1, ADC_CH2, TEMP,..,]

Is it possible to sample a specific ADC channel?

1 REPLY 1
AvaTar
Lead
Posted on April 12, 2018 at 13:21

... as I understand it is that the ADC is working in a scan mode ...

If you configure it that way, yes.

But scan mode would be appropriate IMHO.

... and I can't distinguish between the channels so what is happening is when I sample 1000 times the result is [ADC_CH1, ADC_CH2, TEMP,..,]

Not too difficult.

After each sequence, the results from each channel are copied to the DMA target buffer, in the order (rank) you configured the ADC.

A TC (Transmission Complete) interrupt from the DMA would inform you about a new set.

In your setup, that would happen each millisecond.

For channels with lower sample rates (temperature in your case), the easiest thing is to ignore the surplus samples, or average them.