who can solve，I encountered a similar problem
Hi, I am seeing a similar problem where EP0 IN fails to send data to the PC yet EP0 OUT from the PC is working fine. Is there a way to recover from this problem.
how is the transmitted data size? Is it may be a multiple of USB packet size (512 bytes while connected to high speed and 1024 bytes when connected to super speed when transfer timeouts?
Or are you sure, that host PC has preloaded an URB for the control transfer?
When operating at USB 2.0 speeds, we have observed bulk IN transfers sometimes create errors during control IN transfers when both happen in parallel. To avoid this possibility, ensure that the bulk channel is suspended for the duration of the control request and resume it once control request is completed.
Here is how you can do it.
When configuring the DMA channel, enable callback with callback notification = CY_U3P_DMA_CB_CONS_SUSP. This will generate a callback whenever channel is successfully suspended.
In the CyFxApplnUSBSetupCB function,
if (bType == CY_U3P_USB_VENDOR_RQT)
if (bRequest == <your Control-IN request code>)
if (CyU3PUsbGetSpeed () != CY_U3P_SUPER_SPEED)
/* Suspend the Bulk pipe and wait until it suspends. */
glChannelSuspended = CyFalse;
CyU3PDmaChannelSetSuspend (&glDmaChHandle, CY_U3P_DMA_SCK_SUSP_NONE, CY_U3P_DMA_SCK_SUSP_CUR_BUF); // Note that this function returns immediately and the channel suspension is confirmed when callback function is invoked.
while ((!glChannelSuspended) && (timeout--)) // glChannelSuspended is set to true in the DMA channel callback function
glEp0Buffer = vendorRqtCnt;
glEp0Buffer = underrunCnt;
glEp0Buffer = 1;
glEp0Buffer = 2;
CyU3PUsbSendEP0Data (wLength, glEp0Buffer); // Control IN transfer
isHandled = CyTrue;
CyU3PDmaChannelResume ( &glDmaChHandlee, CyBool_t isProdResume, CyBool_t isConsResume ) // Resume the suspended BULK-in channel
note: Refer GpifToUsb example project in basic_examples section in FX3 SDK where this problem is dealt with.