0

If I want to send data to a device serially from my PC, there are 3 things that must be done:

  1. I must connect a USB to serial converter (FTDI breakout or similar) to the USB port of the PC
  2. The target device is connected to the serial output of the USB to serial converter
  3. I write to the serial port that the device is connected to.

What I am confused about, is why there is a need for such a USB to serial converter if I am writing to a serial port anyways? Since there is a need for a converter, that tells me that USB packets are still being sent, and not my desired serial data.

My guess is that the usb to serial converter is receiving usb packets which contain the serial data and information like baud rate and parity. Why do this, and not just simply send serial data directly out of the usb port?

6
  • 2
    You don't need a converter if you have a serial interface, but you use a USB interface. While the S in USB stands for "serial", the USB protocol is different from the serial protocol. I guess that the electrical standards are also different. Thus, in order to connect your serial device to a USB connector, you need a converter. May 1, 2021 at 5:12
  • 1
    In which way this question is related to UNIX, though? May 1, 2021 at 5:13
  • 2
    A USB port is totally different both from a mechanical and electrical point of view. Signal levels, protocols and transfer speeds are all different compared to a traditional serial port. May 1, 2021 at 5:35
  • 1
    It's probably fair to say that most data transfer methods nowadays use serial transmission. Ethernet, SATA, SAS, all serial. But they have nothing to do with the old serial protocol. May 1, 2021 at 5:40
  • 1
    Have a look at the serial interface and protocol (basically just start and stop bits for each byte) and the USB protocol, and you'll see that both are completely, utterly different, from physical aspects (USB uses differential encoding and special bit patterns) to the whole protocol stack on USB.
    – dirkt
    May 1, 2021 at 7:36

1 Answer 1

1

What I am confused about, is why there is a need for such a USB to serial converter if I am writing to a serial port anyways?

You are writing to an abstraction of a serial port, not to the serial port itself. In fact, your data might be travelling over something that has nothing to do with a classic serial port, for example if you usb port adapter is shared over the IP network (usbip). Or if you are using one of the solutions to this question.

Programs interact with abstractions all the time. You could also ask: why not write to the physical screen directly, instead of writing to a chain of software and hardware "adapters"? (graphic system, graphic card, HDMI, just to mention some of the "hops" you might encounter).

You could go that way and reimplement everything to write directly to the screen, but that would mean changing the program if you connect a VGA monitor instead of an HDMI one. That's why we let the operating systems offer abstractions we can work on.

1
  • In other words, you are not writing directly to the serial port. You are sending data to the driver for the serial port. The driver then manages the actual hardware, whether it is a real serial port, a USB add-on adapter, a Serial-over-IP connection, or some other not-yet-invented method like telekinetic wormhole jumping... This let's you, the programmer, just learn how to "write to the serial port", without needing to know--or care--about the many lower level driver details.
    – C. M.
    May 11, 2021 at 17:54

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.