cancel
Showing results for 
Search instead for 
Did you mean: 

DMA Transfer with Data Size larger than 65535

Mark Xiao
Associate
Posted on March 13, 2017 at 16:13

Board: STM32F767 Nucleo-144.

I use DMA to transfer results sampling from ADC at 1MHz to SRAM, but the data size is quite large which is 240k samples (480kbytes). However, a single DMA transfer (calling HAL_ADC_Start_DMA) only supports a data size of 65535, which is far below my requirement. And the ADC data transfer must be continuous, so I think starting a new DMA immediately may cause data loss? Is there anyway to do this?

Thank you.

3 REPLIES 3
Posted on March 13, 2017 at 17:31

You can split the data buffer in half using HT/TC interrupts to manage the non-active half, while remaining in continuous/circular mode. There should also be a double-buffering mechanism, which would allow you advance the blocks of memory being written too.

Even copying from a HT/TC managed buffer, I don't see that you'd need to suffer data loss.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
design23
Associate II
Posted on March 13, 2017 at 20:37

Mark:  Thanks for asking this question.  I have exactly the same requirement coming up next week.  Keep us updated on your progress and solution, if possible.  Garry.

Posted on March 13, 2017 at 22:34

Hi,

Thank you for the hint, and I just find the double buffering mode library in stm32f7xx_hal_dma_ex.c, and I can use function HAL_DMAEx_ChangeMemory to change the memory address of one of the buffer after that buffer completes its transfer. However, I am still not sure about something. Could you answer my following questions?

a) For the function: HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength)

Double buffering mode is actually in circular mode, so what does datalength refer to? The buffer size?  One single buffer or total size of two buffers?

b) If I want to change the memory address, is there any function I can call to know the transfer completion of one buffer? I only saw there is an enum type define as HAL_DMA_LevelCompleteTypeDef, but I did not see any function can return it.

c) How do I stop DMA when it reaches the amount of samples I want? Since double buffering is actually in circular mode, so I guess it will not stop only if I program it to?

Thank you.