cancel
Showing results for 
Search instead for 
Did you mean: 

Stack DMAable Memory Address While DMA Transfer

Manish Sharma
Associate III
Posted on May 09, 2018 at 12:44

Hi All,

I am working on STM32H743 MCU's DMA.

I was doing DMA transfer on the SRAM address space 0x30000000 (data transfer of 16K). I was visualizing a situation where i put this (0x30000000) address of the sram on the function (let say fft_process(uin32_t *buff)) which does some processing.

Calling Function:

fft_process( (uin32_t)0x30000000);

Let suppose if there is a last byte left to DMA and i fell in a situation ( A BUG ) where i invoke

fft_process( (uin32_t)0x30000000) before the last transfer then what are the problem pops up ?

Is it good to stacked ( here i did on the function fft_process) DMAable memory address (0x30000000) while DMA transfer is going on ?

4 REPLIES 4
Posted on May 13, 2018 at 23:53

Better to do DMA with a double length buffer, and the process the two halves (ping / pong) in the HT and TC interrupts, so each buffer is stable and complete during processing.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 23, 2018 at 06:07

Thanks and Indeed true !!

My question was

'Is it good to stacked ( here i did on the function fft_process) DMAable memory address (0x30000000) while DMA transfer is going on ?'

Posted on May 23, 2018 at 07:39

I found that once the DMA function is initiated, you must exclude that ram area from tampering.

If you need to further DMA extra data, then you must use a different RAM area.

Just like

Turvey.Clive.002

suggested, I use long buffers.

These days the processors have plenty of RAM, so for each Tx DMA, I usually use a static buffer of 1k but up to 4K.for the console serial port.

Posted on June 01, 2018 at 06:53

'Is it good to stacked..'

Sorry, really don't understand what you're asking there. I don't think running fft_process() on a live buffer is advisable.

You can race the buffer fill vs processing if you understand the algorithm, ie that it acts on the buffer in a linear fashion, and that processing can't reach the fill point before the data.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..