What's the difference between "COM", "USB", "Serial Port"?

76,131

Solution 1

Serial port is a type of device that uses an UART chip, a Universal Asynchronous Receiver Transmitter. One of the two basic ways to interface a computer in the olden days, parallel ports were the other way. Serial is simple to hook up, it doesn't need a lot of wires. Parallel was useful if you wanted to go fast, typ 8 times faster than serial, but cables and connectors were expensive. Parallel I/O has completely disappeared from computer designs, caught up by tremendous advances in bus transceivers, the kind of chip that can transmit an electrical signal down a wire.

COM comes from MS-Dos, it is a device name. Short for "COMmunication port". Computers in the 1980's usually had two serial ports, labeled COM1 and COM2 on the back of the machine. This name was carried forward into Windows, most any driver that simulates a serial port will create a device with "COM" in its name. LPT was the device name for parallel ports, short for "Line PrinTer".

RS-232 was an electrical signaling standard for serial ports. It is the simplest one with very low demands on the device, supporting just a point-to-point connection. RS-422 and RS-485 were not uncommon, using a twisted pair for each signal, providing much higher noise immunity and allowing multiple devices connected to each other.

USB means Universal Serial Bus. Empowered by the ability to integrate a micro-processor into devices that's a few millimeters in size and costs a few dimes. It replaced legacy devices in the latter 1990s. It is Universal because it can support many different kinds of devices, from coffee-pot warmers to disk drives to wifi adapters to audio playback. It is Serial, it only requires 4 wires. And it is a Bus, you can plug a USB device into an arbitrary port. It competed with FireWire, a very similar approach and championed by Apple, but won by a land-slide.

The only reason that serial ports are still relevant in on Windows these days is because a USB device requires a custom device driver. Device manufacturers do not like writing and supporting drivers, they often take a shortcut in their driver that makes it emulate a legacy serial port device. So programmers can use the legacy support for serial ports built into the operating system and about any language runtime library. Rather imperfect support btw, these emulators never support plug-and-play well. Discovering the specific serial port to open is very difficult. And these drivers often misbehave in impossible to diagnose ways when you jerk a USB device while your program is using it.

Solution 2

USB stand for Universal Serial Bus not Port. The term "serial port" simply means that the data is transferred one bit at a time over a single signal path - in that sense even Ethernet is serial in nature. The word serial in both terms implies no relationship other than the width of the data path.

You are right in that the term serial-port in the context of a PC normally means an RS-232 port, but there are other serial port standards such as RS-422 and RS-485 often used in industrial applications. What these have in common is that they are implemented using a UART (Universal Asynchronous Receiver/Transmitter).

The term Universal in USB merely reflects the fact that it is not a specific device interface such as the dedicated mouse or keyboard ports found on older hardware. Similarly a UART based serial port is not device specific, reflected by the U in UART.

USB differs significantly from RS-232 in a number of ways; it is a master/slave (or host/device in USB terminology), rather than peer-to-peer, the USB device cannot initiate communication, it must be polled by the host. USB includes a low-voltage power supply to allow devices with moderate power requirements to be powered by the bus - that is also why USB ports can be used for charging battery powered devices. USB is significantly more complex that RS-232 which defines only the physical (hardware) layer whereas USB requires a complete software protocol stack.

The term COM is just a device name prefix used in Windows (and previously MS-DOS) for a serial (UART) port. Short for "communications", you can for example open a COM port as a stream I/O device with say FILE* port = fopen( "COM1", "wr" ) ;.

Share:
76,131
smwikipedia
Author by

smwikipedia

"A good question is half the answer." --- Anonymous "All problems in computer science can be solved by another level of indirection, except of course for the problem of too many levels of indirection." --- David Wheeler "If I were given one hour to save the planet, I would spend 59 minutes defining the problem and one minute resolving it." --- Albert Einstein

Updated on October 26, 2021

Comments

  • smwikipedia
    smwikipedia over 2 years

    I am confused about the these 3 concepts.

    My understanding is, Serial Port usually means RS-232 compatible port (RS = Recommended Standard). USB stands for Universal Serial Bus. So its name contains serial port, does it support RS-232? What does the Universal mean?

    And what does COM port mean?

    ADD 1

    Some understanding from Hans' answer:

    To reduce effort, device manufacturers usually make their device can behave like a serial port device as well. This relies on the the fact that many OS and language libraries have already included serial port communication support. Though such support is no comparable to a real matching device driver.

    ADD 2

    A good reference doc about Serial Port HOW-TO.

    And btw, the Linux Document Project is really useful.

  • sawdust
    sawdust over 9 years
    "The only reason that serial ports are still relevant in computing these days..." -- That sounds like a PC-centric perspective, not an accurate computer industry-wide viewpoint. SoCs almost always have at least one UART for a serial console, since a UART is easy in both the HW and SW sense to use for an interface. "a USB device requires a device driver." -- All devices (regardless of the bus) require a driver. Whether you have to install it or if it's already in the OS is another issue. USB requires a protocol stack (because it's a multi-device bus).
  • user1703401
    user1703401 over 9 years
    Sure, and that sounds like an embedded device dev-centric perspective. "COM" ought to be a pretty good hint that the OP is asking a Windows-centric question.
  • Clifford
    Clifford over 9 years
    I would not regard a USB coffee pot warmer as an example of a true USB device. Such devices usually use only the 5V/500mA powersupply that a USB port provides and do not used the data communication lines.
  • user1703401
    user1703401 over 9 years
    Sigh. It is programmable of course, automatically shutting off at the desired interval so the coffee doesn't bake to the cup. Use some imagination for pete's sake.
  • Clifford
    Clifford over 9 years
    @HansPassant : That could be done with a simple thermal cut-off. Idiot gadgets are hardly good examples. You'd struggle to overheat your cup with a 2.5 Watt power budget - use some physics for Pete's sake ;-)
  • sawdust
    sawdust over 9 years
    "that sounds like an embedded device dev-centric perspective" -- No, I'm pointing out what you omitted/overlooked or are ignorant of. How is that comment a narrow viewpoint? FYI those SoCs are in tablets, phones, STBs and media sticks. Just because the serial interface isn't exposed doesn't mean that they don't exist.
  • CMCDragonkai
    CMCDragonkai over 8 years
    What is initiating the simulation of a serial port when you plug in an arduino via USB?
  • Sam Hobbs
    Sam Hobbs over 6 years
    Cables and connectors for serial was not expensive. Also, before USB there was also SCSI. As for serial versus parallel, note that technical people learned how to make serial faster than parallel. For hard drives Parallel ATA (PATA) was replaced by Serial ATA (SATA) and now drives are all SATA. Parallel port - Wikipedia says "Newer ports reach speeds of up to 2 MB/s" and RS-485 - Wikipedia says "up to data transmission speeds of 64 Mbit/s".
  • Sam Hobbs
    Sam Hobbs over 6 years
    If a USB device cannot initiate communication then it seems impossible for a USB to support serial connections.
  • Clifford
    Clifford over 6 years
    @user34660 : Not at all; the host detects the device when it draws power, and initiates the communication. While connected the host continuously polls the device, which can send data in the poll response packets. The appearance of full duplex communication and UART-like communications is a facade.