1 2 3 4 Previous Next 46 Replies Latest reply on Jun 19, 2019 1:13 AM by KandlaguntaR_36 Go to original post
      • 15. Re: CyU3PUsbSendEP0 Timeout issue
        leda_289486

        Hi

        Is there a solution to (re)set the CY_U3P_UIB_EEPM_EP_READY bit of  UIB->eepm_endpoint[0]  when this  bit stays at 0 all the time ?

        Because when this bit is stuck to 0, whatever the timeout value is programmed there is no way to send something on EP0 IN.

        How to retrieve the correct behavior after we are in this situation please ?

        Thank you for your help.

        Best regards

        • 16. Re: CyU3PUsbSendEP0 Timeout issue
          leda_289486

          Hi,

          so what can we do if CY_U3P_UIB_EEPM_EP_READY  never happens after CyU3PDmaChannelSendData ? how to reset this situation ?

          Is there a way to create case and have support ?

          Thank you for your help.

          Best Regards.

          • 17. Re: CyU3PUsbSendEP0 Timeout issue
            leda_289486

            Hi,

            I'd like to have some explaination about this CY_U3P_UIB_EEPM_EP_READY bit behavior. Is there some documentation for this ? It is the key point of the encountered problem. What can cause this bit to stay forever at 0 ?? How to reset to correct behavior ? Why the out ep0 hasn't a similar problem ?

            Thank you for your help,

            Best Regards

            • 18. Re: CyU3PUsbSendEP0 Timeout issue
              KandlaguntaR_36

              In your host application, you are doing BULK IN data transfer over EP3 (> 2 Gbps) and Vendor commands on EP0 IN.

               

              When the error happens, please print the following register values:

               

                 1. UIB->sck[0].status: 0xE004800C - 17:15 bits of register

                 2. CY_U3P_UIB_EEPM_EP_READY:  0xE0031C40 - 30 bit of this register

              Looks like you have checked the status of EEPM_EP_READY which is not ready.

              Please check the 1 and 2 again this time.

               

              How frequent you see this issue?

              Can you please send a Zero Length packet instead of two bytes and see if there is timeout error?

              Is it feasible to capture a USB trace either with software analyzer (Like USBLyzer) or hardware analyzer ( Like Lecroy)?

              • 19. Re: CyU3PUsbSendEP0 Timeout issue
                KandlaguntaR_36

                We cannot directly write to CY_U3P_UIB_EEPM_EP_READY and can only read this register in the firmware. Hardware can only do read, write.

                 

                • 20. Re: CyU3PUsbSendEP0 Timeout issue
                  leda_289486

                  hi,

                  here are a typical endpoint 0 error situation with a 2 transfer bytes. Errors appear at end of file. After that, nothing on EP0 IN. Capture has been done with UsbLyzer.

                  How frequent ? after typically 100 EP0 in requests, we are sure to be in this situation but it can happen after much less...

                  I check the value CY_U3P_UIB_EEPM_EP_READY indeed. But when it never comutes to "ready", I'd like to know what to do.

                  Best Regards,

                  • 21. Re: CyU3PUsbSendEP0 Timeout issue
                    leda_289486

                    Hi,

                    did you manage to read the usblyzer file ? What do you think about it ?

                    I have to switch to another process for 1 week since the current day, so if you'll answer next week, I'll make delayed answers.

                    Sorry for this, thank you for your help,

                    Best Regards

                    • 22. Re: CyU3PUsbSendEP0 Timeout issue
                      leda_289486

                      By the way, I also test a change in size count : from 2 bytes to maximum 512 bytes at each eP0 in transfer.

                      Doesn't affect the observed behavior.

                       

                      Best regards,

                      • 23. Re: CyU3PUsbSendEP0 Timeout issue
                        KandlaguntaR_36

                        As per the below code (copied from SDK 1.3.4 source code of CyU3PUsbSendEP0Data),

                        the while loop will exit after 500 ms delay and wait for CyU3PDmaChannelWaitForCompletion. If the DMAChannelWaitForComplettion time out for five times (5000 ms in total), then we go and reset the EP0 channel and flush the endpoint as well.

                        Please let me know what is the timeout for control Xfer you have set in the host application code.

                        Can you please set it as more than or equals to 5000 ms and check?

                         

                        if (glUibDeviceInfo.ackPending != CyFalse)

                                {

                                    uint32_t tmo = 500;     /* 500 ms delay is allowed. */

                         

                                    while ((((UIB->sck[0].status & CY_U3P_UIB_STATE_MASK) >> CY_U3P_UIB_STATE_POS) != CY_U3P_UIB_STATE_ACTIVE) ||

                                            ((UIB->eepm_endpoint[0] & CY_U3P_UIB_EEPM_EP_READY) == 0))

                                    {

                                        if (tmo == 0)

                                        {

                                            /* If the socket and EP state have not changed even after 500 ms, try to go ahead and push the data

                                               out. Errors from this transfer will be handled below.

                                             */

                                            break;

                                        }

                         

                                        CyU3PThreadSleep (1);

                                        tmo--;

                                    }

                         

                                    /* Clear the busy bit. */

                                    CyU3PUsbAckSetup ();

                                }

                        • 24. Re: CyU3PUsbSendEP0 Timeout issue
                          leda_289486

                          Hi,

                          thank you for this feedback. I'll try to proceed as you say.

                          In the host application code, the timeout was set to the maximum delay for an usb answer, ie 5000ms indeed.

                          However, you'll probably agree that 5s to send 2 bytes and triggers an error, there is a problem somewhere...

                          This delay is far far too long.

                          Furthermore when CY_U3P_UIB_EEPM_EP_READY bit is null, I guess the problem is not DMA but hardware in a maner of speaking.

                          Best Regards.

                          • 25. Re: CyU3PUsbSendEP0 Timeout issue
                            leda_289486

                            Hi

                            I've checked out the code : the timeout is set to 100 ms BUT the problem is not the DMA completion, it is the CY_U3P_UIB_EEPM_EP_READY bit that is not set. Again 100ms to send 2 bytes, I think this is far sufficient for this kind of timeout.

                            Is there any mean to reset this "not ready situation" ? When you say "reset the channel EP0 and reset as well" are these operations done in CyU3PUsbSendEP0Data when tmo == 0 ? If this is it, this doesn't flush anything and the bit is still at "Not ready" after. Have you a reliable sequence for this?

                            Thank you for your help,

                            Best Regards.

                            • 26. Re: CyU3PUsbSendEP0 Timeout issue
                              leda_289486

                              Hi,

                              any solution regarding the "hardware" not ready situation ?

                              Is there any means to reset this bit ?

                              Thank you for your help,

                              Best Regards.

                              • 27. Re: CyU3PUsbSendEP0 Timeout issue
                                KandlaguntaR_36

                                I am trying to find the solution for this.

                                Can you please let me know how did you confirm the CY_U3P_UIB_EEPM_EP_READY is set to 0?

                                 

                                • 28. Re: CyU3PUsbSendEP0 Timeout issue
                                  leda_289486

                                  When the (tmo==0) error triggers, I've added a debugprint message inside SendEP0 routine to confirm.

                                  As there are 2 possible conditions to trigger it, this is done to know which condition happens.

                                  Nothing else changed. here the position of debugprint inside the original code.

                                  Thank you for your help,

                                  Best Regards.

                                   

                                          /* Wait until the DMA socket and EPM are in ready state. */

                                          while (

                                          (((UIB->sck[0].status & CY_U3P_UIB_STATE_MASK) >> CY_U3P_UIB_STATE_POS) != CY_U3P_UIB_STATE_ACTIVE)

                                          ||

                                                  ((UIB->eepm_endpoint[0] & CY_U3P_UIB_EEPM_EP_READY) == 0)

                                                 )

                                          {

                                              if (tmo == 0)

                                              {

                                                  /* If the socket and EP state have not changed even after 500 ms, try to go ahead and push the data

                                                     out. Errors from this transfer will be handled below.

                                                   */

                                  CyU3PDebugPrint(4, "\r\ntmo error 0x%x 0x%x - should be 0x%x 0x%x ",

                                      ((UIB->sck[0].status & CY_U3P_UIB_STATE_MASK) >> CY_U3P_UIB_STATE_POS), (UIB->eepm_endpoint[0] & CY_U3P_UIB_EEPM_EP_READY),CY_U3P_UIB_STATE_ACTIVE,CY_U3P_UIB_EEPM_EP_READY );

                                  • 29. Re: CyU3PUsbSendEP0 Timeout issue
                                    leda_289486

                                    Hi,

                                    Have you look at the code including the error cause if imeout identifier ?

                                    Is it Ok ?

                                    Best Regards