Aborting multiple DMA transfers simultaneously #1653

Open
opened 2024-02-27 07:14:22 -06:00 by neuschaefer · 0 comments
neuschaefer commented 2024-02-27 07:14:22 -06:00 (Migrated from github.com)

Background

Suppose we have two DMA channels, 0 and 1, streaming data to a peripheral. Each one chains to the other, to generate gapless streaming without CPU involvement.

Occasionally, the software wants to start a third DMA channel (2) to transmit other data. To avoid interference of channels 0/1, it first has to abort them:

dma_channel_abort(0);
dma_channel_abort(1);

dma_channel_set_read_addr(2, buffer, false);   // transmit a buffer full of data
dma_channel_set_trans_count(2, size, true);    // and go!

This would have the desired effect most of the time: Either channel 0 or 1 was running, and it's now stopped. But occasionally, this would not work:

  channel 0:        channel 1:           CPU:
   (stopped)         (running)            
                                         abort 0 (no effect)
                      finish
    start               
                                         abort 1 (no effect)

Request

To deal with such situations, it would be nice to have a function in pico-sdk that reliably aborts multiple DMA channels that may chain to each other.

See also

## Background Suppose we have two DMA channels, 0 and 1, streaming data to a peripheral. Each one chains to the other, to generate gapless streaming without CPU involvement. Occasionally, the software wants to start a third DMA channel (2) to transmit other data. To avoid interference of channels 0/1, it first has to abort them: ```c dma_channel_abort(0); dma_channel_abort(1); dma_channel_set_read_addr(2, buffer, false); // transmit a buffer full of data dma_channel_set_trans_count(2, size, true); // and go! ``` This would have the desired effect most of the time: Either channel 0 or 1 was running, and it's now stopped. But occasionally, this would not work: ``` channel 0: channel 1: CPU: (stopped) (running) abort 0 (no effect) finish start abort 1 (no effect) ``` ## Request To deal with such situations, it would be nice to have a function in pico-sdk that reliably aborts multiple DMA channels that may chain to each other. ## See also - https://github.com/raspberrypi/pico-sdk/issues/923
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#1653
No description provided.