Top Banner
Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross
16

Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.

Jan 12, 2016

Download

Documents

Kimberly James
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.

Lecture 20: Communications

Lecturers:Professor John Devlin

Mr Robert Ross

Page 2: Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.

Overview

• Communications overview

• Overview: UART (RS-232)

• Brief overview:– I2C– SPI– 1-Wire

2

Page 3: Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.

Digital Communications

• Different types of communication: – Serial – data only transmitted one bit at a time on one

lane (per direction) (differential pairs of signals are referred to as a lane)

– Parallel – data transmitted typically words at a time (on different lines) with additional lines for parity and control (Typically doesn’t use lanes)

• Different types of signals:– Data – The message which is to be sent – Control – Signals used to ensure to control the flow of

data, eg. Clock, start of frame, end of frame

3

Page 4: Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.

Universal Asynchronous Receiver/Transmitter UART

• Common standard: RS-232• Three wires used:

– Transmit – Receive– Ground

• Data encapsulated as 7 or 8 bit chunks• Optional Parity – monitor data integrity• Allow serial communication between

devices4

Page 5: Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.

Asynchronous

• Signals are self clocking – no separate clock is transmitted with data

• Receiver must lock onto data and decode individual bits without using a specific receive clock

5

Page 6: Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.

Operation

• UARTs have two sectors:– Receive (RX): read the incoming serial bit-

stream, converts to parallel data (Serial to Parallel Conversion)

– Transmit (TX): converts parallel data from the microprocessor registers into a serial bit-stream to transmit (Parallel to Serial Conversion)

• Receiver has to detect phase of incoming data and phase lock it’s local clock to the data pattern

6

Page 7: Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.

Parity Bit

• Parity is a simple check to verify data integrity

• An extra bit is added to each byte (or a defined chunk of data) called a parity bit

• 4 different cases:– Even Parity: Even number of bits in total– Odd Parity: Odd number of bits in total– Mark Parity: Parity bit is always ‘1’– Space Parity: Parity bit is always ‘0’

7

Page 8: Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.

Parity Bit

• For each byte the number of ‘1’s is summed• In even parity this sum should be even (parity bit

is set to make it even)• In odd parity this sum should be odd (parity bit is

set to make it odd)• Example:

– 10010111 (5 ‘1’s present)• If even parity: parity bit should be ‘1’• If odd parity: parity bit should be ‘0’

8

Page 9: Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.

Parity Bit

• Receiver performs same parity count – if it doesn’t match the receiver knows that the data wasn’t received correctly

• What is a problem with Parity?– Only detects odd numbers of bit errors

effectively

9

Page 10: Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.

UART interfacing

Microprocessor

UART deviceExamples:

GPS ReceiverBluetooth Transceiver

TXRX

RXTX

10

Page 11: Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.

UART RS-232 interfacing

• RS-232 is the serial standard used on PC serial ports

• The voltage levels are inverted and have a larger swing than most microprocessors provide

• Use a specialised IC to convert: eg. MAX232

MicroprocessorPC

TXRX

RXTX

MAX232

11

Page 12: Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.

I2C

• Inter-Integrated Circuit

• Developed by Philips

• Multi-master serial computer bus

• Two wires – configured as open drain lines, pulled up with resistors– SDA: Serial Data– SCL: Serial Clock

12

Page 13: Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.

I2C

• Master sends Start bit, followed by address of desired slave followed by read/write bit

• Slave sends acknowledgement• Master continues in requested mode (read or write),

slave continues in complementary mode (write or read) until stop bit is sent

• Communications are in Big Endian bit format – most significant bit first

• Start bit: high->low transition of SDA with SCL high• Stop bit: low->high transition of SDA with SCL high

13

Page 14: Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.

SPI

• Serial Peripheral Interface Bus

• Developed by Motorola

• 4 signals used:– SCLK: Serial Clock (from master)– MOSI: (Master Output, Slave Input)– MISO: (Master Input, Slave Output)– SS: (Slave Select) (one pin for each slave device)– http://en.wikipedia.org/wiki/

Serial_Peripheral_Interface_Bus

14

Page 15: Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.

SPI

• Allows full duplex (bi-directional at the same time) communication

• Higher throughput than I2C• No flow control• Short distance communication• Applications:

– SD Memory cards– Sensors– Memory– IC communications

15

Page 16: Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.

Summary

• Digital communications is the process where digital devices exchange data encoded in a bit format

• Communications can occur in two forms (with various adaptations of each) – serial or parallel

• UART, I2C and SPI are common methods used for serial communications

16