0

I have seen that it is possible to connect two computers by USB cable and make a virtual ethernet bridge or something like that.

My question is, can we do something similar but configure the connection as a SERIAL interface?

To be exact:

Is it possible to connect two computers with a USB cable (I do not know what the correct name is, I mean a cable that has USB-A connector on both ends) without any Serial adapter involved and then configure the usb port as a serial.

3
  • 1
    I think you mean OTG cables? (On-The-Go). I think most computer doesn't support such mode (it depends also on hardware). So do you have computer with support OTG? (Raspberry 4 and Raspberry 0 can do it, many phones also, but I would not expect much more support). Commented Sep 13, 2023 at 13:23
  • use two USB Serial adapters ... connect the serial pins together Commented Sep 14, 2023 at 2:50
  • First read this answer. To use USB port as serial, a converter is required; USB-serial is not a "port mode" but a specific type of USB device, so it can't work without the actual device. This product is an example of two converters connected back to back, with all the protection. The Ethernet thing you saw was constructed in the exactly same way. Commented Sep 14, 2023 at 4:32

1 Answer 1

1

A USB bus must have a tree structure, with exactly one USB Host Adapter at the root of the tree. The Host Adapter will be responsible for overall control of the entire bus.

Connecting two basic USB Host Adapters together with just a simple cable with USB-A connectors on both ends will never work and is explicitly against USB specifications. That is a non-starter.

The "virtual ethernet bridge" you've seen is not just a cable, but it includes some electronics (probably inside one of the connectors) to make the cable work like two USB Ethernet adapters connected together with a short Ethernet cable.

You could in theory do something similar by connecting two USB-to-serial converter chips back-to-back, but that would be just throwing away most of the speed of the USB bus, without getting the kind of minimal latency the handshaking signals of a RS-232 UART wired directly into an IRQ signal can offer. There would be no advantage in doing that.

A RS-232 serial port has fully independent TX and RX lines; USB has a single differential pair of data wires that are both used for receive and for transmit, and most USB host adapters have dedicated hardware circuits for differential signaling, and they cannot be easily bypassed. The two other lines are dedicated power lines, and might not be controllable at all.

A USB On-The-Go (OTG) cable (as mentioned in the question comments by Giacomo Catenazzi) cannot have a regular USB-A connector on both ends, because it needs either the 5th pin of the Mini-AB or Micro-AB connectors, or the equivalent systems of USB Type-C, and a dual-mode USB controller that can work both as a USB Host Adapter or as a USB Device. The extra 5th pin of the Mini-AB or Micro-AB connectors is used to select the initial mode of the dual-mode USB controller it's plugged into. There is also a specific protocol for flipping the host/device roles around if necessary.

One end of an OTG cable could be regular USB-A, but the other must be Mini-AB, Micro-AB or Type-C. And as noted above, the system at that end would need to have a dual-mode capable USB controller.

In Type-C, the host/device role is just one of the several optional negotiable things on the connection, like various alternate modes and power delivery.

1
  • 1
    I like this answer, but seeing the original asker and future readers night not be very technical people, let me tldr your answer: this whole answer means "no. A simple cable with USB-A on both ends can never be used for what you asked." Commented Sep 13, 2023 at 23:38

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.