2015-09-13 02:14 PM
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-usart2015-09-13 04:12 PM
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.