10 Replies Latest reply on Oct 24, 2014 11:21 AM by user_14586677

    Need help with DMA

    keith.kammler

      Greetings all,

         

      This is my first post on the Cypress forums, and I could really use a bit of guidance. I've been a computer engineer for a couple of decades now, but this is the first time I'm using the Cypress chip. I'm sure there's a way to do what I need, I just don't know enough about the PSoC5 to do it. So here goes...

         

      I have a chunk of memory (SRAM) that represents an array of 4-byte (32-bit) values. These values need to be transferred to my UDB via DMA so as to not encumber the CPU. The thing is though that only the lower 24 bits of each array entry contains data. Sending the 4th byte of each 32-bit array value will ruin the stream.

         

      I've gotten the first DMA to transfer the data all at once, in either 3-byte burst or 4-byte burst, but it sends all 32-bits. I've tried sending the 4-byte data to an intermediate buffer, and then use a second DMA with the data length and burst size set to 3 to to eliminate the 4th byte, but it's not doing what I want. I've also tried putting the two DMAs in reverse order, just in case. And also a small variety or other arrangements. >sigh< No joy.

         

      So, does anyone have a lot of experience with the DMAs that can help me?

        • 1. Re: Need help with DMA
          user_274749305

           Keith 

             

           

             

          A couple  of questions:

             

           

             

          How big is array?

             

           

             

          How wide is udb?

             

           

             

          Are sizes static?

             

           

             

          Is array a static address?

             

           

             

          Have you tried simple chained list of 3 byte transfers to an 8 bit destination?

             

           

             

          Can you use a 32bit wide chained udb?

             

           

             

          -ed

          • 2. Re: Need help with DMA
            keith.kammler

            Thanks for responding. I'll provide what information I can, but there are some potentially patentable methods involved that I would need to steer clear of.

               

             

               

            How big is array?

               

            The array, there are actually several, can vary from 30 bytes to several hundred.

               

             

               

            How wide is udb?

               

            I believe it's on a 16 bit spoke, but the SPIM is only shifting 8 bits at a time. If I could get it to accept 24 bits, that would pretty much solve everything. I've tried triggering the DMA from several of the interrupt sources: FIFO Empty, FIFO not full, Done, etc. Varying results.

               

             

               

            Are sizes static?

               

            They vary based on configuration, but not dynamic.

               

             

               

            Is array a static address?

               

            Public. Not a const. Not dynamically allocated. But not ruling that out for the future.

               

             

               

            Have you tried simple chained list of 3 byte transfers to an 8 bit destination?

               

            Not sure what you mean. One of the experiments did set up the transfer size as 3 bytes, and all it put out was 3 bytes. If you're talking about TDs, there aren't enough TDs. One of the documents mentioned Nested TDs, but there was no example. I'm also trying not to use interrupts for each 3-byte block.

               

             

               

            Can you use a 32bit wide chained udb?

               

            Like I said, I'm new to the Cypress chip. My output device is an SPIM if that's of any value.

            • 3. Re: Need help with DMA
              user_1377889

              Just,

                 

              welcome in the fascinating (and sometimes complicated) world of PSoCs!

                 

              Apart from keeping things secret, best for you to get help would be to have a working project from which you can transfer the essentials to the project your company is working on.

                 

              Here is an application note that describes all the pitfalls you may freely step in: www.cypress.com/

                 

              Usual errors made when using DMA is to forget using addresses, incrementing when no increment should be used.

                 

              I would suggest you build an example project that transfers your data via DMA to an 8-bit peripheral, then post it here so that we all can have a look at all of your settings. To do so, use
              Creator->File->Create Workspace Bundle (minimal)
              and attach the resulting file.

                 

               

                 

              Bob
               

              • 4. Re: Need help with DMA
                user_14586677

                Some useful ref material in case you have not seen it -

                   

                 

                   

                    

                   

                          

                   

                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.

                • 5. Re: Need help with DMA
                  keith.kammler

                  Greetings Dana

                     

                  Thanks for the links. I've printed out and highlited most of these as I have been using them as the starting point for what I have already. There are a couple that I have not seen before, so that's something to pursue.

                     

                   

                     

                  Hi Bob,

                     

                  this project is a port from a previous working project. The previous project was using a PIC where I had to bit-bang the data out, and had no DMA. The rest of the ported features are working beautifully: PWM, Timers, UARTS, protocol and message processing, etc.

                     

                   

                     

                  It's not an issue of getting a vanilla DMA to transfer a bunch of data... that I have working. It's how do I keep from transferring the 4th byte of every dword.

                     

                  At this point, having to go back to an array of 3-byte structs is the only way to get rid of them, but that clobbers the efficiency of 32-bit.

                  • 6. Re: Need help with DMA
                    user_274749305

                    you need to look at doing your own component which is a variation of the SPIM.

                       

                     

                       

                    you can either use an 8 bit udb and add some simple verilog to drop every fourth byte or do a 32 bit wide udb set and only output the 24 bits.

                       

                     

                       

                    making a component with a custom 'flavor' is a large part of the PSoC way.

                       

                     

                       

                    -Ed

                    • 7. Re: Need help with DMA
                      user_1377889

                      The so called "Spoke"-width of a DMA-channel is 4 bytes or 2 bytes and can act as a 1byte wdth spoke. So for transferring 3 bytes as a single transaction to an 8-bit peripheral you will have to observe that the bottleneck will be within the peripheral. You cannot send at full DMA speed to your UDB since that (I think) will take some time for processing.

                         

                      What is the width of your UDB and where does the signal come from to burst one TD. Will you not (at least) display the DMA-channel and TD settings, my crystal ball just shows clouds ;-)

                         

                       

                         

                      Bob

                      • 8. Re: Need help with DMA
                        keith.kammler

                        Thanks guys,

                           

                        I just watched the videos on DMA and was noticing all the custom UDB and data path work. I'm getting the idea that's where I will wind up, so now I need some learning on how all that works.

                           

                        Does Cypress have any FAE's ?

                        • 9. Re: Need help with DMA
                          user_1377889

                          Oh, yes there are FAE in USA! Contact Robyn Weil (rbyn@cypress.com) and get help!

                             

                           

                             

                          Bob

                          • 10. Re: Need help with DMA
                            user_14586677

                            Yes each region has a FAE. In some the FAE is at the Manufacturers Rep.

                               

                            Contact local sales office/Rep.

                               

                             

                               

                                

                               

                                      http://www.cypress.com/?id=7

                               

                             

                               

                            Regards, Dana.