DMA TD Chaining

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

cross mob
Anonymous
Not applicable

 I have a large chunks of memory(40k) from which i am transfering data to two small  buffer(100Bytes each) using DMA. From these two small buffer i need to transfer data to  another memory of size 40k. This both transfer i want to achieve through DMA.

   

I am using TD chaining to transfer my data to two small buffer. But, source address is not getting incremented even though i am using the TD property to increment the source and destination addresses.  Both TD's are(TD[0] & TD[1]) getting filled by the first 100Bytes of  the source data and  afterwords once it comes back to the TD[0] ,the same 100Bytes of data is again getting transfer from the source(40k). So in that case i am not able to transfer the data more than of first 100 bytes.

   

 

   

Regards,

   

Aditya 

0 Likes
5 Replies
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Just out of curiosity: are you using external memory? Or is the source of your data Flash? (The PSoC5 has 64k RAM, so it cannot fit 2 times 40k)

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

To your question: probably you did configure the DMA (with CyDmaChEnable()) to reset the TDs when they are finished. Set the second parameter to 0.

   

But then the target address also doesn't get set. So what you need is a chained, self-modifying DMA config. Add another DMA that transfers the constanst target base address into the TD that needs to be reset.

   

Probably you need to look into AN84810 (advanced DMA topics): http://www.cypress.com/?rID=82680 , it has a chapter about modifying a DMA dynamically.

   

Btw: whats your use case? Why the intermediate buffer, and not a direct transfer?

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Some useful DMA references -

   

 

   

    

   

          

   

http://www.cypress.com/?rID=37793     AN52705     Getting Started with DMA

   

http://www.cypress.com/?rID=82680     AN84810     PSoC® 3 and PSoC 5LP Advanced DMA Topics

   

http://www.cypress.com/?rID=44335     AN61102 PSoC® 3 and PSoC 5LP - ADC Data Buffering Using DMA

   

http://video.cypress.com/video-library/search/dma/     Videos on DMA

   

https://www.youtube.com/results?search_query=dma+psoc Videos on DMA (some overlap)

   

 

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 @hli: Yes i am using extenal memory buffer from where i am transfering 100Bytes of data to each two small buffer and from those two small buffer i am transfering 200bytes to the destination buffer. Similarly i want to transfer 200bytes every time from external memory to intermediate buffer and then to the destination.

   

I  already have tried with these options but it doesn't work.

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Just changing the second parameter of CyDmaChEnable() won't work alone. As I wrote - you need a self-modifying DMA configuration.

   
        
  1. DMA must be configured not to reset the configuration after a TD has finished
  2.     
  3. first TD transfers data from memory 1 to the buffer, 100 bytes
  4.     
  5. second TD transfer 100 bytes from the buffer to memory 2
  6.     
  7. third TD sets the destination address of TD1 back to start og buffer
  8.     
  9. fourth TD sets source address of TD2 back to start of buffer
  10.     
  11. then repeat
  12.     
  13. you probably need a counter to somehow count the number of times this loop has repeated - one TD can at most transfer 4095 bytes. The chain needs to end after TD4, and needs to be restarted automatically until it has run 40 times
  14.    
0 Likes