Hi,
I use this function to send data from my USB device to host PC on BULK IN endpoint:
usb_status_t USB_DeviceSendRequest(usb_device_handle handle, uint8_t endpointAddress, uint8_t *buffer, uint32_t length)
Host PC app reads data using libusb. The app can be suddenly switched off with data send request pending. When the app is launched again, it sends command to my USB device to cancel any pending requests (the app doesn't want to receive any old data, as they are invalid). So, my USB device calls:
usb_status_t USB_DeviceCancel(usb_device_handle handle, uint8_t endpointAddress)
on that BULK IN endpoint. It returns success.
However, when I start to send data on my BULK IN endpoint again, I can see that my app receives also old data from that cancelled request. I assume there is something wrong with USB_DeviceCancel.
How to use USB_DeviceCancel to correctly handle my scenario?
Solved! Go to Solution.
Fixed. I called USB_DeviceCancel without specifying endpoint direction on endpointAddress parameter. It is a little confusing that on other USB_DeviceXXX functions one doesn't have to specify the direction, but on USB_DeviceCancel it is needed. I didn't notice that till now...
Correct way is:
USB_DeviceCancel(myClassHandle->handle, myClassHandle->bulkIn.ep | (USB_IN << 7U));
Fixed. I called USB_DeviceCancel without specifying endpoint direction on endpointAddress parameter. It is a little confusing that on other USB_DeviceXXX functions one doesn't have to specify the direction, but on USB_DeviceCancel it is needed. I didn't notice that till now...
Correct way is:
USB_DeviceCancel(myClassHandle->handle, myClassHandle->bulkIn.ep | (USB_IN << 7U));
Hi,
Could you provided the chip part number and MCUXpresso SDK version?
Could you share your experience about how to regenerate this issue?
We want to do a test locally. Thank you.
Have a great day,
Mike
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------