Skip to main content

Connectivity & Buses

How a microcontroller talks to sensors, peripherals and other boards. Picking the right bus is a trade-off between pin count, speed, distance, number of devices and noise immunity.

Quick comparison​

BusWiresSignallingTypical speedDistanceMulti-deviceBest for
UART2 (TX/RX)Single-ended, async≤ ~1 MbpsShort (on-board)No (point-to-point)Debug console, modules, bootloader
I²C2 (SDA/SCL)Single-ended, open-drain100 k–3.4 MVery short (cm)Yes (addressed)On-board sensors, EEPROM, RTC
SPI3 + 1/CSSingle-ended, sync10s of MbpsOn-boardYes (per-CS)Fast on-board (flash, displays, ADC)
CAN2 (CANH/L)Differential1 M (5 M+ FD)Tens of mYes (arbitration)Automotive, robotics, industrial
RS-4852 (A/B)Differential≤ 10 MbpsUp to ~1200 mYes (multi-drop)Long industrial links (Modbus)

SPI is included for context; the four guides below cover the buses in this request.

How to choose​

  • On one board, few pins, several slow devices → I²C.
  • On one board, need speed → SPI.
  • Two devices, simple, debug/module → UART.
  • Long cable, noisy environment, many nodes → RS-485 (or CAN for robust messaging).
  • Robust, distributed, prioritised messaging → CAN.
Distance ⇒ go differential

Single-ended buses (UART/I²C/SPI) are for on-board use. The moment a link leaves the board or runs through noise, switch to a differential bus (CAN, RS-485) — see Differential Signaling.

See also​