Embedded Systems Notes on Communication Interfaces
Embedded communication interfaces
Start with a known example, compile it, and adapt it for reliability. Embedded hardware supports communication, input, and output. Typical components include sensors, actuators, user interfaces, communication peripherals, and power supplies. External hardware can be added through these interfaces.
UART and serial communication
A communication protocol defines how shared signaling distinguishes data from framing or control information. Serial links can be simplex, half-duplex, or full-duplex. Asynchronous protocols commonly serve lower data rates. Synchronous protocols use a clock and are often used for higher rates.
An asynchronous character frame commonly includes a low start bit, five to eight data bits, optional parity, and one or two high stop bits. Stop bits give the receiver time before the next character. Both ends must agree on frame format, baud rate, and parity. Send and receive buffer depth affects performance.
Before sending, check for a full transmit buffer and determine whether the shift register has finished when needed. Common receive errors include parity errors, framing errors, and overruns when software does not read data in time.
RS-232C
RS-232C is point-to-point. It uses larger voltage swings than TTL. For data signals, logical 1 is roughly −3 to −15 V and logical 0 is +3 to +15 V. Control lines use positive voltage for asserted and negative voltage for deasserted. MC1488/1489 were used with external supplies for TTL conversion. MAX232-family alternatives differ in supply voltage and required capacitors. Protect the transceiver against line faults.
RS-485
RS-485 supports multiple nodes on a differential bus, which helps reject common-mode interference. The driver produces a differential voltage whose polarity represents the data value. Repeaters can extend distance or divide a network into segments. Check polarity, termination at the far ends, stub lengths, and line protection.
Reliability checklist
- Handle timeouts, reinitialization, and receive-buffer overruns.
- Choose the stop-bit duration to meet throughput and receiver timing requirements. Some configurations use 1.5 bit periods.
- Budget transmitter and receiver baud error. The original notes refer to ±2.5% as a rule of thumb. Consider external oscillators and divider selection.
- Define framing, turnaround delay, checks, inter-frame time, and frame length.
- Choose a baud rate appropriate to the link distance.
I²C, SPI, and 1-Wire
I²C uses a data line (SDA) and clock line (SCL). Open-drain lines require pull-ups. Devices share the bus and are selected by address. A transfer can issue repeated START conditions before a STOP releases the bus.
Related interfaces include SPI and 1-Wire.