2013-01-01 11:52 AM
Hello,
I am implementing a UART driver using circular queue scheme, and found a minor problem with it. When I put a new character after DMA channel 5 finishes its transfer - i.e. put a new character when DMA_CNDTR5=0 - the DMA(not just ch5, including channel 4, which runs for UART TX) stops working. It can be solved by disabling DMA channel quickly after its finish, before any new request arrives. However, due to many problems, such as latency due to interrupt priority, I think some error may occur using this method, so I changed channel 5 to use circular mode, which makes CNDTR never turn to 0. It doesn't make such problems, but it overwrites unread data. Is there any method that can disable a dma channel after its transfer completion automatically?2013-01-01 05:43 PM
What part, baud rates and usart are we talking about here? It's easier to work with specifics.
I'd think with a reasonably small circular DMA Rx buffer (say 32 or 64 bytes) with an HT and TC interrupt, you'd be able to deal with some quite significant latency. For Tx, I can't see why one would use circular DMA, but rather chain linear buffers at the TC interrupt. You'd basically be able to stream if the latency was less than around 16-20 bit times.