tinyusb icon indicating copy to clipboard operation
tinyusb copied to clipboard

Support of several instances of TinyUSB stack (device or host)

Open roma-jam opened this issue 8 months ago • 5 comments

Related area

port support

Hardware specification

all hardware with several ports

Is your feature request related to a problem?

Unable to init stack on two ports simultaneously.

Relates to:

  • https://github.com/hathach/tinyusb/issues/1673#issuecomment-1273193613

Describe the solution you'd like

Possibility to run TinyUSB (device) stack on several peripherals (ports) simultaneously.

In the code that would be like:

tusb_rhport_init_t dev_init = {
  .role = TUSB_ROLE_DEVICE,
  .speed = TUSB_SPEED_AUTO
};

tusb_rhport_init(0, &dev_init);
tusb_rhport_init(1, &dev_init);

I have checked existing issues, dicussion and documentation

  • [x] I confirm I have checked existing issues, dicussion and documentation.

roma-jam avatar Apr 22 '25 11:04 roma-jam

I can try to get host stack running on multiple controllers (same usbip) easily. For device, it needs quite a bit of works, and it is kind of neat and not popular feature. I am not sure Icould mannge the time to do it myself, however PR is welcome.

hathach avatar Apr 29 '25 13:04 hathach

@hathach I try to get my head around this.

Can a simple matrix explain the possibly combinations in a system with multiple USB ports ? Also the dual-role, possibilities if you tear down the interface completely. With USB-C there is also the CC pins and some chips have CC-pin-handling built in, and for others we need to use external chip over I2C, is there some docs on dealing with DRD switching ? I see there is a way to assign a pin for binary identification of the VBUS power. I would also be happy if this binary value could be provided with a boolen. I would prefer to read it with and ADC (ESP32-P4) judge the level and deliver a boolean to tiny-USB. The level when a chip switch a gpio input from high <-> low can be shaky (not well defined).

Also its a bit tricky to identtify what is just connected to your USB port with this mechanism alone. For me to identify a USB-Memory stick I assume I need to provide the VUSB, and then I will not notice if a laptop connects and wants a RNDIS connection.

Any pointers to docs ?

Maybe already is in some doc, that I have not read.

Sorry for going completely OT, but I am new to this tinyusb, due to using esp32-p4, so a lot to catch-up.

ps I guess in the future it will become more common even for "small" processors to have multiple USB-Port, ESP32-P4 style. ds

savenlid avatar Jun 27 '25 10:06 savenlid

there is minimal docs for getting started. For this, you need to check code base.

There is lots of mcus with multiple usb ports already.

hathach avatar Jun 30 '25 02:06 hathach

I can try to get host stack running on multiple controllers (same usbip) easily. For device, it needs quite a bit of works, and it is kind of neat and not popular feature. I am not sure Icould mannge the time to do it myself, however PR is welcome.

would you share how to get host stack running on muliple controllers (2 hosts?)for tiny usb?

kbladewht avatar Sep 16 '25 04:09 kbladewht