cancel
Showing results for 
Search instead for 
Did you mean: 

DMA fifo algorithm for non regular data

Erkan Ersoy
Associate II
Posted on September 13, 2015 at 23:14

Hello

I am trying to figure out DMA and write buffer for incoming TCP data to send over USART

I was thinking about using circular DMA (for USART TX) and  add data to buffer. When new data arrives stop DMA and add data end of buffer circularly and continue DMA but restarting DMA will lose its last transmit point.

Can anyone point me right direction using DMA this kind of operation.

Thank you

#dma-fifo-usart
1 REPLY 1
Posted on September 14, 2015 at 01:12

I don't think circular is a good solution here.

You want to avoid having the CPU copy data from buffer to buffer, and this might mean you have to get more involved in buffer allocation and management.

The techniques usually used are block chaining, or scatter-gather. The hardware here is pretty dumb, so you have to implement these manually. Basically you maintain a linked lists of buffer and lengths, or descriptors holding the same, and then as you get the DMA TC interrupt for the last transfer, you configure the next one or stop. Then you just have to manage the list, or restart the operation when required.

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