Skip to main content
Mike Hooper
Associate III
August 1, 2017
Question

Demo code for SAI in Double Buffer DMA mode?

  • August 1, 2017
  • 2 replies
  • 750 views
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
This topic has been closed for replies.

2 replies

Jan Waclawek
Visitor II
August 1, 2017
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
Associate III
August 2, 2017
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.