ReadInput() function is not blocking as documented

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

cross mob
user_1788001
Level 1
Level 1
First like received

Hi,

I am implementing a simple USB command response interface for the PsoC 4 board I designed. I have it working but only through a nasty workaround.

In the CyUSB,NET document it states that ReadInput() will indefinitely hang until a input report is received. I immediately noted that it

does not hang but simply reports a packet of all zeroes. To make it work I had to add a Thread sleep of 16 or greater ms after the WriteOutput() function

sends a command.  My device has a generic HID interface with 8 byte packets. This fix is problematic because of varying times for the device

to send it's response. Sometimes, I have to wait 32, 48 or even 64ms to receive a valid response.

Why does ReadInput() not block as stated ? Also, is there another function I can call to guarantee the response packet has been received  before I post

a ReadInput() ? I noticed there is a WaitForXfer function in the EndPoint class hierarchy. But nothing like that for CyHIDDevice.

Regards,

Chuck

0 Likes
7 Replies