What's changed: Initial version
4.4Serial communication interfaces
Compares the electrical and protocol characteristics of the four major serial communication methods—I2C, which connects multiple devices over two wires; SPI, which is high-speed and full-duplex; UART, which is asynchronous (start-stop synchronization); and CAN, which uses differential signaling for automotive use—building judgment for choosing the optimal interface based on requirements.
In embedded board design, the question "how should the sensor and MCU be connected?" has multiple candidate answers—I2C, SPI, UART, CAN—and which is optimal changes depending on requirements such as wire count, speed, number of connected devices, noise immunity, and cost. This section builds the judgment needed to decide which interface to choose for a given requirement, grounded in the differing electrical and protocol characteristics of the four major serial communication methods.
4.4.1I2C and SPI
- I2C (Inter-Integrated Circuit) is a bus-style serial communication scheme in which a master can talk to multiple slaves using only two wires: SDA (data) and SCL (clock). Each slave has a unique 7-bit (or 10-bit) address, and the master selects which device to talk to by specifying that address, so its chief advantage is being able to connect many devices without adding more wiring. However, its transfer speed—typically around 100 kbps standard-mode, 400 kbps fast-mode—is slower than SPI, and because its outputs are open-drain, a pull-up resistor is mandatory.
- SPI (Serial Peripheral Interface) communicates over four wires—SCLK (clock), MOSI (master to slave), MISO (slave to master), and SS/CS (chip select) (one SS line per slave)—and is full-duplex, sending and receiving at the same time. Because the master continuously supplies the clock and there is no addressing mechanism, it is far faster than I2C (several Mbps to several tens of Mbps), but the more slaves are added, the more SS wiring is needed, making it unsuited to connecting many devices.
4.4.2UART and CAN
- UART (Universal Asynchronous Receiver/Transmitter) performs one-to-one communication over two wires—TX (transmit) and RX (receive)—using asynchronous (start-stop) synchronization. It shares no clock line; instead, the transmitting and receiving sides interpret a sequence of start bit / data bits / (parity bit) / stop bit(s) at a previously agreed baud rate. This makes it easy to add devices individually, but unsuited to a bus-style connection bundling many devices onto a single bus (it is fundamentally one-to-one). It is widely used for debug consoles and simple communication with a PC.
- CAN (Controller Area Network) is a bus-style communication standard for automotive and industrial equipment, using two differential signal lines, CAN_H/CAN_L. Being differential, it is highly resistant to external noise, offering high reliability even over long distances and in electrically noisy environments (such as an engine compartment). It has a mechanism whereby each message carries an ID, and a higher-priority ID (a numerically smaller ID value) wins arbitration, so even if multiple nodes transmit simultaneously, the data is not corrupted and the higher-priority node continues transmitting (CSMA/CR: non-destructive arbitration).
Most-tested: choosing among "I2C = two wires, many devices, slower, pull-up required", "SPI = four wires (a separate SS per slave), full-duplex, fast, unsuited to many devices", "UART = two wires, asynchronous, one-to-one", and "CAN = two differential wires, noise-resistant, priority control via ID arbitration". Expect to be tested not on "fewer wires = better" but on the perspective of working backward from requirements—speed, device count, noise immunity—to select the right interface.
4.4.3Selecting an interface by use case
- When the requirement is to bundle many sensors (temperature, acceleration, light, etc.) over short on-board distances, I2C, which can identify many devices by address without adding wiring, is the first candidate. When high-speed data transfer is required (flash memory, a display, an ADC, etc.), SPI, with its clock-synchronous full-duplex communication, is well suited given its speed.
- When the requirement is to communicate simply one-to-one with an off-board device or a PC, UART is the convenient choice. When the requirement is to connect multiple ECUs/sensor nodes reliably on a bus in an automotive network or a noisy factory environment, CAN is suitable. It is also worth remembering the positioning of LIN (a lower-cost, lower-speed automotive subnetwork standard than CAN), intended for auxiliary subsystems that do not need CAN-level reliability or speed.
Suppose an embedded systems architect for an industrial robot's control board faces three distinct requirements: 8 on-board temperature sensors and 4 accelerometers (12 low-speed devices in total); a camera module that captures images at a high frame rate; and communication connecting the motor-control ECUs at each robot-arm joint over a long distance in a high-noise environment. For the 12 sensors, using SPI would require 12 SS wires, cluttering the board, so it is rejected; the design instead adopts I2C (only two wires), which can identify many devices by address (since the speed requirement is low, I2C's speed weakness is not a problem here). For the camera module, which must transfer a large volume of pixel data at high speed, I2C's speed is nowhere near sufficient, so the design adopts SPI, which is fast thanks to clock-synchronous full-duplex communication (since there is only one camera, SPI's weakness of adding more SS wiring as devices increase never surfaces). Finally, for communication between the motor-control ECUs, given an environment where wiring becomes long due to the arm's movement and there is significant electrical noise from motor driving, the design judges that single-ended I2C/SPI/UART lack sufficient error tolerance, and adopts CAN, which is noise-resistant thanks to differential signaling and also has priority control via ID arbitration. The key design point here is "do not try to cover every requirement with a single communication method"—using different interfaces for different requirements—low-speed/many-device (I2C), high-speed/few-device (SPI), long-distance/high-noise (CAN)—is the correct design judgment, and connecting the camera to I2C or running long-distance, noisy ECU-to-ECU communication over SPI merely for the sake of wiring uniformity would each invite a fatal problem: insufficient speed, or communication errors from signal degradation.
| Interface | Wire count | Speed | Multi-device support | Noise immunity |
|---|---|---|---|---|
| I2C | 2 wires | Slower (up to ~400 kbps) | Strong (addressing) | Low (single-ended) |
| SPI | 4 wires + one SS per slave | Fast (several Mbps or more) | Weak (wiring grows) | Low (single-ended) |
| UART | 2 wires | Moderate-to-low, asynchronous | Fundamentally one-to-one | Low (single-ended) |
| CAN | 2 wires (differential) | Moderate, ID arbitration | Strong (bus topology) | High (differential signaling) |
Trap: "I2C, having fewer wires, is always superior to SPI" is wrong—I2C is slower and uses single-ended signaling with low noise immunity, so SPI or CAN are better suited to high-speed transfer or high-noise environments. Also wrong: "UART is bus-style and can connect many devices"—UART is fundamentally one-to-one asynchronous communication; I2C or CAN is the appropriate choice for bundling many devices onto a single bus.
4.4.4Section summary
- I2C uses two wires and supports many devices via addressing, but is slower; SPI uses four wires plus a separate SS line, is full-duplex and fast, but is unsuited to many devices
- UART is two-wire asynchronous communication, fundamentally one-to-one; CAN uses differential signaling for high noise immunity and priority control via ID arbitration
- Interface selection is worked out backward from speed, device count, and noise-immunity requirements—do not judge superiority by wire count alone
Sign in to track progress — Log in.
Quick check
(just a quick review)Q1. The design wants to connect 12 low-speed sensors (temperature, acceleration, etc.) on a board, identifying each by address while adding as little wiring as possible. Which interface is most suitable?
Q2. Between a robot arm's joints, in an environment with long wiring runs and significant electrical noise, the design wants to reliably bus-connect multiple motor-control ECUs. Which interface is most suitable?
Q3. The design needs to connect a camera module that transfers a large volume of pixel data at a high frame rate to an MCU. Which interface is most suitable?
Keep track of your progress
The full study guide is free to read. Sign up free to practice with the question bank, track what you have read, review your mistakes, and highlight passages.

