#Why this matters
Before an embedded device sends a network packet, its chips exchange boot logs, calibration values, and firmware images over board-level buses. Engineers leave UART headers for boot logs, wire external flash over SPI, attach sensors via I2C, and program silicon over JTAG or SWD. In a hardware assessment or CTF challenge, capturing and decoding these signals often reveals bootloaders, root shells, and unencrypted secrets.
#Comparing board-level buses
Each hardware bus trades wire count, speed, and addressing differently. Recognizing the physical wiring narrows down which protocol decoder to run.
| Bus | Typical wires | Clocking | Addressing / selection | Typical role |
|---|---|---|---|---|
| UART | TX, RX, GND | Async (shared baud rate) | Point-to-point | Bootloader and OS consoles |
| SPI | SCLK, MOSI, MISO, CS, GND | Sync (SCLK) | Active-low CS per chip | NOR flash, displays, radios |
| I2C | SDA, SCL, GND (+ pull-ups) | Sync (SCL) | 7-bit or 10-bit address | Sensors, RTCs, EEPROMs |
| JTAG / SWD | TCK, TMS, TDI, TDO (or SWDIO/SWCLK) | Sync test clock | TAP state machine | CPU halt, flash programming |
- Probe GND and VCCConfirm 3.3V or 1.8V logic
- Capture with analyzerSample >= 4x bit rate
- Identify bus patternAsync = UART; CS+CLK = SPI; 9th-clock ACK = I2C
- Decode protocolRun sigrok-cli or Saleae Logic
#UART: asynchronous framing and serial consoles
UART has no clock wire. Both ends must share the same baud rate, data width, parity, and stop bits (most commonly 115200 8N1: 115200 bps, 8 data bits, no parity, 1 stop bit).
At idle, TX sits high (1). Each frame starts with a low start bit (0), sends 8 data bits least-significant bit (LSB) first, and finishes with a high stop bit (1). To determine an unknown baud rate in Saleae Logic or PulseView, measure the narrowest single-bit pulse T:
Taround 8.68 microseconds (1 / 0.00000868) = 115200 bps.Taround 104 microseconds (1 / 0.00010417) = 9600 bps.Taround 17.36 microseconds = 57600 bps.
Sample at least 4 to 10 times faster than the bit rate so edges align cleanly.
$ sigrok-cli -i board_boot.sr -P uart:rx=D0:baudrate=115200:format=ascii
uart-1: "U-Boot 2022.04-lab (Oct 12 2025)\r\n"
uart-1: "Hit any key to stop autoboot: 2 \r\n"When connecting live with a 3.3V USB-to-UART adapter, cross-wire TX and RX (Adapter RX -> Target TX, Adapter TX -> Target RX) and share GND. Open the console with minicom (disabling hardware flow control when RTS/CTS are unwired):
minicom -D /dev/ttyUSB0 -b 115200 -o#SPI and I2C: synchronous transfers
Unlike UART, SPI and I2C carry an explicit clock line driven by the controller, so small clock jitter does not break decoding.
#SPI flash and peripherals
SPI uses four main signals: SCLK (clock), MOSI (Controller Out, Peripheral In), MISO (Controller In, Peripheral Out), and an active-low Chip Select (CS# or SS). While CS# is pulled low, every clock cycle shifts one bit out on MOSI and simultaneously shifts one bit in on MISO.
Two configuration bits define the SPI mode:
- CPOL (Clock Polarity):
0means SCLK idles low;1means SCLK idles high. - CPHA (Clock Phase):
0samples data on the leading clock edge;1samples on the trailing edge.
Most SPI NOR flash chips operate in Mode 0 (CPOL=0, CPHA=0) or Mode 3 (CPOL=1, CPHA=1). In a logic capture of an SPI flash boot, you commonly see MOSI send an opcode such as 0x9F (Read JEDEC ID) or 0x03 (Read Data) followed by a 24-bit address, while MISO returns the flash bytes.
#I2C open-drain communication
I2C uses only two signal wires, SDA (data) and SCL (clock), pulled high through resistors. Any device can pull a line low, creating a wired-AND bus.
Notice the 9th clock pulse after every 8 bits: the receiver pulls SDA low for ACK (acknowledged) or leaves it high for NACK. When decoding an I2C capture in sigrok-cli, specify both scl and sda channels:
$ sigrok-cli -i eeprom_read.sr -P i2c:scl=D0:sda=D1
i2c-1: Start
i2c-1: Address write: 50
i2c-1: Data write: 00
i2c-1: Start repeat
i2c-1: Address read: 50
i2c-1: Data read: 4B
i2c-1: Data read: 45
i2c-1: Data read: 59
i2c-1: StopThe hex bytes 4B 45 59 decode to ASCII KEY. Be careful with address notation: datasheets sometimes write the 7-bit address 0x50 in 8-bit shifted form (0xA0 for write, 0xA1 for read), because the R/W bit occupies the least-significant bit on the wire.
#JTAG and SWD debug interfaces
JTAG (IEEE 1149.1) uses TCK, TMS, TDI, and TDO (plus optional TRST) to drive a Test Access Port (TAP) state machine. ARM microcontrollers often replace or supplement JTAG with two-pin SWD (SWDIO and SWCLK).
During manufacturing, engineers use JTAG or SWD to flash firmware and run boundary-scan checks. If left unlocked on a retail board, an attacker with a hardware debugger (and tools such as OpenOCD) can halt the CPU, read internal flash even when the network stack is locked down, or single-step cryptographic routines.
#Defending hardware interfaces and common mistakes
Common analysis mistakes in the lab:
- Forgetting common ground (
GND): Without a shared ground reference, signal thresholds float and decoders show random garbage. - Wrong SPI mode or UART baud rate: If decoded UART text shows unreadable symbols or framing errors, recalculate the shortest bit width. If SPI bytes appear shifted by one bit, toggle
CPHAorCPOL. - Mixing up 7-bit and 8-bit I2C addresses: Protocol analyzers such as
sigroktypically report the 7-bit address (0x50), while some device datasheets list0xA0/0xA1.
Hardening recommendations for engineers:
- Lock JTAG and SWD in silicon: Blow one-time programmable (OTP) eFuses or enable readout protection (RDP) before shipping production hardware.
- Disable interactive boot consoles: Remove
Hit any key to stop autobootdelays, disable root login on UART, and enforce cryptographic signature verification (Secure Boot). - Protect data at rest on external buses: Because SPI flash and I2C EEPROM traces are easy to tap with test clips, do not store unencrypted private keys or shared secrets in external memory.
#Summary
Board-level interfaces expose how embedded chips communicate before network security controls apply. UART carries asynchronous serial consoles whose baud rate equals the inverse of the shortest bit duration, SPI transfers high-speed full-duplex frames controlled by CS# and CPOL/CPHA mode, I2C coordinates multiple peripherals with 7-bit addresses and 9th-clock ACKs, and JTAG/SWD provide direct CPU debug access. Capturing these signals safely with sigrok or Saleae Logic reveals hidden consoles and external flash reads, underscoring why production devices must lock debug fuses, disable boot prompts, and protect secrets stored on external buses.