cancel
Showing results for 
Search instead for 
Did you mean: 

Help with DMA1 and DMA2

Palacios.Bruno
Associate III
Posted on September 03, 2013 at 18:31

Hello guys, I have a problem with DMA2, while using DMA1 in the STM32F407VGT6

The thing is I�m doing a program which reproduce MP3 music while it reads the data from an SD.

I use the DMA1 Stream 7 for sending data to the DAC (I2S3) and DMA2 Stream3 to send and recieve data from the SD.

I was able to run both codes independently, I mean, I could reproduce music saved in the internal flash, as constant data, and also I could save and read data from the SD.

But when I want to use both codes mixed it happens something strange at least for me.

I read some data from the SD, then I reproduce it and when I want to read more data from the SD, the DMA2 stops working.

I didn't post the code because it's kind of big, but if you need some special part let me know.

Thank you very much for all and sorry if my english isn't good.

Best regards!

#stm32f4 #dma #dma #stm32-sdio
2 REPLIES 2
jpeacock2399
Associate II
Posted on September 03, 2013 at 21:23

Look at the DMA registers to see if there's an error.  In particular check DMA_LISR and DMA_HISR to see if any error flags are set.  Any error (ignoring HT half transfers) will stop the DMA transfer on the channel.  Also check the DMA_SxCR to see if the channel is enabled and configured for the right word size and especially burst access for both memory and peripheral.  If you see an FE error check your FIFO configuration in DMA_SxFCR to make sure you have the right threshold.

I've had a lot of problems with DMA2 if the FIFO is disabled so make sure you set up FIFO and burst mode.

  Jack Peacock
Palacios.Bruno
Associate III
Posted on September 03, 2013 at 21:34

Thank you for the tip, I'll check it as soon as I can and I'll let you know the results.

I'm pretty sure that the problem starts when I configure DMA1, but well, I'm not in home so I have to wait.

Thanks again!

Best regards,

Bruno