cancel
Showing results for 
Search instead for 
Did you mean: 

Demo code for SAI in Double Buffer DMA mode?

Mike Hooper
Senior
Posted on August 01, 2017 at 23:53

I'm trying to configure my STM32F7xx device to DMA stereo audio samples from RAM (SampleBuffer1[] and SampleBuffer2[]) to the SAI using the Double Buffer mode of the DMA controller. However, I can't seem to find any sample code for setting this up. Is there any demo code with this specific configuration? I have found lots of sample code for much simpler configurations, but it does me little good.

#double-buffer-dma
2 REPLIES 2
Jan Waclawek
Senior II
Posted on August 02, 2017 at 00:15

Take the single-buffer case, fill in the other memory-side address register, set the double-buffer bit in CR, and that's all.

JW

Mike Hooper
Senior
Posted on August 02, 2017 at 13:31

Wow, golly gee, why didn't I think of that! If this is so trivial, would you mind providing tested code? Here's the configuration:

SAI1A master using DMA with interrupt at completion

I2S standard protocol

48K/16bit audio samples

Sample Buffers contain 320 stereo samples each.

Please show both configuration of the SAI and DMA, as well as the DMA trigger statement.

Thanks for providing such a well thought out, comprehensive answer.