Embedded Communication Protocols Don Heer 10/18/10 1
2 Overview What is a protocol? Synchronous vs. Asynchronous Serial Peripheral Interface I 2 C Universal Asynchronous Receiver/Transmitter Gotchas
What is a protocol? Common agreed on communication Serial or Parallel Often Standardized Designed for specific purposes 3
Synchronous vs. Asynchronous Clocked vs. Non-clocked Why? 4
Serial Peripheral Interface Synchronous Master Out Slave In (MOSI) Master In Slave Out (MISO) Clock (SCLK) Chip Select Technically not part of protocol 5
SPI Modes ModeClock 0Clock normally Low. Data Read on Rising Edge. Data Changed on Falling Edge 1Clock Normally Low. Data Read on Falling Edge. Data Changed on Rising Edge 2Clock Normally High. Data Read on Falling Edge. Data Changed on Rising Edge 3Clock normally High. Data Read on Rising Edge. Data Changed on Falling Edge 6 Modes exist to allow for flexibility
SPI Waveform Mode 0 Mode 2 7
Example Devices 8 Microcontrollers ATMEGA128 EEPROM Memory AT25020
I2CI2C Two wire interface Addressing Scheme Open Drain Bus Drivers Multi-Master 9
I 2 C Waveform ACK = Target holds SDA low NAK = Target lets SDA float (pulls up) 10
I 2 C Example Devices Clocks PCF8563T (Page 21) PCF8563T Digital Resistors MCP4541T-103E 11
Universal Asynchronous Receiver/Transmitter RS232 vs. ‘UART’ Speed 12
UART Waveform 8N1 (8 bits, No Parity, 1 Start and Stop) NOTE: LSB is first 13
Example Devices Motor Controllers RoboteQ ax
Gotchas Watch that you don’t swizzle lines Watch your voltages! Intermittent connections Long wires Resets vs. Chip Selects 15
Summary Protocols help to ensure that everything works together Use them if at all possible 16