-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
esp32s3 usb host example cdc_acm_bg96 receive some message repeatly (IDFGH-7027) #8645
Comments
Hello @zhuyeaini9 , thank you for reaching out to us. I can confirm that I reproduced the problem with FTDI 232RQ (PID: 0x6001), that is almost the same as your chip (comparison here) It is something FTDI specific, but I'll prepare an example how to handle this |
Hello again @zhuyeaini9 I could reproduce the same issue on Windows too: The real RX data start at static void handle_rx(uint8_t *data, size_t data_len, void *user_arg) {
if (data_len > 2) {
// You can check the status bytes here
for (int j = 2; j < data_len; j++) {
putchar(data[j]); // Print to ESP monitor
}
}
} However, the FTDI chip won't send you any data before you configure it's line properties (parity, stop bits...) and baudrate via FTDI's custom commands. ATM, I'm updating the CDC driver to allow such extension. I'll keep you updated. |
thanks@tore-espressif,really helpful. |
That's correct, FTDI chips don't use commands as defined in USB CDC specification but their own vendor specific commands. The FTDI implementation is currently under internal review. I'll update this issue when it gets public, thanks! |
got it. |
any update? |
This example implements usual UART/USB convertor driver. Closes espressif#8645
@zhuyeaini9 sorry for the delay. If you are willing to test my work-in-progress code, you can try this example: https://github.com/tore-espressif/esp-idf/tree/feature/usb_host/cdc_custom_commands/examples/peripherals/usb/host/cdc/cdc_acm_vcp The API can change in the official release, though. There are couple of points we need to internally agree upon/fix:
Your feedback would be greatly appreciated, thanks! |
thanks update! I try your example cdc_acm_vcp,it works well! |
This example implements usual UART/USB convertor driver. Closes espressif#8645
Hello, |
Hello, I have not tested with FT2232D. You can easily try it out by updating the PID of the device in the driver and invoke this constructor https://github.com/espressif/esp-usb/blob/master/host/class/cdc/usb_host_ftdi_vcp/include/usb/vcp_ftdi.hpp#L38 |
Thank you so much for your quick reponse, the codes are compatible also with the SIP ESP32-S3-PICO as it has the USB 1.1 OTG support right ? |
yep, all modules based on S3 have USB 1.1 host support. |
You are the best guys, thank you ! |
Beaware of hardware of your development board. Not all boards have USB (pin 19 and 20) wired out to USB-A connector |
Excuse me, please. Can this library be independent of ESP32? I believe it can be used on other boards as well, since it's written entirely in C++ code. Am I right? Also, does this library support bidirectional communication? |
Hi all:
I used the esp32s3 board to develop one usb host fuction.
I used the master branch code.
the device was the cdc-like device which connect to esp32s3's usb[GPIO 19 20] via one usb to uart chip(ft231xq).
I can find this device by the example of usb host lib,which show below info:
//-----------------------------------------------------------------------
*** Device descriptor ***
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0x0
bDeviceSubClass 0x0
bDeviceProtocol 0x0
bMaxPacketSize0 8
idVendor 0x403
idProduct 0x6015
bcdDevice 0.00
iManufacturer 1
iProduct 2
iSerialNumber 3
bNumConfigurations 1
I (5417) CLASS: Getting config descriptor
*** Configuration descriptor ***
bLength 9
bDescriptorType 2
wTotalLength 32
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
bMaxPower 90mA
*** Interface descriptor ***
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 0xff
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 0x2 EP 2 OUT
bmAttributes 0x2 BULK
wMaxPacketSize 64
bInterval 0
I (5477) CLASS: Getting Manufacturer string descriptor
FTDI
I (5487) CLASS: Getting Product string descriptor
FT231X USB UART�
I (5487) CLASS: Getting Serial Number string descriptor
DQ008964
//-----------------------------------------------------------------------
but when I try the example of cdc_acm_bg96,
of course I change the code of vid,pid to my device.
comment some code of bg96 special,like send AT cmd etc.
so the code is simple:
1.open the device with rx handle function.
2.print data of rx handle function.
the device seems open ok from log:
//--------------
D (2430) USBH: Processing actions 0x100
D (2430) USBH: New device 1
D (2440) cdc_acm: New device connected
D (2440) cdc_acm: Checking list of connected USB devices
D (2450) CDC_ACM: Submitting poll for BULK IN transfer
D (2450) CDC_ACM: in xfer cb
//-------------
but I received repeated messages which has len 2,
first was 0x11,two was 0x60.
it received again and again.
the device is ok,I connect it to pc's usb port.
it works,it not send the 0x11 0x60 message.
it just return message after I send some cmd to it.
I check the ascii,the 0x11 ofter used for XON flag,I don't know what should I do.
from the cdc_acm_bg96's readme,the device should be support:
//--------------------------------------
Supported Devices
The CDC-ACM Host driver supports the following types of CDC devices:
CDC-Like Vendor Specific Devices
The CDC-ACM Class driver supports CDC-like devices that meet the following requirements:
0xFF
For CDC-like devices, users are responsible for ensuring that they only call APIs (e.g.,
cdc_acm_host_send_break()
) that are supported by the target device.//-----------------------------------------------
any advice is welcome!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
The text was updated successfully, but these errors were encountered: