Skip to content

Aborting multiple DMA transfers simultaneously #1653

Open
@neuschaefer

Description

@neuschaefer

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

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions