ElecEng Handbook Electronic Engineer Reference
HomeProtocols

Protocols & Communication

Levels, speeds, frames and pinouts of common serial communication protocols.

Opens the browser print dialog — choose "Save as PDF".
Voltage levels are typical; check the driver and receiver datasheets for absolute ratings.

🔤 UART

Asynchronous serial over two wires (TX/RX). Common logic-level standard (TTL/3.3 V).

Common levels

3.3 V logicHigh ≥ 2.0 V, Low ≤ 0.8 V (typ)
5 V TTLHigh ≥ 2.4 V, Low ≤ 0.5 V (typ)
RS-232≥ +3 V = 0, ≤ −3 V = 1; up to ±13 V

Standard baud rates

300 · 1200 · 2400 · 4800 · 9600 · 19200 · 38400 · 57600 · 115200 · 230400

Idle / frame

IDLE(High) | start(0) 8 data bits (LSB first) [parity] stop(1[,2])

Idle high; start bit (low), 8 data bits (LSB first), optional parity, 1 or 2 stop bits.

See the Protocol Timing Calculators above to convert baud rate to bit and byte times.

🔀 I2C

Two-wire (SCL, SDA), open-drain with pull-ups, multi-master, 7-bit (or 10-bit) addressing.

Voltage

VDC rail dependent; logic high pulled to VDD, low ≈ 0 V

Standard speeds

Standard 100 kbit/s · Fast 400 kbit/s · Fast-mode+ 1 Mbit/s · High-speed 3.4 Mbit/s

Pull-up resistor

Typically 1.8–10 kΩ depending on bus speed and capacitance; e.g. 4.7 kΩ @100kHz, 1–2 kΩ @400kHz. Range limited: SCL/SDA low voltage VIH>0.7×VDD, VIL<0.3×VDD.

Addressing

7-bit address is written twice on the bus (addr << 1 | R/W); common addresses: 0x68 (MPU6050), 0x76 (BMP280), 0x50 (24C02 EEPROM).

🌐 SPI

Serial Peripheral Interface: full-duplex, 4 wires (SCLK, MOSI, MISO, SS). Master controls clock.

Signals

SCLK · MOSI (master→slave) · MISO (slave→master) · SS/CS (active low)

Max speed is set by the slave datasheet and board wiring; typical 1–50 Mbit/s.

Modes (CPOL, CPHA)

Mode 0(0,0) clock idle low, data on rising edge — by far the most common
Mode 1(0,1) clock idle low, data on falling edge
Mode 2(1,0) clock idle high, data on falling edge
Mode 3(1,1) clock idle high, data on rising edge

🔗 USB

Universal Serial Bus — speed classes and typical connector/config pins.

Speed classes

  • USB 1.1 Full-Speed: 12 Mbit/s
  • USB 2.0 Hi-Speed: 480 Mbit/s
  • USB 3.x SuperSpeed: 5 / 10 / 20 Gbit/s

VBUS voltage

5.0 V (±5%); maximum negotiated current per type (default 100 mA, up to 500 mA / 900 mA / 5 A on USB-PD)

Data pins (Type-A/C)

Type-A: 1=VBUS 2=D− 3=D+ 4=GND
Type-C: D+/D− on CC-defined orientation (A6/B6)/(A7/B7)

Type-A: 1=VBUS 2=D− 3=D+ 4=GND · Type-C: D+/D− on pins (A6/B6)/(A7/B7) in CC-defined orientation

🔁 RS-485 (EIA-485)

Differential, multipoint bus for industrial communications; balanced A/B pair.

Differential levels

Idle A > B (logical 1); driven A < B (logical 0). Range ≈ −7 V to +12 V common-mode.

Termination

120 Ω termination at each cable end for long runs; stub lengths kept short.

Speed vs. length

Coarse rule: 100 m @ 9.6 kbit/s down to ~10 m @ 10 Mbit/s (cable-dependent).

🌍 Ethernet (Twisted Pair)

Auto-negotiated speeds over twisted-pair; pairs are twisted and use differential signaling.

Common speeds

  • 10BASE-T: 10 Mbit/s (2 pairs)
  • 100BASE-TX: 100 Mbit/s (2 pairs)
  • 1000BASE-T: 1 Gbit/s (4 pairs)

1000BASE-T pin mapping

1/2 = Pair B · 3/6 = Pair A
4/5 = Pair C · 7/8 = Pair D

Magnetics

RJ45 usually integrates a magnetics transformer (isolation + common-mode) — plan it into the footprint.

🔢 Common I2C Device Addresses

Common 7-bit addresses (bottom; A0–A2 pins often shift them). Always confirm with the datasheet.

Device7-bit addr Notes
MPU6050 IMU0x68AD0 = 1 → 0x69
BMP280 / BME2800x76or 0x77 (SDO pin)
AT24C02 / 24LC256 EEPROM0x50+ A0–A2 address pins (0x50–0x57)
ADS1115 16-bit ADC0x48+ ADDR pin select (0x48–0x4B)
DS1307 RTC0x68shared by many RTCs
PCA9685 PWM driver0x40+ A0–A5 (0x40–0x7F)
HTU21D humidity0x40also 0x40-based sensors

🚗 CAN (CAN 2.0 / CAN FD)

Differential two-wire bus (CANH/CANL) for robust automotive and industrial links.

Levels

Dominant drives CANH≈3.5 V / CANL≈1.5 V; recessive ≈2.5 V each. Differential: dominant ≈2 V, recessive ≈0 V. Common-mode −2 V…+7 V.

Typical bitrates

Classic: 125 k · 250 k · 500 k · 1 Mbit/s. CAN FD adds a high-speed data phase up to ~5–8 Mbit/s.

Termination

120 Ω at each bus end to avoid reflections; keep stubs short.

Addressing

No device address — each message carries an identifier; receivers filter by ID/acceptance mask.

Keep total cable < ~40 m (typ) for 1 Mbit/s; use twisted/shielded pair and ground the shield at one end.

🧵 1-Wire

Single data line + ground, open-drain with pull-up; every device carries a unique 64-bit ROM address.

Pull-up

~4.7 kΩ pull-up to VDD; strong pull-up helps parasite-power/time-critical ops.

Speeds

Standard ~15.4 kbit/s; overdrive up to ~142 kbit/s.

Addressing

Host reads each device's 64-bit ROM code, then addresses it individually on the single wire.

Only one driver active at a time; parasite power can supply low-power slaves from the data line.

🚌 LIN (LIN 2.x)

Low-cost single-wire automotive sub-bus (12 V). One master, up to 15 other nodes.

Bus

Single wire at Vbat (12 V nominal); recessive ≈ Vbat, dominant ≈ 0 V.

Bitrate

Typical 9.6 / 19.2 kbit/s (up to 20 kbit/s); the master drives the schedule.

Addressing

6-bit frame identifier (0x00–0x3F); communication is role-based on a schedule table (who sends/receives).

⏱️ Protocol Timing Calculators

Convert baud/clock rates to time and throughput for the most common serial interfaces. Results are estimates — confirm against the peripheral datasheet and nominal clock tolerance.

UART Timing

Bit time = 1 / baud. With an 8-N-1 frame (start + 8 data + stop) each byte costs 10 bit-times, so the usable payload rate is 8/10 of the baud rate.
b/s
Bit time
Byte time (8-N-1)
Payload rate
Real throughput depends on flow control, framing overhead and clock error between the two UARTs (allowed ± a few %). On an MCU, baud is often generated from a PLL/peripheral clock that may not divide exactly — check the actual error in software.

I2C Transaction Time

For a 7-bit write of N payload bytes: bits = 11 + 9·N (start, 7-bit address, R/W, ACKs, data, stop). Time = bits / fSCL.
Hz
bytes
Frame bits
Transaction time
Throughput
The slave can stretch SCL or add repeated-start and register-address bytes, which lengthens real transactions. Reads often do an extra address+restart. This is the ideal no-stretch case for a 7-bit write.

SPI Transfer Time

Transfer time = bits / SCLK. Full-duplex shifts a byte in and out on the same clock edge, so time is set purely by the clock and the transfer length.
Hz
bits
Transfer time
Data rate
Max byte rate
The practical clock is limited by the slave's maximum SCLK and by bus wiring (each slave may need a lower clock). In practice chip-select assertion, setup/hold margins and interrupt round trips add overhead well beyond the raw shift time.

CAN Bit Timing

Each bit is a set of time quanta (TQ). Bit rate = fOSC / (prescaler · TQ_total). Sample point = (Sync + Prop+PS1) / TQ_total — place it late (~80–87%) for robustness.
Hz
TQ
TQ
TQ
TQ duration
Bit rate
Sample point
Keep phase2 ≥ SJW at the chosen sample point; the propagation+phase1 segment must cover the bus round-trip time and driver/receiver delays (the length of the network). On classic CAN only 8 data bytes fit; CAN FD uses a faster data phase.

🖼️ Protocol Diagrams

Simplified waveforms and bus topologies for the common serial protocols on this page.

TX START D0 D1 D2 D3 D4 D5 D6 D7 STOP byte example 0x55 (LSB first)

UARTUART frame on TX: idle high; the start bit pulls low, 8 data bits follow LSB-first, optional parity, then 1–2 stop bits high.

VDD Rp Rp SDA SCL Master Slave 1 Slave 2

I2CI2C: START (SDA falls while SCL high) then ADDRESS+R/W byte and ACK. Open-drain lines pulled up — no driver fights.

I2C START · DATA · STOP SDA SCL Start data bit Stop SDA changes only while SCL low START/STOP: SDA while SCL high

I2C start / data / stop timingData bits are stable while SCL is high and may change only when SCL is low. A START is SDA falling while SCL is high; a STOP is SDA rising while SCL is high.

Master Slave SCLK MOSI MISO nSS full-duplex · no addressing

SPISPI: the master drives SCLK, MOSI and chip-select nSS; the slave returns MISO. Full-duplex, no addressing.

Vcm A B idle A>B = 1 driven A<B = 0

RS-485 (EIA-485)RS-485: differential A/B line with a 120 Ω termination at both ends. Idle state A > B (logic 1).

2.5 V CANH CANL recessive diff≈0 V dominant diff≈2 V

CAN (CAN 2.0 / CAN FD)CAN: dominant drives CANH up to ≈3.5 V and CANL down to ≈1.5 V (differential ≈2 V); recessive ≈2.5 V on each wire.

Vector table · lowest address = highest priority priority addr vector & handler 0x00 0 · Reset / MSP 0x04 1 · NMI 0x08 2 · Hard Fault faults & reserved 0x40 IRQ0 · first device IRQ IRQ1 … IRQn entry i stored at 0x0000 + 4·i (ARM Cortex-M)

Interrupt VectorVector table: the lowest address holds the highest-priority entry. Reset, NMI and faults come first, then each device IRQ maps to an entry at offset 4×N (ARM Cortex-M).

NVIC priority grouping · AIRCR.PRIGROUP preemption (upper bits) sub-priority (lower bits) MSB b3 b0 LSB PRIGROUP=0 all preemption · 16 levels PRIGROUP=2 4 preemption × 4 sub PRIGROUP=3 2 preemption × 8 sub Lower value = higher priority · sub-priority orders ties at the same preemption

NVIC Priority GroupingNVIC priority bits split into preemption and sub-priority fields (AIRCR.PRIGROUP). Numerically lower value = higher priority; a higher preemption level can preempt execution. Mapping is device-specific — see your MCU reference manual.

STM32 NVIC IRQ numbers · e.g. STM32F1xx IRQ# NVIC channel / peripheral System: HardFault System: SysTick (#15) 6 EXTI0 / EXTI1 9 EXTI9_5 11 DMA1_Channel1 18 ADC1_2 28 TIM2 31 I2C1_EV / I2C2_EV 35 SPI1 (36 = SPI2) 37 USART1 50 SDIO (39 = USART3) IRQn = vector index − 16 · device-specific — verify with your part's IRQn header

STM32 IRQ DistributionNVIC IRQ numbers for common STM32F1 peripherals: IRQn = vector index − 16 (IRQ0 is the first external interrupt). The mapping is device-specific — confirm against the part's IRQn header.

VDD 3.3 V Host SD Card CLK Rp CMD ↔ DAT0 DAT1 DAT2 DAT3 CLK 0–50 MHz · 1.8/3.3 V · CMD: cmd→resp · DAT0–3: 4-bit data

SDIO / SDSDIO host drives CLK and issues commands on CMD; the card returns responses on CMD and transfers data on DAT0–3 (4-bit mode). CMD/DAT need pull-ups; signaling is 3.3 V or 1.8 V.

SDIO command & response frame CMD · host → card 0 1 tx index 5:0 argument 31:0 CRC7 1 RESP · card → host 0 0 tx index 5:0 card status 31:0 CRC7 1 1 + 1 + 6 + 32 + 7 + 1 = 48 bits · response transmission bit = 0

SDIO Command TokenSD command/response frame: start(0), transmission bit, 6-bit index, 32-bit argument/status, CRC7 and end(1) = 48 bits. Host command transmission bit 1; card response bit 0.

USB FULL-SPEED · D+/D− DIFFERENTIAL HOST (root port) D+ D− shield / GND DEVICE (peripheral) 15 kΩ pull-down 1 kΩ pull-up cable ≤ 5 m host pull-downs detect attach; device D+ pull-up identifies FS

USB differentialD+ and D− carry the data as a differential pair (≈90 Ω); the D+ pull-up on the device tells the host the speed class (full-speed here). Shield guards EMI over the cable.

ETHERNET 100BASE-TX · MDI + MAGNETICS PHY TX+/− RX+/− 1:1 pulse xfmr center tap center taps to chassis GND RJ45 / cable pair 100 Ω differential · TDX/RDX, Auto-MDIX

Ethernet MDIMagnetic isolation transformer sits between the PHY pins and the RJ45 jack; its center taps return to chassis ground. The twisted pair is a 100 Ω differential line with common-mode rejection.