5 Replies Latest reply on Oct 21, 2020 8:07 PM by JayakrishnaT_76

    USB data transfer aborts intermittently

    SaSa_4159646

      We have devices that have embedded Aptina image sensor and EZ USB FX3 chips. These devices connect to host Win 10 PCs using USB 3.0. Typically these devices transmit image data continuously using USB to the PC for about an hour at a time. During this period we have noticed that occasionally (and unpredictably) the USB data transfer drops off without any obvious reason. We have ensured that the data cables are properly connected to the PCs i.e. no loose connection etc.

       

      The communication with the PC and our device is driven by a custom C# application that utilizes the CyUSB.dll (v1.2.3.0) obtained from the Cypress FX3 SDK 1.3.4 installation. This custom C# application has been in use for several years and we have used it to collect image data from these devices on Win 7 PCs without issues. Recently we have switched to Win 10 PCs since Win 7 is no longer supported. During this switch, we have started using Cypress SDK v1.3.4 (changed from v1.2.3 used on the Win 7 PCs) and CyUSB.dll v1.0.0.1 (changed from v1.2.3.0 used on the Win 7 PCs). A short code snippet for this asynchronous I/O communication is attached (CypressIssueCodeSnippet.txt).

       

      Looking at the code snippet and our error logs, the issue appears to happen during calls to the WaitForXfer function. The USB communication occasionally drops off at this point and we receive the “Aborting USB Transfer” message in our error log.

       

      Could you please suggest what may be going wrong and how to fix it or narrow down the exact problem? Are there any known compatibility issues with Win 10/Cypress SDK 1.3.4 that may be causing this?

        • 1. Re: USB data transfer aborts intermittently
          JayakrishnaT_76

          Hello,

           

          Please find my understanding of your query below:

           

          1. On a Windows 7 PC, you were able to stream data correctly with your custom firmware and C# Application. For Windows 7 PC:

          a. FX3 SDK version: 1.2.3

          b. CyUSB.dll version: 1.2.3.0

           

          2. On a Windows 10 PC, you are not able to stream data correctly with your custom firmware and C# Application. For Windows 10 PC:

          a. FX3 SDK version: 1.3.4

          b. CyUSB.dll version: 1.0.0.1

           

          Please correct me if my understanding is wrong. If my understanding is correct, then please try the following:

          1. Use CyUSB.dll v1.2.3.0 for Windows 10 PC also. The dll can be found in the following location of FX3 SDK:

          C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\library\c_sharp\lib

           

          2. If (1) does not help or if my understanding is wrong, please try increasing the timeout parameter of WaitForXfer method and let us know if you see any improvements.

          3. If both (1) and (2) does not help, please share the UART debug logs along with USB event logs to understand more details on this issue. For understanding how to obtain USB event logs, please refer to the SDK example USB Bulk Source Sink. The project can be found in the following location:

          C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\basic_examples\cyfxbulksrcsink

           

          Please print the USB event logs in the infinite for loop. Please le us know if you have any queries on this.

           

          Best Regards,

          Jayakrishna

          • 2. Re: USB data transfer aborts intermittently
            SaSa_4159646

            Thank you Jayakrishna for your email. On Win 7 PC, we are able to run correctly with FX3 SDK 1.2.3 and CyUSB.dll v1.0.0.1. On upgrading both to versions to FX3 SDK 1.3.4 and CyUSB.dll 1.2.3.0 for Win 10, we see issues. We tried rolling back the FX3 SDK version to v1.2.3 from v1.3.4 on the Win 10 but still saw the issues (not sure if v1.2.3 works with Win 10?).

             

            We will try increasing the timeout parameter as you have suggested and try to get the USB logs out using the example you sent.

             

            Thanks,

            Sarad

            • 3. Re: USB data transfer aborts intermittently
              JayakrishnaT_76

              Hello Sarad,

               

              Thanks for the update. I understand that with the firmware built using FX3 SDK 1.3.4 and using CyUSB.dll v1.2.3.0 for the host application, you are facing issues on Win10 PC. We do not recommend using an older version of FX3 SDK for development. So you can use SDK 1.3.4 itself. Please share a snapshot of the Project Properties so that I can double check if the Build variable is 1_3_4. This can be done by right clicking on the Project in the Project Explorer menu of EZ-USB Suite and selecting Properties. In properties, select the drop down C/C++ Build and select Build Variables. A snapshot of the same is given below for your reference:

               

               

              Please share a snapshot of the same of your project.

               

              Can you please let me know which firmware you are using for the tests? Is it the one mentioned in the following thread?

              FX3 / CX3 Firmware for Streaming RAW Image Data using Cypress Driver

               

              Also, in addition to the tests that I recommended in my previous response, please try testing the firmware by running the streamer application (C#). This application comes along with FX3 SDK and can be found in the following location:

              C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\application\c_sharp\streamer\bin\Debug

               

              Please share a snapshot of the streamer application after running it for a while. If streamer reports a failure, then there can be some problems in the firmware. This test will help us to isolate the cause of the problem i.e if it is a firmware problem or if it is a problem on the host application.

               

              Best Regards,

              Jayakrishna

              • 4. Re: USB data transfer aborts intermittently
                SaSa_4159646

                Hi Jayakrishna,

                 

                Thanks for your email. We are working on gathering the answers to the questions you asked in your last email. Meanwhile I would like to share some wireshark generated snapshots of the usb data transfer in progress. We set up wireshark to monitor usb data transmission while our device was sending images to the host Win 10 PC. As we mentioned previously our issue appears sporadically and unpredictably i.e. sometimes we don’t seem to get any failures and at other times the data transmission stops abruptly. When we see an error where the data transfer stops abruptly, we have noticed a URB_FUNCTION_PIPE_ERROR on wireshark.

                 

                I am sharing a few snapshots here with you to see if you can provide more insight on why this may be happening?

                 

                Thanks,

                Sarad

                 

                Designing better care.™

                 

                Saradwata Sarkar

                Midmark Corporation| D: 310.516.5129 | C: 732.476.7812

                • 5. Re: USB data transfer aborts intermittently
                  JayakrishnaT_76

                  Hello,

                   

                  As mentioned in the following link, transfers can fail due to various reasons, such as a stall condition in the endpoint. If the transfer fails, the associated pipe cannot process requests until the error condition is cleared.

                  How to recover from USB pipe errors - Windows drivers | Microsoft Docs

                   

                  We need to understand what caused the transfer to fail. For this, please let me know which firmware is used as the base for your development. Is it the one mentioned in the following link?

                  FX3 / CX3 Firmware for Streaming RAW Image Data using Cypress Driver

                   

                  Please let us know if you have a hardware protocol analyzer like Lecroy for debugging. If not, we will try to debug the issue by looking into the Wireshark traces, UART traces and the firmware. As I understood that the failure does not occur every time and is random in nature, please share me the UART debug logs and wireshark traces (from the start of streaming) along with the firmware so that I can debug the issue better.

                   

                  Best Regards,

                  Jayakrishna