communication with cp210x
Posted: Wed Mar 27, 2024 6:28 pm
I have problem with sending data to cp210x via USB.
I am able to read from control baudrate value, but is I send Bulk data to endpoint I am getting error 0x105."ESP_ERR_NOT_FOUND"
Does anybodu knows what does this error mean?
*** Device descriptor ***
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0x0
bDeviceSubClass 0x0
bDeviceProtocol 0x0
bMaxPacketSize0 64
idVendor 0x10c4
idProduct 0x8056
bcdDevice 1.00
iManufacturer 1
iProduct 2
iSerialNumber 3
bNumConfigurations 1
I (833) CLASS: Getting config descriptor
*** Configuration descriptor ***
bLength 9
bDescriptorType 2
wTotalLength 32
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
bMaxPower 300mA
*** Interface descriptor ***
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 0xff
bInterfaceSubClass 0x0
bInterfaceProtocol 0x0
iInterface 2
*** Endpoint descriptor ***
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 0x2 BULK
wMaxPacketSize 64
bInterval 0
*** Endpoint descriptor ***
bLength 7
bDescriptorType 5
bEndpointAddress 0x1 EP 1 OUT
bmAttributes 0x2 BULK
wMaxPacketSize 64
bInterval 0
My code:[/Codebox]
I am able to read from control baudrate value, but is I send Bulk data to endpoint I am getting error 0x105."ESP_ERR_NOT_FOUND"
Does anybodu knows what does this error mean?
*** Device descriptor ***
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0x0
bDeviceSubClass 0x0
bDeviceProtocol 0x0
bMaxPacketSize0 64
idVendor 0x10c4
idProduct 0x8056
bcdDevice 1.00
iManufacturer 1
iProduct 2
iSerialNumber 3
bNumConfigurations 1
I (833) CLASS: Getting config descriptor
*** Configuration descriptor ***
bLength 9
bDescriptorType 2
wTotalLength 32
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
bMaxPower 300mA
*** Interface descriptor ***
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 0xff
bInterfaceSubClass 0x0
bInterfaceProtocol 0x0
iInterface 2
*** Endpoint descriptor ***
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 0x2 BULK
wMaxPacketSize 64
bInterval 0
*** Endpoint descriptor ***
bLength 7
bDescriptorType 5
bEndpointAddress 0x1 EP 1 OUT
bmAttributes 0x2 BULK
wMaxPacketSize 64
bInterval 0
My code:
- [Codebox=cpp file=Untitled.cpp]
- static void action_send_data(class_driver_t *driver_obj) {
- uint8_t data_to_send[] = {0x02, 0x41, 0x01, 0xFF, 0x00, 0x41, 0x06};
- size_t data_length = sizeof(data_to_send);
- usb_transfer_t* transfer = NULL;
- esp_err_t result = usb_host_transfer_alloc(data_length, 0, &transfer);
- if (result != ESP_OK) {
- ESP_LOGE(TAG, "Failed to allocate transfer");
- return;
- }
- memcpy(transfer->data_buffer, data_to_send, data_length);
- transfer->callback = cp210x_send_data_callback;
- transfer->context = (void*)driver_obj;
- transfer->num_bytes = data_length;
- transfer->device_handle = driver_obj->dev_hdl;
- transfer->bEndpointAddress = 0x01;
- //ESP_ERROR_CHECK(usb_host_transfer_submit(transfer));
- result = usb_host_transfer_submit(transfer);
- if (result != ESP_OK) {
- ESP_LOGE(TAG, "Failed to submit transfer: %d", result);
- usb_host_transfer_free(transfer);
- }
- driver_obj->actions &= ~ACTION_SEND_DATA;
- }