Hardware Interconnect Bus
NOTICE! This page is a Work in progress
There are literally hundreds - if not thousands - of different specifications for communications between different devices. Most of these are probably proprietary but this page will document the most common on an introductory level.
Speed
When it comes to any kind of communication, the speed is often expressed as "bps" (bits per second) or faster rates in "kbps" (kilobits per second), "Mbps" (Meta-bits per second) or even "Gbps" (Giga-bits per second). Soon we'll probably begin to see "Tbps" but I am not sure that is available as of yet.
It is worth noticing that, since a byte is 8 bits, you can often divide the bit-rate by 8 to get the Bytes per second). Often, however, there are a few extra bits stuffed in the protocol, start, stop, parity, so this calculation really depends on the protocol.
It should also be mentioned that in the early days the term "baud" was often used (Wikipedia article on baud). Baud is defined as a symbol rate and is typically equivalent of the bit-rate. However, later generation modems could use various forms of encoding to transfer multiple bits in one symbol which is why the term is rarely seen today.
Asynchronous vs. Synchronous
Serial communication exist in two different types. In synchronous communication, the data line(s) are combined with a clock signal that synchronize the devices together. In asynchronous communication there is no clock signal and the transmission speeds are "agreed upon". This require a fairly precise timing for both transmitters and receivers.
Asynchronous
RS-232
RS-232 can be considered the granddad of Hardware Interconnect Buses. It is a point-to-point bus which will connect exactly two devices with each other. RS-232 would operate at speeds from around 150 bps, through 300, 4800, 9600 and 19200 bps.
RS-232 was first introduced in 1960 and up through the 70s and even 80s it was widely used. Early computers (see image on the right) were monstrous and were often operated through multiple serial terminals. The communication between the central computer and those terminals were almost always (if not always) RS-232.
Early PC's always had at least one RS-232 port which was often used to attach a modem. Modems were common up until the late 90s and again - exclusively used RS-232.
Today, RS-232 have all but vanished in consumer and professional equipment and is almost exclusively replaced by USB. The basic signalling are still commonly used for short distance communication.
These connections will typically operate and a voltage level depending on the actual equipment - typically either 3.3V or 5V.
RS-422 / RS 423
RS-422 and RS-423 are serial communication standards that work with differential voltages, rather than absolute voltage levels like RS-232, and using 2 twisted pairs. This means that much longer cables can be used and the data will not get corrupted on the way. These are rarely used nowadays, and have essentially been superseded by more modern communication systems, such as CAN and Ethernet. The RS-485 sibling has survived until present day, see below.
RS-422 is (i.e. was) the point-to-point variant, with full duplex in both directions. RS-423 is (i.e. was) the multi-drop variant, with one master that "owned" one pair and all the slaves shared the other pair, and higher level protocols would ensure that only one slave would respond at any given time.
RS-485
Wikipedia claims that RS-485 was introduced in 1983. I think that is when it formalized as a standard (TIA-485/EIA-485), because I worked with RS-485 in 1984 with equipment that was way older than just 1 year. Modicon introduce Modbus in 1979, which was a serial protocol on top of RS-485. Nevertheless, RS-485 quickly became a favorite in industrial automation, and is still very popular, especially thanks to Modbus.
RS-485 was originally a single twisted pair, differential voltage interface with maximum 30 devices on one segment, something like ~1000 feet (~300 meters) and 1 Mbit/s maximum communication speed. This has been revised over the years, as silicon vendors have improved performance, and the current standard (1998 & 2012) has been updated to reflect this. Faster speeds, more devices and longer cables. Only in-the-field tests can determine the maximum cable lengths at a given speed.
Connecting an MCU to a RS-485 transceiver is very simple. The UART/USART Tx and Rx are connected to "D" (drive) and "R" (receive) pins on the transceiver chip. There are dozens (or more) RS-485 transceivers on the market, and most of the SOIC-8 variants, which are the majority, are pin compatible. Additionally, there are "RE" (receive enable) and "DE" (drive enable) on the transceivers, which the MCU needs to control. They are electrically inverted, so in most cases, we only need a single MCU pin for (direction) and it gos to both RE and DE.
I²C (Inter-Integrated Circuit)
I²C is a communication bus originally invented by Philips Semiconductors (now NXP) in 1980. Today, it is widely used for communication between MCUs and various peripheral devices.
Originally the speed was defined as 100 Kbps or 400 Kbps but faster options were possible and today a newer I3C option is emerging.
An I²C bus typically consist of one master and multiple slaves. It is possible to have multiple masters but this is rarely seen "in the wild".
The two lines - CLK and SDA both operate in "open drain" mode so they need to be pulled up. The strength of the pull-up resistor depends on the distance. Typical values are less than 10 kOhm.
Due to the modern day sensitivities, some people frown on the use of master/slave and come up with modern "acceptable" terms, but this only ads confusion, so we will stick with the original terms.
SPI (Serial Peripheral Interface)
An option, which is much faster, is SPI. SPI is a single master controlling the communication with one slave using one clock and two data lines:
There is also a SS (slave select) line so the same bus can be shared with multiple slaves, but under normal circumstances only a single master.
A final option is to daisy chain multiple slaves using the same SS.
There is no "upper limit" on speed - it depends on the capabilities of the master and slaves. Speeds in the Mbit range is common, even 10s of Mbit.
CAN
The CAN bus was developed by Bosch in the early 1980s. It was designed to provide reliable communication in noisy environments and it is typically used in vehicles (cars, ships). It is a package oriented bus and do away with the concept of master and slave. Every device on the bus can transmit packages and every device will receive all those packages and individually must decide what to do with them.
Multiple CAN standards exist with different speed.
USB
USB have today almost completely replaced the original RS-232 for device to device communication.
Ethernet
To be added!
