Hi Mark,
I find that DMA operation is usually harder to debug and I wanted to have a solid understanding of what's going on with the UART before I try using DMA. Do you know where I might find some good example code that doesn't rely on KSDK? I'm stuck on CW 10.7 for most of my projects for the foreseeable future.
The handshaking latency is fine; with hardware flow control enabled, it raises RTS immediately when the threshold is hit and the sending device *usually* honors that immediately. It's the latency in getting the data to the application that I'm worried about.
I will still need flow control even if I set aside all of the DMA buffer space I can. Of all of the firm real-time tasks the application needs to handle, the UART data is possibly the only one that can be postponed briefly as long as flow control is working. Being able to rely on flow control taking care of a rare missed deadline makes the rest of the system quite a bit easier to deal with.
Last time I looked at DMA for this, one of the problems was that to get a transfer after every byte, the FIFO watermark has to be set to 1. The problem is that it's also the flow control watermark, and it raises RTS briefly after every byte. The sending device is a SiLabs WGM110 and their first firmware release was totally broken in its flow control handling. A brief pulse on RTS would frequently cause their software-emulated UART to stop sending permanently, until a hard reset. In the next release it would only rarely freeze - after maybe 30-60 seconds of data instead of a few hundred bytes, but still too frequent. I haven't had the latest beta release freeze yet but I don't have 100% confidence in it and in any case every microsecond that RTS is raised is a microsecond that it's not sending data. I also don't like throwing another 1 MHz square wave into the mix when I'm trying to keep noise down. Using the FIFO reduces that by at least a factor of 6, and since many of the packets coming in are 4-5 bytes it sometimes eliminates it entirely. Trying to squeeze those last bytes out of the FIFO in DMA mode when the line goes idle seems at least as problematic as getting them out in interrupt mode, though. I'll deal with the 1 MHz RTS pulses if I have to; if SiLabs has actually fixed the bug, the rest of it can be dealt with.
Background poling in this case is complicated by the fact that when there's not much activity it'll be in WFI mode most of the time to save power.
If anyone from NXP is paying attention, what I'd love to see in a future version is a separate flow control watermark to separate the interrupt/DMA trigger from the flow control trigger, and an option for an idle line to generate an IRQ or DMA (only once!) when there is data in the FIFO.
Thanks,
Scott