Skip to main content
Associate
October 16, 2024
Solved

DMA with multple variable

 

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.
Tesla DeLorean
Tesla DeLoreanBest answer
Guru
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.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..

1 reply

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
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.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..