USB data request cancel

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

USB data request cancel

ソリューションへジャンプ
1,981件の閲覧回数
martindusek
Contributor V

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?

ラベル(2)
タグ(1)
0 件の賞賛
返信
1 解決策
1,837件の閲覧回数
martindusek
Contributor V

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));

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,838件の閲覧回数
martindusek
Contributor V

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));

0 件の賞賛
返信
1,837件の閲覧回数
Hui_Ma
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信