USB Host In Transfer Failure

DerekdeClercq
Posts: 2
Joined: Wed Aug 23, 2023 5:08 pm

USB Host In Transfer Failure

Postby DerekdeClercq » Thu Aug 31, 2023 4:49 pm

Hi All

I am trying to setup a IN Transfer on a usb device in host mode.

The device looks as follows:
<code>
*** Device descriptor ***
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0x0
bDeviceSubClass 0x0
bDeviceProtocol 0x0
bMaxPacketSize0 8
idVendor 0x665
idProduct 0x5161
bcdDevice 0.00
iManufacturer 3
iProduct 1
iSerialNumber 0
bNumConfigurations 1
*** Configuration descriptor ***
bLength 9
bDescriptorType 2
wTotalLength 34
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
bMaxPower 100mA
*** Interface descriptor ***
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 0x3
bInterfaceSubClass 0x0
bInterfaceProtocol 0x0
iInterface 0
*** Endpoint descriptor ***
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 0x3 INT
wMaxPacketSize 8
bInterval 12
</code>

But my code keep on crashing on usb_host_transfer_submit.

This is what I have
<code>
ESP_ERROR_CHECK(usb_host_interface_claim(driver_obj.client_hdl,driver_obj.dev_hdl,0x81,0));

uint8_t ep_ms = 1024;
usb_transfer_t *in_xfer;
ESP_ERROR_CHECK(usb_host_transfer_alloc(ep_ms, 0, &in_xfer) );
in_xfer->device_handle = driver_obj.dev_hdl;
in_xfer->callback = in_xfer_done;
in_xfer->context = &driver_obj;
in_xfer->timeout_ms = 10000;
in_xfer->bEndpointAddress = 0x81;
in_xfer->num_bytes = ep_ms;

ESP_ERROR_CHECK( usb_host_transfer_submit(in_xfer));
</code>

if I trace the code I can see it fails in usbh.c in the usbh_ep_get_context method. Specifically this line:
<code>
//Check if the EP was allocated to begin with
if (pipe_hdl == NULL) {
ret = ESP_ERR_NOT_FOUND;
goto exit;
}
</code>

but I have no idea why, or what I am missing, Any suggestions would be greatly appreciated.

PS. I can do a out control transfer using usb_host_transfer_submit_control on the same device, so at least the client and device handles seem to be ok

NIANXIN30W
Posts: 8
Joined: Fri Sep 01, 2023 1:39 am

Re: USB Host In Transfer Failure

Postby NIANXIN30W » Sat Sep 02, 2023 9:00 am

I am also working on this recently. Do you use the demo of “usb_host_lib”? Is usb_host_transfer_submit() this function can be used for not only OUT transmission, but also IN transmission? Because I also want to receive the information returned by my USB device.

Thanks again!

Evaldas256
Posts: 3
Joined: Wed Mar 27, 2024 6:16 pm

Re: USB Host In Transfer Failure

Postby Evaldas256 » Wed Mar 27, 2024 6:48 pm

Hi,
I am also having error in usb_host_transfer_submit if I send data to BULK OUT endpoint.
Error "ESP_ERR_NOT_FOUND"
Have you found solution?

chegewara
Posts: 2240
Joined: Wed Jun 14, 2017 9:00 pm

Re: USB Host In Transfer Failure

Postby chegewara » Thu Mar 28, 2024 4:10 am

in_xfer->bEndpointAddress = 0x81;
It is long shot now, because i dont remember from top of my head. Please try

Code: Select all

in_xfer->bEndpointAddress = 0x1;
It is endpoint 1, and endpoint dir sets bit 7 or leave it 0.

Who is online

Users browsing this forum: Majestic-12 [Bot] and 178 guests