4 Replies Latest reply on Mar 12, 2014 5:37 AM by mudabir.kabir.a

    CyU3PUsbSendEP0Data fail on Timeout

    sagi.sela

       Hi,

         

      I'm working with the FX3, Slave fifo setup, Control EP(0) and bulk in EP.

         

      I start read data from the Bulk EP and at the same time work with the Control EP. After few transactions the CyU3PUsbSendEP0Data function fails with CY_U3P_ERROR_TIMEOUT error code. From that time all calls to CyU3PUsbSendEP0Data fails. The control OUT direction continue to work. The situation appears more frequently when the FX3 device connect to USB2 port (host side).

         

      I use SDK 1.3.1.

         

      Thanks!

        • 1. Re: CyU3PUsbSendEP0Data fail on Timeout
          1.2

           who can solve,I encountered a similar problem

          • 2. Re: CyU3PUsbSendEP0Data fail on Timeout
            laim.maskey
                    Hi, I am seeing a similar problem where EP0 IN fails to send data to the PC yet EP0 OUT from the PC is working fine. Is there a way to recover from this problem.   
            • 3. Re: CyU3PUsbSendEP0Data fail on Timeout
              content.librarian

               Hi,

                 

              how is the transmitted data size? Is it may be a multiple of USB packet size (512 bytes while connected to high speed and 1024 bytes when connected to super speed when transfer timeouts?

                 

               

                 

              Or are you sure, that host PC has preloaded an URB for the control transfer?

                 

              regards,

                 

              lumpi

              • 4. Re: CyU3PUsbSendEP0Data fail on Timeout
                mudabir.kabir.a

                 Hi,

                   

                When operating at USB 2.0 speeds, we have observed bulk IN transfers sometimes create errors during control IN transfers when both happen in parallel. To avoid this possibility, ensure that the bulk channel is suspended for the duration of the control request and resume it once control request is completed.

                   

                Here is how you can do it.

                   

                When configuring the DMA channel, enable callback with callback notification = CY_U3P_DMA_CB_CONS_SUSP. This will generate a callback whenever channel is successfully suspended.

                   

                In the CyFxApplnUSBSetupCB  function, 

                   

                if (bType == CY_U3P_USB_VENDOR_RQT)

                   

                    {

                   

                        if (bRequest == <your Control-IN request code>)

                   

                        {

                   

                          

                   

                            if (CyU3PUsbGetSpeed () != CY_U3P_SUPER_SPEED)

                   

                            {

                   

                                /* Suspend the Bulk pipe and wait until it suspends. */

                   

                                glChannelSuspended = CyFalse;

                   

                                CyU3PDmaChannelSetSuspend (&glDmaChHandle, CY_U3P_DMA_SCK_SUSP_NONE, CY_U3P_DMA_SCK_SUSP_CUR_BUF); // Note that this function returns immediately and the channel suspension is confirmed when callback function is invoked.

                   

                                while ((!glChannelSuspended) && (timeout--)) // glChannelSuspended is set to true in the                       DMA channel callback function

                   

                                    CyU3PThreadSleep (1);

                   

                            }

                   


                   

                            glEp0Buffer[0] = vendorRqtCnt;

                   

                            glEp0Buffer[1] = underrunCnt;

                   

                            glEp0Buffer[2] = 1;

                   

                            glEp0Buffer[3] = 2;

                   

                            CyU3PUsbSendEP0Data (wLength, glEp0Buffer); // Control IN transfer

                   

                            vendorRqtCnt++;

                   

                            isHandled = CyTrue;

                   

                CyU3PDmaChannelResume ( &glDmaChHandlee, CyBool_t isProdResume, CyBool_t isConsResume ) // Resume the suspended BULK-in channel

                   

                        }

                   

                    }

                   

                 

                   


                   

                note: Refer GpifToUsb example project in basic_examples section in FX3 SDK where this problem is dealt with.

                   

                 

                   

                Regards

                   

                Mudabir Kabir