This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1294NCPDT: uDMA status

Part Number: TM4C1294NCPDT

Hi,

I am receiving data packets (about 50 bytes) from a UART RX line using uDMA. I have enabled the FIFO mode on the UART. What would be the most efficient way to find out that the DMA data transfer has started?

Thanks

  • Sina,

    That's an interesting question... I'll add this post more as a comment than as an attempt for a direct reply.

    When we use DMA, the application no longer sees the "normal" peripheral interrupts (at least with Timers I'm sure). Rather, the interrupt is only flagged when the whole configured DMA transfer is finished.

    In your case, that would be 50 bytes (or whatever fixed size you configured the DMA transfer)... Can you make a quick program to confirm that, if you configure your DMA for say 48 bytes, and only send a burst of 24 bytes, you will NOT get any interrupts? If you really don't, then the only way would be polling directly inside the DMA control array - you will have to figure out how that array is organized (there is documentation for that), and read the byte that contains the current number of transferred bytes (will not be efficient, apparently).

    We spent a lot of time to come up with a solid receive/transmission UART library, and back then we did target for DMA - only to figure out it was not the most efficient solution for our need. You do have a 16 bytes FIFO available, and using a regular interrupt to be flagged at RX and RT works quite well.

    - RX will interrupt when a "certain level" of the FIFO buffer is reached. If you configure it to 50%, it will trigger after 8 bytes are received, in which case you "already have 8 bytes to process, and at the same time, can still take as much as the amount of time required by the next 8 bytes" to read them. This 50% level is your choice, depending of how often you want to service the incoming bytes, and how fast you know you can service them.
    - RT will interrupt when the above "RX level" has NOT been reached, but there has not been incoming signals in the UART for a bit longer that "one byte should arrive in continuous transmission" - in other words, probably the transmission burst has finished.

    Hope this makes sense to you: don't try to process your incoming bytes inside the interrupt routine. Just quickly copy the received bytes to a buffer, and set a flag telling your program that "there's new stuff in the receive buffer". Your program must treat them afterwards, "outside the ISR, in main program flow".

    Bruno

  • Hi Bruno,

    May we note "great & caring" detail - your (above) post.     Well done - clearly the "spirit" of this forum.   (especially during "vendor-lite" dayze...)      

    Did I say we love your detail?     (but for "- RT will interrupt when that level has NOT been reached")     While "that level" (may) be understood - it "does" introduce an element of uncertainty.     (brevity - said to be the "soul of wit" - is (infrequently) noted as, "soul of understanding" - mais oui?)     Mercï...

  • Hi Bruno,

    Thanks for your detailed reply. I had already tried sending less bytes than the number of bytes programmed in the DMA transfer, but didn't get any interrupt. As you suggested, I thought about polling the DMA control array but as you also mentioned it 's not an efficient solution.

    Sina
  • Hi Sina,
    I wonder if the uDMA ping-pong mode would work for you. You will setup the primary control structure that will transfer the first word and the alternate control structure that transfers the remaining 49 data. When the first data is complete using the primary control structure it will generate an interrupt. This can be used as an indication as the start of the DMA transfer for the subsequent 49 data to come.
  • Hi Charles,

    This is a very good idea! I will check it out!

    Thank you,
    Sina
  • Hi Charles,

    I implemented the ping pong mode to detect the start of dma transfer as you suggested and it worked!

    Thank you!

    Sina