Protocol Comparison
| Feature | UART | SPI | I2C | CAN |
|---|---|---|---|---|
| Wires | 2 (TX, RX) | 4+ (SCK, MOSI, MISO, CS) | 2 (SDA, SCL) | 2 (CAN_H, CAN_L) |
| Clock | Asynchronous | Synchronous | Synchronous | Asynchronous |
| Duplex | Full | Full | Half | Half |
| Topology | Point-to-point | Single master, multi-slave | Multi-master, multi-slave | Multi-master broadcast |
| Max Speed | ~1 Mbaud | 50+ MHz | 3.4 MHz | 1 Mbit/s (8 Mbit/s CAN-FD) |
| Addressing | None | Chip select lines | 7/10-bit address | Message ID (11/29-bit) |
| Error Detection | Parity bit | None (application layer) | ACK/NACK | CRC + 4 other mechanisms |
| Best For | Debug console, GPS, simple links | High-speed peripherals (flash, ADC, display) | Multi-device, low pin count | Automotive, industrial, safety-critical |
When to Use Which?
UART — Simplest option. Use for debug consoles, GPS modules, Bluetooth/WiFi module communication, or any simple two-device link where speed isn't critical.
SPI — Use when you need high throughput (sensor data, display driving, flash memory access) and have GPIO pins to spare for chip selects. Best when only a few peripherals are needed.
I2C — Use when you need many devices on minimal wires (sensors, EEPROMs, RTCs). Good for configuration and low-to-medium speed data. The 2-wire interface keeps PCB routing simple.
CAN — Use for distributed systems that need reliability, real-time guarantees, and fault tolerance. Standard for automotive ECU networks and industrial control.
Wireless & Network Protocols
Bluetooth Low Energy (BLE)
- Master connects to multiple slaves; slave connects to one master only
- GATT profile: Services (functions) contain Characteristics (data points)
- Advertising mode: broadcasts info to nearby devices
- Connected mode: one-on-one data exchange
- Range ~100m (Bluetooth 5 Coded PHYs extend further)
- Bluetooth Mesh enables many-to-many communication without a gateway
TCP vs UDP
| TCP | UDP | |
|---|---|---|
| Connection | Connection-oriented | Connectionless |
| Reliability | Guaranteed, ordered delivery | Best-effort, no ordering |
| Overhead | Higher (handshake, ACK, flow control) | Lower |
| Use Cases | HTTP, SSH, file transfer | DNS, streaming, gaming, IoT telemetry |
4G/LTE
- IP-based (data centric) architecture
- CDMA uses code division multiplexing for channel access
- High throughput, relatively low latency
- IP tunnel for data transport
5G
- Connects thousands of devices simultaneously
- Increased throughput, decreased latency vs 4G
- Higher frequency bands enable faster transmission
- Three profiles: eMBB (speed), mMTC (IoT density), URLLC (ultra-low latency)