1 2 3 Previous Next 35 Replies Latest reply on Dec 3, 2019 4:22 AM by JayakrishnaT_76

    Data transfer from U to P port

    poas_4520791

      Hi,

       

      I'm using Fx3 and i have created 3 DMA channels-USB to CPU,CPU to P port,P port to USB.In the first DMA channel whatever the callback function i'm calling  in that i'm able to get the data.But in the CPU to P Port DMA channel i'm not able to receive the data that i got in first DMA channel.

      Can any one help me out to do this.

       

      Best Regards,

      Aswini

        • 1. Re: Data transfer from U to P port
          JayakrishnaT_76

          Hello Aswini,

           

          Please Answer my following questions:

          1.Please let me know what is the application?

          2.Why do you want 3 DMA buffers?

          3.According to my understanding, you send some data from U port to CPU. You need to do some modifications to the buffer obtained and send it from CPU to P port. Am i correct with this or is there any difference?

           

          Best Regards,

          Jayakrishna

          • 2. Re: Data transfer from U to P port
            poas_4520791

            Hello,

             

            Yeah,i sent some data from U port to  CPU,but in CPU to P port DMA channel i have declared one callback function in that i should receive data but i'm not getting there.May i know the reason for this?

             

             

             

             

             

            Best Regards,

            Aswini

            • 3. Re: Data transfer from U to P port
              JayakrishnaT_76

              Hello,

               

              Please send me a snapshot of the DMA channel configuration for CPU to P port and U port to CPU.

               

              Best Regards,

              Jayakrishna

              • 4. Re: Data transfer from U to P port
                poas_4520791

                Hello,

                 

                Here is the snapshot of DMA channel configuration,21.PNG

                 

                 

                 

                Regards,

                Aswini

                • 5. Re: Data transfer from U to P port
                  JayakrishnaT_76

                  Hello,

                   

                  I find that in the DMA channel between CPU Socket and P Port Socket, the callback is triggered only when the CY_U3P_DMA_CB_CONS_EVENT occurs. This means that it will occur only when the data send out by the CPU is consumed by the P Port, the callback function will be invoked. Please check whether you have connected a device to the P Port and whether it is getting data or not.

                  Please let me know your application.

                   

                  Best Regards,

                  Jayakrishna

                  • 6. Re: Data transfer from U to P port
                    poas_4520791

                    Hello,

                     

                    The callback is not triggered because the data isn't sending to P port. I just gave consumer socket as P port and is there any other way to check whether the device is connected to P port or not.

                    Can you please  let me know.

                     

                    Regards,

                    Aswini

                    • 7. Re: Data transfer from U to P port
                      JayakrishnaT_76

                      Hello,

                       

                      Can you please share your project.

                      Also please let me know what do you wish to do by creating a channel between U port to CPU and between CPU to P port. This can help me debug the issue quickly.

                       

                      Best Regards,

                      Jayakrishna

                      • 8. Re: Data transfer from U to P port
                        poas_4520791

                        Hello,

                         

                        By using  U port to CPU and CPU to P port DMA channels and  callback functions i should able to transfer data to P port.

                        currently i'm using Microsoft visual studio 2017 through this software i'm trying to check the output and with 1st DMA channel (U port to CPU )everything is fine.Now i should get the data in the 2nd(CPU to P port) dma channel call back function.

                        kindly let me know the solution for this.

                         

                        Regards,

                        Aswini

                        • 9. Re: Data transfer from U to P port
                          JayakrishnaT_76

                          Hello,

                           

                          I understand your final aim is to get a data transferred from U port to P port. You can do it directly by creating a DMA Manual channel between USB Socket and P Port Socket. In this case, whenever you receive a buffer from the Host(PC), a DMA callback can be triggered. In the DMA call back function, you can perform the required operations on the buffer and then commit the buffer to P Port. Please let me know whether this is what you want.

                           

                          Best regards,

                          Jayakrishna

                          • 10. Re: Data transfer from U to P port
                            poas_4520791

                            Hello,

                             

                            Yeah,that's  what my application.If i use only  2 dma channels i.e., from USB to P port and P port to USB what will be the end points.Currently i'm using 3 endpoints i.e., 2 IN and 1 OUT.Now i should use only 1 IN and 1 OUT endpoint right?

                            The other question is in the callback function i should create a buffer and in that buffer i should able to  get the data.

                            If anything wrong in the above lines kindly let me know.

                             

                            Regards,

                            Aswini

                            • 11. Re: Data transfer from U to P port
                              JayakrishnaT_76

                              Hello Aswini,

                               

                              Yes, when you use 2 DMA channels, one should be IN endpoint which is used by the HOST to read data from FX3 through U port. The other should be OUT endpoint which is used by the host to write to the U port. For the transfer between U port and P Port, you can create a DMA channel with the following configuration:

                                  dmaCfg.size  = DMA_BUF_SIZE* size;

                                  dmaCfg.count = CY_FX_SLFIFO_DMA_BUF_COUNT_U_2_P;

                                  dmaCfg.prodSckId = CY_FX_PRODUCER_USB_SOCKET;

                                  dmaCfg.consSckId = CY_FX_CONSUMER_PPORT_SOCKET;

                                  dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;

                                  /* Enabling the callback for produce event. */

                                  dmaCfg.notification = CY_U3P_DMA_CB_PROD_EVENT;

                                  dmaCfg.cb = CyFxSlFifoUtoPDmaCallback;

                                  dmaCfg.prodHeader = 0;

                                  dmaCfg.prodFooter = 0;

                                  dmaCfg.consHeader = 0;

                                  dmaCfg.prodAvailCount = 0;

                               

                               

                                  apiRetStatus = CyU3PDmaChannelCreate (&glChHandleSlFifoUtoP, CY_U3P_DMA_TYPE_MANUAL, &dmaCfg);

                                  if (apiRetStatus != CY_U3P_SUCCESS)

                                  {

                                      CyU3PDebugPrint (4, "CyU3PDmaChannelCreate failed, Error code = %d\n", apiRetStatus);

                                      CyFxAppErrorHandler(apiRetStatus);

                                  }

                              This creates a DMA Manual Channel between U Port and P Port. The Buffer size will be DMA_BUF_SIZE* size and there will be CY_FX_SLFIFO_DMA_BUF_COUNT_U_2_P number of such buffers. When the U Port fill one of such buffer, you will get a prod event. This will call the callback function CyFxSlFifoUtoPDmaCallback. Inside the callback function you can modify the received buffer as required in your application. Then you can commit the modified buffer to P Port.

                               

                              We have an Application Note AN65974 which talks about the Slave FIFO interface using FX3. There is an attached project with this Application Note. In that project, we have configured 2 DMA channels one from P Port to U Port and other from U Port to P Port. Please refer to the project in the application note to find out how the DMA channels are created and how the buffers are committed upon receiving the PROD Events. The link to the application note is given below:

                               

                              https://www.cypress.com/documentation/application-notes/an65974-designing-ez-usb-fx3-slave-fifo-interface

                               

                              Best Regards,

                              Jayakrishna

                              • 12. Re: Data transfer from U to P port
                                poas_4520791

                                Hello,

                                 

                                I tried the code that is there in the (AN65974)  above link.but In visual studio i got the issue as shown belowvs.PNG

                                 

                                 

                                Regards,

                                Aswini

                                • 13. Re: Data transfer from U to P port
                                  JayakrishnaT_76

                                  Hello,

                                   

                                  Please let me know why you are using visual studio?

                                   

                                  Best Regards,

                                  Jayakrishna

                                  • 14. Re: Data transfer from U to P port
                                    poas_4520791

                                    Hello,

                                     

                                    I  have to select a file in visual studio through that only i can able to get data to U port and CPU ,so i'm using this.

                                    why can't i use 2 DMA channels U port to CPU and CPU to P port and what may be the reason for not receiving data in CPU to P port DMA channel.

                                     

                                     

                                    Regards,

                                    Aswini

                                    1 2 3 Previous Next