cancel
Showing results for 
Search instead for 
Did you mean: 

DMA transfer from ADC to array in memory

raffael
Associate II
Posted on December 13, 2011 at 15:35

Hello there,

I'd like to set up an ADC and DMA so that converted data is directly written into an array in memory.

I modified the ADC3_DMA example but it doesn't work correctly.

I replaced ''ADC3ConvertedValue'' by an array, set DMA_InitStructure.DMA_BufferSize to the array length and enabled DMA_MemoryInc.

The values in the array are correct only for very low frequency signals. It is like they were sampled at approximately 160Hz.

How should I set up ADC and DMA in order to get the transfer working correctly? (I need to sample 4 signals at 100kHz each using 1 or 2 ADCs)

Does anyone have an example using the DMA to write to an array?

Thanks!

#dma-transfer-from-adc-to-array
2 REPLIES 2
raptorhal2
Lead
Posted on December 13, 2011 at 17:20

You already are writing to an array in memory. When the 4 sample conversion completes, process those 4 before the next 100 KHz sample. If processing takes more than 10 usec, save the groups of 4 in a buffer until sampling is complete, then process.

Cheers, Hal

raffael
Associate II
Posted on December 20, 2011 at 16:38

Hello,

Thanks for your response!

You're right, I shouldn't complicate things too much.

I was just wondering if ther was an elegant solution to directly buffer samples in an array using DMA. So the processor could compute blocks of samples without having to care about getting individual new samples at all.

Best, raffael