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: Cancel DMA transfer

Part Number: TM4C1294NCPDT

Hi,

Is it possible to cancel an ongoing uDMA transfer? If yes, what is the best way to do it?

Thanks,

Sina

  • Yes, a call to the TivaWare function uDMAChannelDisable() will stop the uDMA from responding to any additional requests. Are you wanting to stop the DMA in the middle of transfers that are from a single request? Can you give me some more information on exactly what you are trying to do?
  • Hi Bob,

    Thanks for your reply. I am receiving packets from and external device on the UART connection of TM4C129. I have a dma setup to transfer the packet to a buffer. The problem I try to handle is the case in which the sender stops sending in the middle of a packet. In other words, I receive an incomplete packet. I have already found out how to detect the start of a dma (there is another thread here on this) using a ping pong dma setup. So I start a timer when I have detected that the dma has started. If a full packet in not received within a given time interval, my timer fires an interrupt. In this interrupt I need to cancel the dma transfer (for example if my packets are 50 bytes and I have received 30 bytes only, the dma engine is still waiting for 20 bytes to come), otherwise if the sender starts sending a new packet later on, all subsequent received data will be out of sync.

    Regards,
    Sina
  • I think it will work if you don't use the UART FIFO and use the BASIC DMA mode. That way you get a single DMA request for each byte that comes and you transfer one byte at each request. When you have not gotten all 50 bytes in the packet before the timeout, you disable the packet and reconfigure it for 50 transfers of one byte each and re-enable it.
  • Hi Bob,

    I can't use the BASIC DMA mode since I am using the PING PONG mode to detect the start of the transfer (PING PONG mode is configured to transfer 1 byte for the first transfer (so I get an interrupt to detect the start of transfer) and the second transfer is configured for 49 bytes.

    Regards,
    Sina
  • It should still work. In fact, you can use the FIFO as long as the arbitration size is equal to the size of the FIFO DMA request. For example an arbitration size of 8 if you set the FIFO notification at half full. Just don't disable single requests.
  • Thanks Bob. I will check it out.

    Sina