ESP32-S3 Delay Enumeration of 2nd USB CDC Port

HaydosR
Posts: 4
Joined: Fri Sep 02, 2022 6:32 am

ESP32-S3 Delay Enumeration of 2nd USB CDC Port

Postby HaydosR » Tue Sep 10, 2024 1:47 am

Hi,

I'm developing a product around an ESP32-S3 module (WROOM) that registers 2 USB CDC Ports on the attached Windows computer (industrial application, the device will always be plugged into a Windows computer).

For the sake of easily configuring software on the Windows machine, I'd like the board to make the first USB-Port visible (ie COM6), then after a configurable delay register the 2nd CDC Port (which might be called COM5, or even COM7). From what I've tried, (ESP-SDK 5.2) it appears that TinyUSB notifies windows of the existence of both CDC ports when the S3 starts the USB stack with `tinyusb_driver_install()`, before I even call `tusb_cdc_acm_init()`.

I've found that I can't rely on the lower-number COM port to be the first or second CDC instance - they appear swap randomly between eachother, or even get new COM numbers.

If I delay my call to `tusb_cdc_acm_init()`, windows can still see and open the 2 ports, but the S3 logs that its not yet read/writable until `tusb_cdc_acm_init()` has been called.

Is there a solution that will allow the devices to appear 1 before the other in device manager, so that Its just a case of knowing 'the first COM port that appears is CDC_ACM_0, and then 3s/5s/10s later when the next COM port appears, you know its CDC_ACM_1?

Any help would be greatly appreciated.

Thanks,

Hayden

ESP_Sprite
Posts: 9719
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-S3 Delay Enumeration of 2nd USB CDC Port

Postby ESP_Sprite » Tue Sep 10, 2024 6:43 am

Not sure if that's possible. The configuration of an USB device is a single structure that is read when the device is plugged in (which in your case tells Windows that the device has two serial ports). There's no way to 'add' a second serial port later except by forcing a disconnect and reconnect, and at that moment the entire configuration gets read in again and you still won't know which port comes first.

HaydosR
Posts: 4
Joined: Fri Sep 02, 2022 6:32 am

Re: ESP32-S3 Delay Enumeration of 2nd USB CDC Port

Postby HaydosR » Tue Sep 10, 2024 10:25 pm

I hadn't considered that process, but with what you've described I may be out of luck.

I guess this question is more Windows specific / less ESP32, but do you have any suggestions on how the 2 ports could be differentiated.

Is it possible (though probably not advisable) for one CDC descriptor to be changed so that it lists as a CP2102N or WCH340 style COM port (which windows gives different names)? Or are these descriptors specific to the entire device, rather than CDC port specific?
Attachments
ComPorts.png
ComPorts.png (5.29 KiB) Viewed 657 times

ESP_Sprite
Posts: 9719
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-S3 Delay Enumeration of 2nd USB CDC Port

Postby ESP_Sprite » Wed Sep 11, 2024 4:54 am

Sorry, I don't know what influences the naming of these ports in Windows.

Who is online

Users browsing this forum: No registered users and 115 guests