You are here

C++ API hangs on Open() after a hard disconnect | Cypress Semiconductor

C++ API hangs on Open() after a hard disconnect

Summary: 1 Reply, Latest post by scutifer on 23 Jul 2014 12:34 PM PDT
Verified Answers: 0
Last post
Log in to post new comments.
msowa's picture
1 post


I am using the C++ CyAPI.lib to communicate with an FX3, and have implemented a disconnect detection routine using a message window and passing that handle to the CCyUSBDevice constructor. I can detect disconnect events (I'm physically disconnecting the USB cable), during which I raise a flag that causes my data streaming thread to stop and disconnect from USB, and I dispose of all the objects related to the Cypress driver.


However, I am finding that when I go to reconnect to the driver, my program hangs on CCyUSBDevice::Open() after calling it several times. The CCyUSBDevice has already been deleted and reallocated, I have tried calling Reset() before opening it again, checking the status of IsOpen() to see if it was left in an invalid state, and checking UsbdStatus and NtStatus for errors.


Is there anything else I can check on the CCyUSBDevice object that would tell me if there is something that needs to be reset or handled before I can resume normal operations?




scutifer's picture
Cypress Employee
134 posts

 The CCyUSBDevice::Open function first tries to get a handle to the device and then does a lot of control transfers to get various descriptors from the device.


Either of these procedures may have failed. Now, we use FILE_FLAG_OVERLAPPED during CreateFile and so this call shouldn't ideally hang. So, the other culprit is the control request to the device.

Check if the device can respond to control requests properly.


If none of these work out, load the CyAPI.cpp file (which you get from into your project. put a breakpoint inside ::Open() and then step through to see where the control hangs.

Log in to post new comments.