cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

New Contributor II

I am currently writing firmware to power a device which will be streaming video data over a custom data pipe using the CyAPI to a Windows machine.

The FW enumerates 2 separate devices on Windows, one for debug output and another for sending and receiving data (an IN/OUT EP, configured as BULK Manual).

I can successfully send and receive data, enumerate the device, and interact with the device when the device is powered on and connected. However, if I disconnect the device from the PC but *leave the power connected*, and then I reconnect the device, it does not properly get enumerated by the system.

Windows simply notes "Unknown USB Device (Device Descriptor Request Failed)" in the device manager. **HOWEVER** if I disconnect and reconnect AGAIN, the devices re-appear in the device manager.

So if I disconnect and reconnect TWICE consecutively, it reconnects properly. But it DOESN'T do so after only one reconnection.

And again, the power REMAINS connected the whole time!

I CAN get around this by simply calling "CyU3PDeviceReset()" if a disconnection event is encountered, but it is not an ideal solution.

Currently my USBEvent Callback looks like this:

switch (evtype)

{

case CY_U3P_USB_EVENT_SETCONF:

CyU3PUsbLPMDisable();

if (gl_IsMainApplnActive)

MainApplnStop();

MainApplnStart();

break;

case CY_U3P_USB_EVENT_RESET:

case CY_U3P_USB_EVENT_DISCONNECT:

if (gl_IsMainApplnActive)

MainApplnStop();

break;

default:

break;

}

Where MainApplnStart() and MainApplnStop() appropriately create/destroy the EP and DMA configurations.

Why is Windows noting that the Device Descriptor Request failed? Does the "...ApplnInit()" method get called on reconnection, where all of the CyU3PUsbDesc() calls occur?

0 Likes
Reply
1 Solution
Moderator
Moderator

Hello,

Please try the following:

1. When you get the event CY_U3P_USB_EVENT_DISCONNECT, implement the code as done in the function CyFxBulkSrcSinkApplnDeinit() inside the USBBulkSrcSink example found in FX3 SDK.

2. Check for another event CY_U3P_USB_EVENT_VBUS_VALID inside the USB Event Callback. If you receive this event, implement the code as done in the function CyFxBulkSrcSinkApplnInit() inside the USBBulkSrcSink example found in FX3 SDK.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna

View solution in original post

0 Likes
Reply
3 Replies
Moderator
Moderator

Hello,

Please let me know the following details:

1. Which cypress USB part are you using for your design?

2. Is the device Bus powered or Self Powered?

3. What is the boot source for the device?

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes
Reply
New Contributor II

Hello,

1. The Cypress FX3 w/ 512 KB RAM is being used.

2. The device is *NOT* Bus powered, it has an external power supply (perhaps this complicates disconnection reinitialization?). So when the USB connection is disconnected, the device is still powered.

3. The device will boot from SPI flash once the FW is finalized, but currently I am booting from RAM for quick debugging. I wrote a separate tool on Windows which detects resets and automatically uploads the FW when the FX3 bootloader is detected.

Currently the device re-enumerates fine if I force a full device reset when the Reset/Disconnect USB events are received. But I was wondering if there is a better way to re-enumerate and recover device connection without a full reset, when the device is externally/self-powered.

And to reiterate, the weird behavior is that the device enumerates fine WITHOUT a full reset after TWO disconnect/re-connect cycles. But it will NOT enumerate or be recognized by windows after only ONE disconnect/re-connect cycle.

0 Likes
Reply
Moderator
Moderator

Hello,

Please try the following:

1. When you get the event CY_U3P_USB_EVENT_DISCONNECT, implement the code as done in the function CyFxBulkSrcSinkApplnDeinit() inside the USBBulkSrcSink example found in FX3 SDK.

2. Check for another event CY_U3P_USB_EVENT_VBUS_VALID inside the USB Event Callback. If you receive this event, implement the code as done in the function CyFxBulkSrcSinkApplnInit() inside the USBBulkSrcSink example found in FX3 SDK.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna

View solution in original post

0 Likes
Reply