Disconnection event from LibUSB

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

cross mob
KePa_4784036
Level 3
Level 3
First like given First solution authored 25 sign-ins

Hi Cypress team,

I'm using your FX3 USB3 controller with a software that uses LibUSB. So far, I'm able to communicate without any problem by using the BULK transfers with Auto DMA. My code is mostly the CyFxSlFifoSync adapted with WinUSB.

Right now, I have a problem where the FX3 device doesn't reenumerate automatically whenever I restart my software. I found the code example AN73609 which is obsolete but still seems to follow my procedure on my software side.

I don't know if there is an event that I should receive on the Cypress firmware side to parse into and reset the communication by calling the CyU3PConnectState sequence whenever I exit my connection with libusb_exit.

I tried to handle the problem by sending a control transfer to call the CyU3PConnectState sequence but there seems to be a competetion between both the firmware and the software side. In other words, my software need the connection to still be opened to close correctly but I still need to send the reset of the communication accordingly.

If you have any ideas of how I should handle it, please let me know 😄

Thank you,

Keven

 

 

0 Likes
1 Solution
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello Keven,

From the description, I understand that you want to re enumerate the device when the host application is closed. Is that correct?

 If yes, please check if CLEAR_FEATURE request is sent from the host when the host application is closed. If the request is received by the device, you can handle the request according to your application.

Regards,
Rashi

View solution in original post

0 Likes
3 Replies
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello Keven,

From the description, I understand that you want to re enumerate the device when the host application is closed. Is that correct?

 If yes, please check if CLEAR_FEATURE request is sent from the host when the host application is closed. If the request is received by the device, you can handle the request according to your application.

Regards,
Rashi
0 Likes
KePa_4784036
Level 3
Level 3
First like given First solution authored 25 sign-ins

Hi,

Yes! This is exactly what I'm trying to do. I also checked if the CLEAR_FEATURE in the CyFxSlFifoApplnUSBSetupCB was called but it wasn't :

 

if ((bTarget == CY_U3P_USB_TARGET_ENDPT) && (bRequest == CY_U3P_USB_SC_CLEAR_FEATURE) && (wValue == CY_U3P_USBX_FS_EP_HALT))

 

However, I reviewed my host application code and it seems like I needed to add the libusb_reset_device. By doing so, the CLEAR_FEATURE was called and by adding the modifications stated earlier, it reenumerated the device as I wanted to.

Thanks a lot for the help :D,

Keven

0 Likes

Hi Keven,

Glad to hear that the problem was resolved!

Regards,
Rashi
0 Likes