Best way to change DMA source?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
RaAl_264636
Level 6
Level 6
50 sign-ins 25 sign-ins 10 solutions authored

Hi,

I've a question about DMA handling. I want to feed data from SRAM into a control register. This works with a single DMA channel and transaction descriptor. Now, I want to change it to have the possibility to select between multiple (at least 4 to 😎 SRAM sources.

From the WaveDAC component as example, I see that two DMA channels and transaction descriptors are used. I wonder if I have to use N DMA channels and/or TD's or if there's an easier way. 'AN84810 - Advanced DMA topics' states that it's possible to dynamically change a transaction descriptor by another TD. However, this approach seems to need two TD's chained, the modifying TD is always executed, and the data transferring TD is triggered by the modifying TD.

In my case, the data transfer should be executed always (TD loop configuration). If a change of the source is needed, the new source should be used when the TD starts again. Now, the question is: what's the best way to achieve this without creating multiple DMA components and/or TD's?

From my understanding of the DMA, it should be possible to reconfigure the source address by calling CyDmaTdSetAddress(uint8 tdHandle, uint16 source, uint16 destination) again with a new source address. If modify the source address between the DMA start signal and before the TD ends, the modification should take effect on the next cycle, right? Do I have to remove the 'preserve TD configuration' temporarily for that?

Alternatively, should I setup a second DMA which targets the first DMA TD source address? Are there any pros or cons between those approaches? Or is there a better way to achieve this?

Regards,

Ralf

0 Likes
1 Solution
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Hello,

It is not recommended to remove preserve TD.Both ways are fine. However please make sure that the DMA is disabled while the source address is being modified. You can issue a trq request to end current TD. In case of another DMA channel also make sure that DMA is disabled while modification is being done.

Thanks,

Hima

View solution in original post

0 Likes
2 Replies
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Hello,

It is not recommended to remove preserve TD.Both ways are fine. However please make sure that the DMA is disabled while the source address is being modified. You can issue a trq request to end current TD. In case of another DMA channel also make sure that DMA is disabled while modification is being done.

Thanks,

Hima

0 Likes

Hello Hima,

thank you, I'll try it.

Regards,

Ralf

0 Likes