-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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 Interface dual CDC not working #10936
Comments
I think you would need to build out the USB as a composite if you are going to put two devices on it. |
@yunyizhi - I have looked into the code and it seems that USB CDC only supports a single interface. @me-no-dev - Do you know anything else about it? |
@yunyizhi - The code actually defines a single set of CDC IN/OUT endpoints. It fixes the endpoint address and it will never work with a dual CDC port. From https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/USBCDC.cpp#L31-L39 static uint16_t load_cdc_descriptor(uint8_t *dst, uint8_t *itf) {
uint8_t str_index = tinyusb_add_string_descriptor("TinyUSB CDC");
uint8_t descriptor[TUD_CDC_DESC_LEN] = {// Interface number, string index, EP notification address and size, EP data address (out, in) and size.
TUD_CDC_DESCRIPTOR(*itf, str_index, 0x85, CFG_TUD_ENDOINT_SIZE, 0x03, 0x84, CFG_TUD_ENDOINT_SIZE)
};
*itf += 2;
memcpy(dst, descriptor, TUD_CDC_DESC_LEN);
return TUD_CDC_DESC_LEN;
} It would be necessary to rewrite this part of the code to consider more than 1 CDC USB port. |
Based on https://esp32.com/viewtopic.php?t=24777, it is possible to enable up to 2 CDC ports and no other USB profile. Therefore, it is possible to achieve it using IDF, but not using Arduino at this time. |
I have delved into the usage of more than one CDC port and what I've found is that the maximum number is defined at lib compilation time and is not runtime adjustable. Currently Arduino supports only one CDC port. To resolve this:
|
Excellent, @me-no-dev! Thanks! |
Board
ESP32S3 DeV Module
Device Description
esp32s3 DevKitc N16R8
Hardware Configuration
just board
![Image](https://private-user-images.githubusercontent.com/64545732/409925587-b99d1c59-43ba-4f4e-af41-3e4024318e9e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NTE1NTcsIm5iZiI6MTczOTU1MTI1NywicGF0aCI6Ii82NDU0NTczMi80MDk5MjU1ODctYjk5ZDFjNTktNDNiYS00ZjRlLWFmNDEtM2U0MDI0MzE4ZTllLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE0VDE2NDA1N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE3ZDE5NjA1NzA4NjY4ZTQ1OGFkN2YzNzBlOGYyMmM1NWVmYWQ4YTVmZmM4NjA1ZDBhMzhiYzgwMjg0YWFkMGMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0._oZgVTbYw9ZUXjvgisUJ7PAPz0yYi7YEGe2zlh_dgho)
Version
3.1.1
IDE Name
Arduino IDE
Operating System
Win11
Flash frequency
80MHz
PSRAM enabled
no
Upload speed
921600
Description
I found in the library file USBCDC.cpp that it supports a maximum of two CDC instances, but in reality, only one can be initialized.
Sketch
Debug Message
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: