AnsweredAssumed Answered

Kinetis UART DMA

Question asked by Carl Norman on May 1, 2017
Latest reply on May 3, 2017 by Carl Norman

Hi All,


I am using a serial download tool that has no flow control and no speed control (so all those options for a solution are no good as I know this will be the first solutions offered up). I need to stream data in while writing to flash, its not very fast, but fast enough that data arrives while I am writing to flash and causes a hardware collision.


My first thought was to use the UART DMA examples supplied with the SDK (fsl_uart_dma.c) as the data could arrive while i write to flash without issue. However, the example (uart_dma_transfer.c) doesn't appear very useful as you appear to have to know the length of data you're getting? And, there appears to be no "idle timeout" signalling of any kind? And no information on how to check how much data is in a buffer? and no ring buffer?


I imagine almost all applications cannot know the length of data until it arrives, and, people will need to check if nothing has happened in some time, and, dont want to be firing interrupts off constantly as DMA UART would be completely useless.


I would have hoped/thought the general most common implementation for DMA UART is to have some way to "check" the DMA location in a ring buffer and access that data in its buffer so I can go off and do my processing on that section of the buffer while the ring keeps going around in the DMA, then, when I am done doing my processing, see where the DMA is up to, or see if nothing else has happened in some period of time.


Is what I am thinking possible? Am I not understanding the normal implementation of this type of feature? 


I am using FreeRToS, and KL27z, but I dont think that really matters... Other than running interrupts and context switching make for extended delays.