N14 page 1 of
Serial Protocols
device level
RS-232
RS-422
RS-485
USB
CAN
IEEE 1394 Firewire
chip level (all chips on same board with common GND)
SPI
I2C
Layers
electrical layer
1) voltages
a) logic high, logic low
b) single ended, differential
c) distance
d) supply power to another device
2) read/write/tri-state
3) connectors
4) pinouts
5) collision arbitration
byte layer
1) bits per byte, parity
2) lsb first, msb first
3) bit speed
a) fixed baud (start bit, number of stop bits)
b) clocked
4) character encoding (ASCII)
packet layer
1) address
a) receiver device
b) sender device
2) number of bytes
3) checksum
4) collision arbitration
EIA RS-232
between DTE (data terminal equipment) and a DCE (data communication equipment = modem)
originally current loop driven, later changed to voltage level driven
UART (universal asynchronous receiver transmitter)
software UART emulation
hardware UART buffer size
inverted logic
logic HI = 1 = mark = -3V to -25V
logic LO = 0 = space = +3V to +25V
originally D25 connectors
point-to-point connections use one receiver per transmitter
no collision detection needed
DTE = D9 male TD pin 3 RD pin 2 signal GND pin 5 chassis GND pin 9
DCE = D9 female TD pin 2 RD pin 3 signal GND pin 5 chassis GND pin 9
handshaking lines
DCD (data carrier detect) into DTE pin 1
DTR (data terminal ready) from DTE pin 4
DSR (data set ready) into DTE pin 6
RTS (request to send) from DTE pin 7
CTS (clear to send) into DTE pin 8
most common is 8 data bits, no parity bit, 1 stop bit (8N1) = 10 bits / byte (1 start, 8 data, 1 stop)
fixed baud rate (bits per second) = 300, 1200, 2400, 4800, 9600, 14400, 19200
can now use 28.8 K, 38.4 K, 57.6 K, 115.2 K
old teletypes = 110 baud (2 stop bits)
hold line at logic HI
drop line to logic LO for start bit with duration (1/baud) seconds
transmit data bits at fixed rate with lsb first and msb last
transmit parity bit if needed
hold line at logic HI for stop bit(s)
RS-232 ASCII cap K= hex 4B= 0100 1011
TTL level ASCII cap K = hex 4B = 0100 1011
usually use prearranged baud rate between devices
can have auto baud recognition
be careful of data over-run if UART does not have a buffer or CPU cannot keep up
may need to flush UART buffer to get most recent information
hex 4B = cap K
50 feet maximum
only one receiver per transmitter
does not explicitly provide power to DCE (some “port powered” devices parasite from RTS)
requires TTL/CMOS logic to RS-232 level drivers - MAX232 chip
http://www.beyondlogic.org/serial/serial1.htm#40
no standard packet protocol
legacy COM port on PC
Share with your friends: |