5 Replies Latest reply on Mar 20, 2015 6:41 AM by helic_263931

    DMA TD Chaining

       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.







        • 1. Re: DMA TD Chaining

          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)

          • 2. Re: DMA TD Chaining

            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?

            • 3. Re: DMA TD Chaining

              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.

              • 4. Re: DMA TD Chaining

                 @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.

                • 5. Re: DMA TD Chaining

                  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
                  3. first TD transfers data from memory 1 to the buffer, 100 bytes
                  5. second TD transfer 100 bytes from the buffer to memory 2
                  7. third TD sets the destination address of TD1 back to start og buffer
                  9. fourth TD sets source address of TD2 back to start of buffer
                  11. then repeat
                  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