Skip to content

RP2040 DMA: Enhance PIO RX DMA support for continuous hardware-chained ping-pong buffering via CHAIN_TO #4190

@jancespivo

Description

@jancespivo

Current high-level transfer API is not designed to support ping-pong buffering using CHAIN_TO.

It is crucial when dealing for example with camera data, where it is needed to fill a DMA buffer with a few lines and processing it very quickly while the second buffer is filled meanwhile.

I've tried double buffer approach without chaining:

let transfer_a = rx_fifo.dma_pull(dma_channel.reborrow(), buffer_a, false);
transfer_a.await;
  
loop {        
      {
          let transfer_b = rx_fifo.dma_pull(dma_channel.reborrow(), buffer_b, false);
          process_data(buffer_a);
          transfer_b.await;
      }
      {
          let transfer_a = rx_fifo.dma_pull(dma_channel.reborrow(), buffer_a, false);
          process_data(buffer_b);
          transfer_a.await;
      }
}

However it is not reliable and I observe missing data quite quickly (it probably depends on other running tasks).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions