communication with cp210x

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

communication with cp210x

Postby Evaldas256 » 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:
  1. [Codebox=cpp file=Untitled.cpp]
  2. static void action_send_data(class_driver_t *driver_obj) {
  3.     uint8_t data_to_send[] = {0x02, 0x41, 0x01, 0xFF, 0x00, 0x41, 0x06};
  4.     size_t data_length = sizeof(data_to_send);
  5.  
  6.     usb_transfer_t* transfer = NULL;
  7.     esp_err_t result = usb_host_transfer_alloc(data_length, 0, &transfer);
  8.     if (result != ESP_OK) {
  9.         ESP_LOGE(TAG, "Failed to allocate transfer");
  10.         return;
  11.     }
  12.  
  13.     memcpy(transfer->data_buffer, data_to_send, data_length);
  14.     transfer->callback = cp210x_send_data_callback;
  15.     transfer->context = (void*)driver_obj;
  16.     transfer->num_bytes = data_length;
  17.     transfer->device_handle = driver_obj->dev_hdl;
  18.     transfer->bEndpointAddress = 0x01;
  19.     //ESP_ERROR_CHECK(usb_host_transfer_submit(transfer));
  20.     result = usb_host_transfer_submit(transfer);
  21.     if (result != ESP_OK) {
  22.         ESP_LOGE(TAG, "Failed to submit transfer: %d", result);
  23.         usb_host_transfer_free(transfer);
  24.     }
  25.    
  26.    
  27.     driver_obj->actions &= ~ACTION_SEND_DATA;
  28. }
[/Codebox]

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

Re: communication with cp210x

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

Did you try espressif usb host driver for cp210x?

https://github.com/espressif/esp-idf/bl ... /README.md

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

Re: communication with cp210x

Postby Evaldas256 » Thu Mar 28, 2024 5:11 am

I try to use USB CDC-ACM Virtual COM Port example, but getting this:

I (343) VCP example: Installing CDC-ACM driver
I (343) VCP example: Opening any VCP device...
I (5743) VCP example: Failed to open VCP device
I (5743) VCP example: Opening any VCP device...

So I searched more information and it seams CP210x does not working as CDC. The only one example was working for me was this USB_HOS_LIB. I started modify host code according cp210x AN571 datasheet and was able to read control endpoint 0, but to send problem appeared to send Bulk to endpoint. I also try to find some explanation about error 0x105."ESP_ERR_NOT_FOUND", but did not find any information.

User avatar
jgustavoam
Posts: 165
Joined: Thu Feb 01, 2018 2:43 pm
Location: Belo Horizonte , Brazil
Contact:

Re: communication with cp210x

Postby jgustavoam » Fri Apr 05, 2024 1:53 am

This device does not appear to be a CP2102.
CP2102 => VID: 0x10C4 and PID: 0xEA60 or 0xEA70

Reference:
https://www.silabs.com/documents/public ... /AN571.pdf

What device is it?
idVendor 0x10c4
idProduct 0x8056
Retired IBM Brasil
Electronic hobbyist since 1976.

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot] and 173 guests