Communications: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
(→‎Serial Communications: Added CAN and MilStd-1553 descriptions)
Line 61: Line 61:
==== Quad SPI ====
==== Quad SPI ====


=== Serial Port ===
=== [[Serial Port]] ===
Most people who program computers know what a serial port is, since that's an easy way for the program to communicate in real time to the operator. The most common version is that used for the COM port on the PC: a (now) 9-pin connector that has a Ground, Receive (RX) and Transmit (TX) pin, plus a "baud rate" setting without which you can't receive anything!
Most people who program computers know what a serial port is, since that's an easy way for the program to communicate in real time to the operator. The most common version is that used for the COM port on the PC: a (now) 9-pin connector that has a Ground, Receive (RX) and Transmit (TX) pin, plus a "baud rate" setting without which you can't receive anything!



Revision as of 10:33, 28 August 2019

Introduction

There are numerous mechanisms, techniques and protocols for getting data from one place to another, and many have a long history, an established implementation, and industry-standard terms. This page tries to enumerate the ones used for computing, so therefore what an Operating System may need to provide drivers and modules for.

To provide some sort of order, this page first differentiates between the most basic of implementations: how many "wires" are used simultaneously to send data.

  • "Parallel" implies that there are sufficient data wires side-by-side to send a single datum (byte, word or whatever) at once, with extra wires for control;
  • "Serial" implies that a single datum needs to be split into multiple parts first - usually the individual bits - and then sent over a smaller number of wires (as few as one). There may or may not be control wires as well.

Within the above two categories, the different techniques are listed in approximate complexity order. They start by differentiating themselves from other techniques - which is sometimes only subtle - and then usually link to other Wiki pages dedicated to the topic.

Common Terms

Many terms are used in the Communications arena, and sometimes they're used ambiguously. The following are the usual definitions of these terms:

Communications

Link
The connection between two devices. This could be multiple wires in a cable, or even wirelessly over a radio link.
Channel
A single path on a link, carrying one stream of data. A link may comprise of multiple channels; the usual number is two, one in each direction.

Characteristics

Synchronous
1. Synchronous communications implies that the data is sent in lock-step with a clock, often provided on another wire. The receiver can notice the change of state of the clock, and "sample" the data wire/s during defined transitions (e.g. rising edge, falling edge, or both).
2. Synchronous communications often implies "continuous": there is always data, but that data may be "filler" if there's nothing to communicate.
Asynchronous
1. Asynchronous communications implies that each side maintains its own clock, and sends data at a predetermined rate (often called "baud rate").
2. Asynchronous communications often implies "at any time": there is usually "dead space" on the link, and then one side or the other will burst into life, transmit the data, then go idle again.

Directions

Simplex
Data can only ever flow over the link in one direction.
Duplex
Data can flow over the link in both directions.
Full-Duplex
Data can flow over the link in both directions simultaneously.
Half-Duplex
Data can flow over the link in either direction, BUT only in one direction at a time.
A perfect example is the walkie talkie: only one side can transmit at a time, or else neither side will hear the other - hence the tradition of saying "Over!" just before releasing the Press-To-Talk (PTT) button.

Parallel Communications

Bus

Parallel Port

Small Computer System Interface (SCSI)

Peripheral Component Interconnect (PCI)

PCI Express (PCIe)

Although this looks to the computer as a (nearly) standard PCI bus, strictly speaking this is a Serial interface. At the lowest (electrical) level the data is sent over a single channel instead of a parallel bus, reducing the pinout and allowing for a simpler, thus faster interface. To further increase speed, PCIe supports "lanes", which are actually parallel PCIe data channels with only one set of control wires - back to being parallel!

Serial Communications

I/O

1-Wire Interface

The (misnamed) one-wire interface needs a second wire: the ground. But it does use just the one wire for each direction of communications, by requiring both sides to use a transmitter that can be electrically turned off (tri-state or open drain). By each side connecting both their transmitter and receiver to that one wire, then either side can transmit - just not both at the same time (half-duplex).

Single-Wire Protocol (SWP)

The (misnamed) Single-Wire Protocol needs a second wire: the ground. But it does use just the one wire for each direction of communications - simultaneously. In the Master-to-Slave direction, the Master communicates HIGHs and LOWs with differently-timed pulses. The Slave communicates HIGHs and LOWs by applying a load (or not) during those pulses. The Master detects the amount of current drawn by the Slave to determine what state the Slave is transmitting.

Inter-Integrated Circuit (I²C)

This is often spelled "I2C" for convenience (pronounced "Eye Two See"), or occasionally "IIC", but the correct name comes from the idea that the two "I"s look like they multiply together, hence the pronunciation "Eye Squared See".

Serial Peripheral Interface (SPI)

Quad SPI

Serial Port

Most people who program computers know what a serial port is, since that's an easy way for the program to communicate in real time to the operator. The most common version is that used for the COM port on the PC: a (now) 9-pin connector that has a Ground, Receive (RX) and Transmit (TX) pin, plus a "baud rate" setting without which you can't receive anything!

But a generic port that can be simply connected to an external device is often much more complex that this, yet still goes by the name "Serial Port".

RS-232 / RS-422 / RS-485

These terms define the electrical standard used on the wires for a serial port.

Comm Port

Synchronous Port

HDLC
X.25

Controller Area Network (CAN)

This is often used in vehicles, connecting sensors and switches to the Engine Management Computer, Body Control Module and dashboard gauges and lights. All the devices are connected to the same cable, and each broadcast packets of information for any other device to receive, interpret, and act on (change something else, or update a display). Using the one cable reduces the number of dedicated cables required, which saves a lot of weight, but it means that each device needs to be able to turn off its transmitter, and to be intelligent enough to decode the packets of information.

MilStd-1553 Bus

This is often used in aircraft, connecting sensors and switches to the Flight Control Computer and instrument clusters. All the devices are connected to the same cable, and each broadcast packets of information for any other device to receive, interpret, and act on (change something else, or update a display). For redundancy and safety, typically two separate cable runs are connected to each device. Using only two cables reduces the number of dedicated cables required, which saves a lot of weight, but it means that each device needs to be able to turn off its transmitters, and to be intelligent enough to decode the packets of information.

Universal Serial Bus (USB)

Ethernet

This is arguably the most complicated Serial interface, despite it essentially only having two data channels. It's the protocol/s that are communicated on top of this electrical protocol that complicate things: most commonly the whole TCP/IP suite used by the Internet.

Internet Protocol (IP)

IP version 4 (IPv4)
IP version 6 (IPv6)

UDP

TCP

HTTP, HTTPS, E-mail, ...