my USB composite device:
- generic HID
- virtual COM
- custom class with interrupt IN, interrupt OUT and bulk IN endpoint
runs on MK22FN512VLL12. I use USB stack from SDK 2.1
The device communicates with host for several hours but then suddenly I get one of my custom class'es IN endpoints frozen in transfer state. For this frozen endpoint, endpoint state structure (in s_UsbDeviceKhciState structure) contains e.g.:
transferLength = 0x11
tranferDone = 0x00
state = 0x4040
It means that the endpoint is in transfer state waiting for host to read the data from the device.
My USB host (libusb library on Win 10) tries to read the data. However, the read function (libusb_interrupt_transfer or libusb_bulk_transfer) always timeouts with no data read. The USB_DeviceKhciIsrFunction is not executed when the transfer is initiated by the host.
There is no issue with data transfers from the host to the device on interrupt OUT endpoint, these always work, even when IN tranfers are frozen as described above.
To send data from the device to the host using interrupt IN or bulk IN endpoint I use USB_DeviceSendRequest() function. If this call succeeds I set my internal flag indicating that the transfer is in progress. Once callback function of the endpoint is called I clear the flag. I initiate next transfer only when the flag is cleared.
Can you please recommend how to troubleshoot this issue?