33
\$\begingroup\$

Can someone tell me why people use either USB or RS232. They are both serial ports, right? And I understand that USB is much faster (especially USB3.0) but if people wanted too I'm sure they could make a successor to RS232 that is just as fast.

So, what are the advantages and disadvantages to both?

\$\endgroup\$
1
  • 4
    \$\begingroup\$ RS232 was really designed to be an interface to a modem. That's pretty clear with signals named 'ring indicator', etc. It's been usurped to provide simple 3 wire (GND, TX, RX) bidirectional communication to many devices. USB was designed as an protocol extendable device interface system. Given the extendable it's much more complicated and requires a software stack on both device and host sides to implement. USB even has a replacement for RS232 called CDC. \$\endgroup\$
    – kenny
    Jun 26, 2012 at 3:43

2 Answers 2

22
\$\begingroup\$

What are the differences between USB and RS232?

You will find much more than I can tell you here about the abilities and disadvantages of RS232 by starting with a search for RS232 and then 'wandering around the web' and following the thread where it leads. No one page will tell you everything but 10 or 20 quick skims will show you how useful it was and how utterly terrible, all at the same time.

  • USB is intended as a high speed upward extensible fully standardised interface between 1 computing device using a single port and N peripherals using one port each with all control being accomplished by signals within the data stream. USB is formidably difficult to provide low level interfaces for. "Simple" interfaces are common but these provide and hide a very large degree of related complexity.

  • RS232 was intended as a 1:1 relatively low speed semi-standardised interface between 1 computing device and 1 peripheral per port with hardware control being an integral part of operation. RS232 is relatively easy to provide low level physical interfaces for.


RS232

was (and to some extent still is) a very useful powerful flexible way of connecting computing device to peripherals.

However [tm] [!!!] RS232 was intended as a short distance (a few metres max) moderately low speed (9600 bps usual, up to about 100kbps in some cases, faster in very specialist situations), one device per port (exceptions proving the rule).

Signalling was unbalanced relative to ground using about +/- 12V with logic one on dfata = -V and logic one on control = +V. There were many many many control signals on the original 25 pin connector which led to an utterly vast range of non standard uses and incompatabilities. The later version reduced the connector to 9 pins with still enough control signals to allow people to utterly destandardise configurations.

Getting RS232 working between a randomly chosen terminal device and a computer or similar MAY have been a matter of plug in and go, or need minutes hours or days of playing and in some cases just would not work.

RS232 does NOT provide powering per se although many people used it to power equipment in many different ways, none of them standard. Observation of the data lines will allow data signals to be identified. (Fast eyes and a brain that works at a suitable number of kbps would help).

Data transfer is unidirectional on a transmit and receive line and uses asynchronous framing.

Design is for 1:1 connection with no way of multidropping in an 1:N arranagement without non-standard arrangements.

USB

up to USB2 is a 4 physical wire system with two power lines and two data lines. There are no physical control lines. USB3 uses more lines and details are best left for another question and answer.

Initial speed was 12 Mbps, increased to 480 Mbps with USB2 and up to 5 Gbps "Superspeed" mode with USB3.

Control and configuration is all done with software using data signals which are an utterly inseparable part of the interface. Observing the data stream with an oscilloscope will not reveal the actual data component of the system.

Data transfer uses 0/+5 balanced differential voltage signalling.

Data transfer is bidirectional with ownership of the "bus" being an integral part of the protocol.

Connection is almost always on a 1:1 basis physically but a number of logical devices can be accommodated on the one port. Connection of N physical devices to one upstream port is usually accomplished by use of a "hub" but this is essentially a visible manifestation of an internal 1:N arrangement which is an integral part of the design.


There are going to be some interesting connector issues :-):

USB2 / USB3 From here

enter image description here

USB3 superspeed microconnector with USB 2 backward compatability from here

enter image description here

USB3.COM - USB3 superspeed cable connectors from here

enter image description here


Wikipedia RS232

USB versus serial

Wikipedia USB

USB3 Superspeed FAQ

Wikipedia USB3

USB.ORG - superspeed

\$\endgroup\$
1
  • 1
    \$\begingroup\$ It is worth pointing out that RS232 is far superior to USB when jitter and latency matter. You can not reliably feed a Pulse Per Second signal to a computer over USB. You can do so with RS232 \$\endgroup\$
    – dfc
    Jul 15, 2013 at 18:28
19
\$\begingroup\$

An USB port is much more sophisticated than an RS-232 serial port.

Basically, an RS-232 has a TX pin and an RX pin in which a given side transmits and receives data (respectively), and the other side has the same two crossed over, so one TX connects to the other RX and vice-versa (obviously).

There are other pins for control, but they are not necessarily used. Their main function is for buffer retention control. The protocol in RS-232 is quite simple. It is assumed that both sides are initially silent (each TX is low), and then when a side wants to transmit a byte it does one or more high pulses (the "start bits"), sends each bit of the byte transmitted sequentially and then finishes with some more pulses ("stop bits"). Optionally, there may be a parity bit. It is assumed that both sides previously have the same configuration for start and stop bits and the timing for sending each bit (the baud rate).

There may be more signaling for error correction, but that's not required. So an RS-232 port can be easily made using I/O pins in any microcontroller, the only thing you'll need is voltage conversion since RS-232 lines are 12V and microcontrollers usually work at 3.3V.

USB uses a pair of differential lines, in which a bit is made high by placing a voltage difference between them in one direction, and low by placing the same difference in the other direction. This is much more effective to damp noise, so that's why USB can go longer distances and have much higher bandwidths. Both sides transmit and receive over the same pair, and there's a complex data protocol to detect collision, do error correction, discover device characteristics, etc., not to mention the support in the spec for standard device-specific protocols like mice, keyboards, etc. In short, to have an USB port you either need a dedicated IC for it or a firmware in your microcontroller that's absolutely not trivial to write, especially if you want to support specific device capabilities.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Nice answer, but you should probably remove the word 'pair' from the RS232 description since that tends to be used more in the context of differential signalling (ie, "twisted pair"). \$\endgroup\$ Jun 26, 2012 at 4:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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