AnsweredAssumed Answered

Kinetis SDK 2.0 DMA UART continuous receiver

Question asked by mike snyder on Jun 25, 2018
Latest reply on Jun 25, 2018 by Mark Butcher

Hi !

I've seen a few posts about this, and it looks like people are using uTasker to achieve this. I do not have this option. 

Instead, my task loop is constantly checking UART status, in order to manage reads from the DMA buffers.

 

I am seeing some odd behavior. I'm using Keil 5.17 with an MKV58F1M0VLQ24.

 

I am trying to loop, check the status of the receiver, and kick off a DMA read when there is data. 

My application involves streams of 7 byte chunks that can either be concatenated, or a few milliseconds apart. 

Currently, there is no sleep time in my task loop in an effort to keep the receiver synchronized.

 

When I check the status register, I am seeing some odd combinations of states. 


c00000c0 - before the application starts chatting
80000000 kUART_TxFifoEmptyFlag
40000000 kUART_RxFifoEmptyFlag
00000080 kUART_TxDataRegEmptyFlag
00000040 kUART_TransmissionCompleteFlag

40000000 - when the application kicks off a downstream packet
40000000 kUART_RxFifoEmptyFlag

840040e8 - this happens somewhere around when 2 packets are received back to back (no space) 
80000000 kUART_TxFifoEmptyFlag
04000000 kUART_RxFifoOverflowFlag - over flow because I didnt get to it in time? Do I need to clear this?
00004000 kUART_RxActiveEdgeFlag - This stays persistent, does it need to be cleared manually?
00000080 kUART_TxDataRegEmptyFlag
00000040 kUART_TransmissionCompleteFlag
00000020 kUART_RxDataRegFullFlag - despite being full, my callback is never called after issuing a read
00000008 kUART_RxOverrunFlag - over run from 2 adjacent payloads?

c40040d0 - This follows my failed attempt to read the packet
80000000 kUART_TxFifoEmptyFlag
40000000 kUART_RxFifoEmptyFlag
04000000 kUART_RxFifoOverflowFlag
00004000 kUART_RxActiveEdgeFlag
00000080 kUART_TxDataRegEmptyFlag
00000040 kUART_TransmissionCompleteFlag
00000010 kUART_IdleLineFlag

c50040c0 - This is the steady state after my failed read attempt. 
80000000 kUART_TxFifoEmptyFlag
40000000 kUART_RxFifoEmptyFlag
01000000 kUART_RxFifoUnderflowFlag - it seems to have underflowed after the overflow. It seems to be unsync'd
04000000 kUART_RxFifoOverflowFlag
00004000 kUART_RxActiveEdgeFlag
00000080 kUART_TxDataRegEmptyFlag
00000040 kUART_TransmissionCompleteFlag

 

If I send the downstream request, and immediately request an EDMA read inside my ISR, 

I can see a 7 byte ACK payload, but then I can receive nothing after this. 

All I am trying to do is receive 7 bytes asynchronously. This has been pretty easy on other platforms even with DMA.

 

Does anyone have any feedback on flag management to make this work? Thanks

Outcomes