Skip to main content
Visitor II
October 16, 2024
Solved

DMA with multple variable

  • October 16, 2024
  • 1 reply
  • 513 views

 

I have three variables:

volatile uint16_t a[20000];

volatile uint16_t b[20000];

volatile uint16_t c[20000];

 

However, I only have one DMA channel.

Can I use the DMA to transfer these three variables together in circular mode?

starting with the first 10,000 items of each 3 variable, so the total items will be 30,000

currently: 
HAL_DMA_Start(&hdma_tim8_com, (uint8_t*)xxx, &dst, 30000);

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    >>Can I use the DMA to transfer these three variables together in circular mode?

    No, it's also not going to interleave.

    Perhaps use a STRUCTURE or multi-dimensional ARRAY

    3 ARRAYs will need 3 TRIGGERS, and 3 DMA CHANNELS

    Also volatile isn't on it's own sufficient. You must still manage Cache Coherency, DMA data doesn't update content of the MCU's cache, it's not bus sniffing.

    1 reply

    Graduate II
    October 16, 2024

    >>Can I use the DMA to transfer these three variables together in circular mode?

    No, it's also not going to interleave.

    Perhaps use a STRUCTURE or multi-dimensional ARRAY

    3 ARRAYs will need 3 TRIGGERS, and 3 DMA CHANNELS

    Also volatile isn't on it's own sufficient. You must still manage Cache Coherency, DMA data doesn't update content of the MCU's cache, it's not bus sniffing.