timeout problems

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
qiko_3575871
Level 3
Level 3

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!

0 Likes
1 Solution

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

View solution in original post

0 Likes
3 Replies
SrinathS_16
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

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

0 Likes

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.

0 Likes

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

0 Likes