tinyusb icon indicating copy to clipboard operation
tinyusb copied to clipboard

RP2040: Allow switching between Host and Device on runtime

Open DatanoiseTV opened this issue 3 years ago • 1 comments

Related area

host + device stack

Hardware specification

rp2040

Is your feature request related to a problem?

I am currently working on porting https://github.com/rppicomidi/midi2usbhost to support USB host and device mode without providing different firmware and noticed that TinyUSB currently doesn't support compiling with USB host and device support at the same time.

Describe the solution you'd like

I would like to be able to deal with USB host and device switching in software. It would be great if the tuh_* and tud_ functions would be available and could be either controlled in software or a GPIO. This would significantly reduce the workflow when dealing with my USB Type-C Host + Device.

image

Diagram) ser-images.githubusercontent.com/6614616/199957627-fc01223d-1d22-4788-84da-074136017c9b.png)

It is either powered by the Type-C connector to be used as a MIDI Device or for providing VUSB for the Type-A connector (I am using a USB Mux to switch the data lines from Type-C to Type-A via a GPIO and a MOSFET to control VUSB supply to Type-A via software.

I have checked existing issues, dicussion and documentation

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

DatanoiseTV avatar Nov 04 '22 11:11 DatanoiseTV

Is there any progress on host/device switching (or dual-role support)?

DatanoiseTV avatar May 25 '24 15:05 DatanoiseTV