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.

How to stop and restart a DMA transfer?

I'm using ping-pong DMA transfers for SPI receive. After the initial DMA setup DMA transfers proceed as expected. However, I want to stop the DMA part way through a transfer and restart it again from the start of the transfer buffer. When I do this DMA does not restart. I've tried disabling and re-enabling DMA and setting up the transfer control entries again but this doesn't work. After the control table entry is re-initialized DMA transfers don't start again. Does the uDMA controller allow stopping and resetting a channel part way through a transfer?

  • Hi,

    We will check and get back to you - Meanwhile, maybe it is a good idea to paste your code snippet.

    Regards,
    Gigi Joseph.
  • Nuno,

    Most likely you are hitting a 'UDMA_INT_ERR' - Can you please check and confirm? Point is, you cannot modify the control table entry while a channel is enabled - Please retest by disabling the corresponding uDMA channel.

    -/Praneet
  • Thanks. I'll check if the error is set.

    I've tried something a bit different and this seems to work. Maybe you could comment on my solution? The problem is that the total SPI RX transfer size is unknown so SPI stops receiving part way through one of the ping-pong buffer transfers. When this happens I modify the transfer size in the control word of the channel structure for the buffer that was partially filled and reset it back to the full transfer size for the buffer. I do this because I want the next transfer to start at the beginning of the buffer. I don't disable and re-enable the DMA channel when I do this. I think this should be okay because I know for sure there are no DMA requests while the control structure is modified by software. I've tried this and it seems to work properly. Do you see any problems with this approach?

  • Nuno,

    This should be fine, since you are sure that there wouldn't be any DMA requests while the control structure is modified.

    -/Praneet