1 2 Previous Next 25 Replies Latest reply on Apr 20, 2020 3:16 AM by RashiV_61

    FX3: how to process the CYU3P_USBEP_SS_SEQERR_EVT endpoint event

    ThCo_999361

      We are using the FX3 in a camera application, with firmware based on the AN75779 application, built using the SDK 1.3.4. The product has been shipping for well over a year now.

       

      We get occasional reports from customers of the video stream from the camera not starting in USB 3.0. We have identified a particular host device used with our camera that this no video case happens infrequently. We have successfully reproduced it in house. When the no video occurs we get a CYU3P_USBEP_SS_SEQERR_EVT on the video IN endpoint when we start the stream. I could not find any example in the various FX3 projects provided by Cypress on how to respond to this error event. I did try calling CyU3PUsbStall (epNum, CyTrue, CyFalse) for this SEQERR_EVT, but that did not clear the condition.

       

      How does one process the CYU3P_USBEP_SS_SEQERR_EVT endpoint event?

       

      Thanks in advance for your help on this.

       

      Tom

        • 1. Re: FX3: how to process the CYU3P_USBEP_SS_SEQERR_EVT endpoint event
          RashiV_61

          Hello Tom,

           

          CYU3P_USBEP_SS_SEQERR_EVT event : Sequence number error detected during endpoint data transfer.

           

          Please confirm are you getting  CYU3P_USBEP_SS_RESET_EVT after multiple CYU3P_USBEP_SS_SEQERR_EVT event

          If you are getting   CYU3P_USBEP_SS_RESET_EVT , you can handle this event as done in GpifToUsb example of the SDK. The CYU3P_USBEP_SS_RESET_EVT is handled by CyU3PUsbStall (epNum, CyTrue, CyFalse). On identifying the endpoint stall, the host application should issue CLEAR_FEATURE request. This request should be handled in the firmware as done in GpifToUsb example

           

          Snippet from GpifToUSb firmware

               if ((bTarget == CY_U3P_USB_TARGET_ENDPT) && (bRequest == CY_U3P_USB_SC_CLEAR_FEATURE)

                          && (wValue == CY_U3P_USBX_FS_EP_HALT))

                  {

                      if (glIsApplnActive)

                      {

                          if (wIndex == CY_FX_EP_CONSUMER)

                          {

                              CyU3PUsbSetEpNak (CY_FX_EP_CONSUMER, CyTrue);

                              CyU3PBusyWait (125);

           

                              CyU3PDmaChannelReset (&glDmaChHandle);

                              CyU3PUsbFlushEp(CY_FX_EP_CONSUMER);

                              CyU3PUsbResetEp (CY_FX_EP_CONSUMER);

                              CyU3PDmaChannelSetXfer (&glDmaChHandle, CY_FX_GPIFTOUSB_DMA_TX_SIZE);

                             CyU3PUsbStall (wIndex, CyFalse, CyTrue);

           

                              CyU3PUsbSetEpNak (CY_FX_EP_CONSUMER, CyFalse);

                              isHandled = CyTrue;

                              CyU3PUsbAckSetup ();

                          }

           

          Regards,

          Rashi

          1 of 1 people found this helpful
          • 2. Re: FX3: how to process the CYU3P_USBEP_SS_SEQERR_EVT endpoint event
            ThCo_999361

            Rashi,

             

            I see one, maybe two, CYU3P_USBEP_SS_SEQERR_EVT events when the video stream does not start. I do not see any CYU3P_USBEP_SS_RESET_EVT events when I get the CYU3P_USBEP_SS_SEQERR_EVT.

             

            We previously added the code from the GpifToUsb example to handle CYU3P_USBEP_SS_RESET_EVT events and the CLEAR FEATURE. That is working correctly.

             

            Tom

            • 3. Re: FX3: how to process the CYU3P_USBEP_SS_SEQERR_EVT endpoint event
              RashiV_61

              Hello Tom,

               

              Can you try handling CYU3P_USBEP_SS_SEQERR_EVT same as the  CYU3P_USBEP_SS_RESET_EVT is handled in GpifToUsb Example.

              The third parameter of the API CyU3PUsbStall is toggle which if  set to CyTrue Clear the data toggles in a Clear Stall call (i.e. when second parameter passed in CyFalse)

               

              CyU3PUsbStall (epnum, CyTrue, CyFalse); - called when the CYU3P_USBEP_SS_SEQERR_EVT event occurs

              CyU3PUsbStall (wIndex, CyFalse, CyTrue); should be called  on receiving CLEAR_FEATURE request from the host

               

              Regards,

              Rashi

               

              • 4. Re: FX3: how to process the CYU3P_USBEP_SS_SEQERR_EVT endpoint event
                ThCo_999361

                Hello Rashi,

                 

                I tried this suggestion, but it did not fix the no video issue. Do you have any other ideas?

                 

                Thanks,

                Tom

                • 5. Re: FX3: how to process the CYU3P_USBEP_SS_SEQERR_EVT endpoint event
                  RashiV_61

                  Hello Tom,

                   

                  Please probe  the USB lines when you get the CYU3P_USBEP_SS_SEQERR_EVT error and the endpoint is halted. 

                  You can take this traces using Lecroy USB Analyzer and share it here.

                   

                  Regards,

                  Rashi

                  • 6. Re: FX3: how to process the CYU3P_USBEP_SS_SEQERR_EVT endpoint event
                    ThCo_999361

                    Rashi,

                     

                    I was not able to get a capture with the Lecroy, but I did get a capture using the Beagle 5000. Attached. When I get the SEQERR the video stops. That is around index 913869.

                     

                    Regards,

                    Tom

                    • 7. Re: FX3: how to process the CYU3P_USBEP_SS_SEQERR_EVT endpoint event
                      RashiV_61

                      Hello Tom,

                       

                      Thank you the traces.

                      I tried to open .tdc file with AllCapture software but it says this in not the full project.

                      Can you share all the files of the project or let me know the software to open .tdc files

                       

                      Regards,

                      Rashi

                      • 8. Re: FX3: how to process the CYU3P_USBEP_SS_SEQERR_EVT endpoint event
                        ThCo_999361

                        Rashi,

                         

                        I used the Total Phase Data Center (v6.73.007) with the Beagle 5000 to capture the data. I downloaded back the zip file and was able to extract and load the .tdc file with Total Phase Data Center without any problems.

                         

                        Here is a link to the Total Phase Data Center:

                        https://www.totalphase.com/products/data-center/

                         

                        Regards,

                        Tom

                        • 9. Re: FX3: how to process the CYU3P_USBEP_SS_SEQERR_EVT endpoint event
                          RashiV_61

                          Hello Tom,

                           

                          I have gone through the trace you shared.

                          There is a ACK TP which is not expected from host , since we set EOB=1, due which the error. But later the data transfer recovers

                          ack.PNG

                          I have seen that the device sends the stall . Please confirm that this stall is called when the seq_err occurs

                          stall.PNG

                          After the stall is sent , the host should send the clear feature request which is not seen in the trace.

                          Please check that host application sends clear feature request

                           

                          Regards,

                          Rashi

                          • 10. Re: FX3: how to process the CYU3P_USBEP_SS_SEQERR_EVT endpoint event
                            WGT_4383351

                            "On identifying the endpoint stall, the host application should issue CLEAR_FEATURE request" How does a C# host detect that?

                            • 11. Re: FX3: how to process the CYU3P_USBEP_SS_SEQERR_EVT endpoint event
                              RashiV_61

                              Hello,

                               

                              The UsbdStatusString() is member of CyUsbDevice class

                              The UsbdStatusString method returns a string that represents the UsbdStatus error code contained in stat. The return string can be Success, pending, stalled or error.

                              When this return status is stalled, the host application needs to sends the clear feature request

                               

                              Regards,

                              Rashi

                              • 12. Re: FX3: how to process the CYU3P_USBEP_SS_SEQERR_EVT endpoint event
                                ThCo_999361

                                Rashi,

                                 

                                The duplicate ACK TP from the host results in the FX3 sending an NRDY followed by an ERDY. I looked in the statistics that the TPDC trace and there were 1791 NRDYs and 1791 ERDYs on EP3 in the 1.5 seconds that video flowed before the FX3 sent the STALL. The host seems to regularly send duplicate ACKs.

                                 

                                The STALL in the trace is not from my processing of the CYU3P_USBEP_SS_SEQERR_EVT - I don't generate a STALL on that event. I tried that in the past working on this issue and found that STALL did not correct anything.

                                 

                                The STALL in the trace is from my processing of a CYU3P_USBEP_SS_RETRY_EVT that I get prior to getting the CYU3P_USBEP_SS_SEQERR_EVTs. I did the STALL based on the example project in the SDK /basic_examples/cyfxbulksrcsink/cyfxbulksrcsink.c where the CYU3P_USBEP_SS_RETRY_EVT is used to generate a STALL. After researching what causes this retry event, I don't think a STALL is the proper response. I plan on changing my code to just log that event.

                                 

                                I looked in the TPDC trace I previously sent you for RETRYs. There is one at index 913927 (SeqNum=28) and another at 914058 (SeqNum=8). The original Data Transaction for this second retry is at index 914046. Upon looking at this packet closely, while the header has DataLength of 1024 bytes, it appears that 0 bytes of payload were sent out. Thus the retry request from the host for SeqNum = 8. Since the trace shows no payload, makes me think there is some memory use issue.

                                 

                                The "Unexpected" Link Credits in the trace seem odd too - I haven't seen them with other hosts.

                                 

                                I loaded my modified FX3 code where I don't generate a STALL for the CYU3P_USBEP_SS_RETRY_EVT. I took another trace of the USB transactions. I see five RETRYs followed by an NRDY, then ERDY, then no data transfer. I've uploaded this new TPDC trace.

                                 

                                The following index/transaction list include a sequence with RETRYs and data packet length issues in that new trace:

                                847564 Data, seq=15

                                847573 ACK seq=15, RETRY

                                847575 Data, seq=16

                                847580 Data, Length error, seq=17

                                847585 Data, Length error, EOB, seq=15

                                847590 Data, seq=16

                                847597 ACK seq=16

                                847601 Data, Length error, seq=17

                                847606 ACK seq=17

                                847614 Data, Length error, EOB, seq=18

                                847618 NRDY

                                847622 ACK seq=18

                                847626 ACK seq=18, RETRY

                                no more data transfer

                                 

                                It is disconcerting that there appears to be some memory corruption going on here.

                                 

                                Regards,

                                Tom

                                • 13. Re: FX3: how to process the CYU3P_USBEP_SS_SEQERR_EVT endpoint event
                                  RashiV_61

                                  Hello,

                                   

                                  Thank you for the update.

                                  Can you just handle the CYU3P_USBEP_SS_RESET_EVT, check if this comes (as it comes after multiple retry), in the firmware and stall the endpoint

                                  After that the host application should sends the clear feature request. This request clear feature should be handled in the firmware by clearing the stall as done i GPIFtoUSB example. When the stall condition is being cleared (in Clear feature handler) , the data toggles for the endpoint can also be cleared so this can be used to solve the issue of seq error

                                   

                                  Please take the usb traces when this is executed ans share the traces meanwhile i will go through the new traces you shared in the previous response

                                   

                                  Please refer the attachment. If possible try with different host and take the traces

                                   

                                  Regards,

                                  Rashi

                                  • 14. Re: FX3: how to process the CYU3P_USBEP_SS_SEQERR_EVT endpoint event
                                    ThCo_999361

                                    Rashi,

                                     

                                    The FX3 code used for the trace I sent you yesterday only handles the CYU3P_USBEP_SS_RESET_EVT - it ignores the other endpoint events.

                                     

                                    I have run this FX3 code against a Windows10 laptop and a MacBook Air. Both respond properly to the STALL from the FX3. I did not bother tracing that.

                                     

                                    The host that is not respond to the STALL from the FX3 is an Asus Chromebox running Google Hangouts.

                                     

                                    Tom

                                    1 2 Previous Next