I'm implementing a Modbus library on the KL27Z. Since Modbus RTU packets can be variable length, the Modbus protocol specifies (roughly) that the end of a packet is signaled by when the bytes stop coming. (The spec actually specifies a gap of 3.5 bit periods ends a packet, but since communication is strictly master requests / slave responds, there's no significant penalty for relaxing that requirement.)
I'd like receive serial data via UART / DMA, but use the IDLE flag (and ILIE interrupt) in the UART to terminate the DMA reception.
Before I charge off and implement this myself, it's worth asking: has anyone else written something like this? Do you have any code and/or words of wisdom to share?