3 Replies Latest reply on Sep 10, 2018 11:10 PM by abga

    timeout problems

    water.zch_3575871

      Could somebody give me a help.

       

      I want to set the timeout of BulkInEndPt, but it seems that it doesn't work normally.

      For example, I set timeout to 5ms, m_pCyUSBDevice->BulkInEndPt->TimeOut = 5;

      If XferData returns and fails, it takes about 55ms. I think It should be 5ms or just a little more than 5ms. Am I wrong?

       

      And if XferData returns and succeeds, if will takes much more than 5ms sometimes. I think it should be timeout.

       

      What's more, I repeat reading data from USB device, and I am sure USB device have data, but it will stop reading data for more than 30ms sometimes. I find it by wireshark.

       

      Thanks!

        • 1. Re: timeout problems
          srnt

          Hello,

           

          - Please explain how you have confirmed the timeout value.

          - Kindly, share USB traces captured using a protocol analyzer to debug.

           

          Best regards,

          Srinath S

          • 2. Re: timeout problems
            water.zch_3575871

            I use QTime::currentTime to record the time,and then call XferData to read data from USB Device. After XferData returns, I use QTime::currentTime to substract the time I recorded before. That is the mothed to confirm the timeout value.

            • 3. Re: timeout problems
              abga

              Hi,

               

              Try to measure the function time using clock(). Here is the snippet of the code:

               

              #include <time.h>

                

                clock_t start, end;

                double cpu_time_used;

                

                start = clock();

                ... /* Do the work. */

                end = clock();

                cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;

               

              Please test and update on the forum.

               

              Thanks & Regards

              Abhinav