how can store different channels of ADC in a array of two dimension used on DMA ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-02 12:11 PM
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
I 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
- Labels:
-
ADC
-
STM32F0 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-02 12:34 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-03 4:00 AM
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
Thanks
