DMA Flush Fifo

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User19183
Level 1
Level 1
Hello!

I'm working on a XMC4500 Device. I use the DMA with a USIC Channel in ASC Mode.
I'm at the receiver side of this Uart channel.
I receive frames with a very strickt timing, and dont care about the data transmitted between those frames.

Uart -> DMA works well if only the wanted frames are transmitted on the Uart.
However, if there are bytes transmitted after my DMA has fnished it's block transfer I have a problem.

The last two bytes of the non wanted data stays in the DMAs Fifo (as indicated by CFGL.FIFO_EMPTY) and is transferd into the destiantion memory as soon as I configure the DMA.

For easier understanding here the what happens chronologically:
I receive a frame of data via UART .
DMA Transfer complete interrupt. Setting CFGL.SUSP
Some more bytes are received.(garbage)
Reading USIC.RBUF twice to flush it.
Flushing Fifo by USICChannel.TRBSCR.FLUSHRB
CFGL.FIFO_EMPTY still indicates there is data in the DMA fifo.
Configuration of the DMA for the next frame. Clearing CFGL.SUSP
Even before there is any data on the line (as confirmed by logic analyzer) the DMA writes the last two bytes of garbage to the destination buffer.

Here is the question:

How do I get rid of this extra data?
Can I flush the DMAs fifo?

The datasheet V1.4 Page 5-15 mentions:
Note: An exception to FIFO readiness for destination transfers occurs in "FIFO flush
mode" In this mode, FIFO readiness for destination transfers occurs when the
channel FIFO contains data to form at least a single transfer of
CTL.SRC_TR_WIDTH width (and not CTL.DST_TR_WIDTH width, as is the
normal case).


Flush Fifo mode is not mentioned else where in the datasheet, neighter in the Application Note GPDMA (AP32290).

According to the datasheet again page 5-15
When a channel is suspended - The destination state machine does not wait for the
FIFO to become half empty to flush the FIFO, regardless of the value of the
FIFO_MODE field.

So setting CFGL.SUSP should actually flush the fifo. But it does not.

Help is highly appriciated.
0 Likes
0 Replies