Concept Q&A

Embedded Protocols Overview — UART, SPI, I2C, CAN & Wireless

Side-by-side comparison of embedded communication protocols: UART, SPI, I2C, CAN, BLE, TCP/UDP, and cellular. Quick reference for interview prep.

Study the fundamentals first

Read the Peripherals topic pages for in-depth concepts before practicing Q&A

Protocol Comparison

FeatureUARTSPII2CCAN
Wires2 (TX, RX)4+ (SCK, MOSI, MISO, CS)2 (SDA, SCL)2 (CAN_H, CAN_L)
ClockAsynchronousSynchronousSynchronousAsynchronous
DuplexFullFullHalfHalf
TopologyPoint-to-pointSingle master, multi-slaveMulti-master, multi-slaveMulti-master broadcast
Max Speed~1 Mbaud50+ MHz3.4 MHz1 Mbit/s (8 Mbit/s CAN-FD)
AddressingNoneChip select lines7/10-bit addressMessage ID (11/29-bit)
Error DetectionParity bitNone (application layer)ACK/NACKCRC + 4 other mechanisms
Best ForDebug console, GPS, simple linksHigh-speed peripherals (flash, ADC, display)Multi-device, low pin countAutomotive, 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

TCPUDP
ConnectionConnection-orientedConnectionless
ReliabilityGuaranteed, ordered deliveryBest-effort, no ordering
OverheadHigher (handshake, ACK, flow control)Lower
Use CasesHTTP, SSH, file transferDNS, 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)