cancel
Showing results for 
Search instead for 
Did you mean: 

how can store different channels of ADC in a array of two dimension used on DMA ?

feme
Associate

I am using stm32F030R8 Nucleo, my program reads three adc channels. Below I am showing the image. I don't find how to set ADC or DMA to get every ADC channels converted directly in a array like this uint16_t adcData[ADC_CHANNELS] BUFFER_SIZE]

ie:

adcData[0] [32] = 32 values of channel 0

adcData[1] [32] = 32 values of channel 1

adcData[1] [32] = 32 values of channel 1

0693W00000aI4Z0QAK.pngI would like to know if there is any way to do this split of adc conversions by ADC or DMA configuration, otherwise I should process later all values in this sequence to split them in different arrays

could anyone help me on this question? Thanks in advance for helping me

2 REPLIES 2
Peter BENSCH
ST Employee

Welcome, @feme​, to the community!

DMA is a hardware function that is only parameterised before the start and runs automatically after it has been started.

However, it is not intended (nor does it make sense) in the DMA state machine that the DMA target address is changed during such a DMA process that runs completely independently of the CPU. In this respect, you will have no choice but to collect the data from the sequence you have programmed and re-sort it - after all, you know exactly when you measured which value where, or don't you?

By the way, the only alternative would be another STM32 with several physical ADCs, each of which can run with its own DMA.

Does it answer your question?

Regards

/Peter

In order 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.
feme
Associate

thanks Peter, I understood what you explain me. In future I will consider that. Finally, I found a solution and it works for my application. I show you how I process the data buffer taht comes from dma after dma transfered completed. I did an average of all samples and changed to mV

0693W00000aI8VbQAK.pngThanks