Hello,
I am using the uDMA peripheral on a TM4C1294 microcontroller to automatically move data from a UART FIFO to a 64-byte buffer in memory. I have the uDMA configured as a ping-pong buffer, which should work great when I'm getting a constant stream of data, because an interrupt is triggered when the primary buffer is full and uDMA automatically switches to filling the alternate buffer. However, there will come a time when the data stream will stop, but there will probably be data left over in one of the buffers. When this happens, I would like to prematurely swap the buffers so that any future incoming bytes go into the empty buffer. Then I can safely dig through the partially-full buffer, copy out the data I need, and be on my merry way.
So here's my question: what is the best way to trigger this buffer-swap behavior? Is it as simple as setting XFERMODE to STOP in the DMA channel control word? If so, is there any danger in dropping a byte if I set it to STOP while uDMA is in the middle of transferring a byte? Or will it automatically swap to the other buffer and continue adding incoming data to that instead?
Thanks!