3
\$\begingroup\$

I have two questions related with the USB connections on a pcb:

1- Is it possible to connect D+ line between 2 devices and 1 host? something like SPI fashion where MISO and MOSI lines are shared between all slaves? Or like I2C where every node listens to the bus and replies only when the given address is called? The same with the D-.

2- I'm designing an embedded application with 2 devices, one of the is a USB-device and the other one is a USB-OTG. When the communication is between them, I believe there is no problem, the OTG behaves as a host and the second one as a device. However, my question comes when I need to connect them (both as devices) to an external PC, is it possible to share the signal lines to the external PC, so I will have 3 devices connected on the line: uC USB-device, USB-OTG programmed as device and the PC USB-host.

\$\endgroup\$
1
\$\begingroup\$

1- Is it possible to connect D+ line between 2 devices and 1 host? something like SPI fashion where MISO and MOSI lines are shared between all slaves? Or like I2C where every node listens to the bus and replies only when the given address is called? The same with the D-.

No.

2- I'm designing an embedded application with 2 devices, one of the is a USB-device and the other one is a USB-OTG. When the communication is between them, I believe there is no problem, the OTG behaves as a host and the second one as a device. However, my question comes when I need to connect them (both as devices) to an external PC, is it possible to share the signal lines to the external PC, so I will have 3 devices connected on the line: uC USB-device, USB-OTG programmed as device and the PC USB-host.

If you want to make this work you will likely need a USB hub chip and two USB mux chips. The hub connects to the external PC, then the muxes are used to connect the on-board devices either to each other or to the hub chip as needed.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ You could actually do this with only one mux chip, if the embedded host device can support a downstream hub. Then you can leave the second device attached to the hub at all times and switch the main device between the hub's upstream port and one of its downstream ports. \$\endgroup\$ – ajb Oct 3 '18 at 0:12
  • \$\begingroup\$ You could, though that may lead to erratic behaviour when a user unplugs the PC end of the cable rather than the device end or shuts down their PC with your device plugged in. \$\endgroup\$ – Peter Green Oct 3 '18 at 14:08
16
\$\begingroup\$

No, it's not possible to do this for a whole load of reasons ranging from hardware termination and identification resistors on the D+/D- lines to protocol issues that could identify and handle multiple devices on a single port. Despite the misleading use of the word "Bus" in the name, USB is only capable of connecting a single host port to a single device port. Either of these ports may be an OTG port, but an additional pin in the cable/connector will take care of switching one end into host mode and one into device mode as required.

The only way to connect multiple devices to a single host port is to use a USB Hub.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.