AnsweredAssumed Answered

Connecting stereo ADC to stereo DAC via DMA

Question asked by renga.flavio.001 on Jun 20, 2016
Latest reply on Jun 20, 2016 by renga.flavio.001
I'm working on a preliminary feasibility study of a device based on the STM32F303RE platform.
The first step of this study is quite simple:
1. record a stereo stream from ADC peripheral
2. play the stereo stream using the DAC peripheral using a different sample rate

Obviously I'll use the DMA both to record and to play the data.
The problem is this: if I set the DMA for the ADC, the samples are recorded in an interleaved mode (even: samples from CH1, odd: samples from CH2). On the other hand, the two DACs need to be attached to two different DMA channels.
In other words: I cannot use the same array for both the ADC and the DACs, because the ADC creates an interleaved array (i.e., CH1(0), CH2(0), CH1(1), CH2(1). CH1(2), CH2(2), ...), but the DAC accepts only contiguous data (i.e., CH1(0), CH1(1), CH1(2), ...)
Is there an efficient way directly "connect" via DMA the data acquired by the ADC to the data the DACs will play?
The only alternative I know is to use one array for the ADC and two arrays (half sized) for the DAC, manually copying the data from the interleaved input array to the two output arrays. But this approach increases the SRAM requested memory, reduces the performance of the code and, more in general, eliminates all the benefits of using the DMA.

Thanks in advance!