Computer communication. Introduction Mechanisms applied in communicating between a computer and another computer or with other devices. Mainly serial.

Slides:



Advertisements
Similar presentations
Protocol Layer Bottom-up view of the USB protocol Bottom-up view of the USB protocol –Byte/Bit Ordering –SYNC Field –Packet Field Formats PID Field PID.
Advertisements

Universal Serial Bus Grant Heileman. The History of USB In 1994 a collaborative effort to design a standard for peripheral devices was made between Compaq,
Serial I/O - Programmable Communication Interface
Lecture 8: Serial Interfaces
1 Fall 2005 Local Serial Asynchronous Communication Qutaibah Malluhi Computer Science and Engineering Qatar University.
USB: Data Flow Sukesh Shenoy. USB implementation areas.
Data Transmission Most digital messages are longer than just a few bits. It is neither practical nor economic to transfer all bits of a long message simultaneously.
Long distance communication Multiplexing  Allow multiple signals to travel through one medium  Types Frequency division multiplexing Synchronous time.
1 K. Salah Module 4.0: Data Link Layer The Logical Link Control (LLC) sublayer –Framing –Flow Control –Error Control The Media Access Control (MAC) sublayer.
Chapter 6: Errors, Error Detection, and Error Control
CSCI 4550/8556 Computer Networks Comer, Chapter 5: Local Asynchronous Communication (RS-232)
Network Data Organizational Communications and Technologies Prithvi N. Rao Carnegie Mellon University Web:
7-1 Digital Serial Input/Output Two basic approaches  Synchronous shared common clock signal all devices synchronised with the shared clock signal data.
USB 2.0 INTRODUCTION NTUT CSIE 學 生:許家豪 指導教授:柯開維教授.
Data Transmission Most digital messages are longer than just a few bits. It is neither practical nor economical to transfer all bits of a long message.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 15 PC Standard Bus Interfaces WK.
Input/Output and Communication
ECE 371- Unit 11 Introduction to Serial I/O. TWO MAJOR CLASSES OF SERIAL DATA INTERFACES ASYNCHRONOUS SERIAL I/O - USES “FRAMING BITS” (START BIT AND.
Local Asynchronous Communication
Local Asynchronous Communications. Bit-wise data transmission Data transmission requires: Encoding bits as energy Transmitting energy through medium Decoding.
USB: UNIVERSAL SERIAL BUS Joe Kaewbaidhoon Alex Motalleb Vishal Joshi Prepared for EECS 373 University of Michigan, Ann Arbor 1.
INPUT-OUTPUT ORGANIZATION
Embedded Systems Design
University of Tehran 1 Interface Design Serial Communications Omid Fatemi.
Technology Training that Works Hands of Data Communications, Networking & TCP/IP Troubleshooting.
Transmission Modes Serial Transmission  One bit is transmitted on a circuit at a time  Usually there is one transmit circuit and one receive circuit.
Computers in Surveying SVY2301 / E4006 Automated Surveying.
Introduction Electrical Considerations Data Transfer Synchronization Bus Arbitration VME Bus Local Buses PCI Bus PCI Bus Variants Serial Buses 11/06/20141Input/Output.
Serial Port I/O Serial port sends and receives data one bit at a time. Serial communication devices are divided into: Data Communications Equipment (DCE),
ECE 371 – UNIT 20 Universal Serial Bus (USB). References 1. Universal Serial Bus Specification, Revision 2.0. This specification is available on the World.
Universal Synchronous/Asynchronous Receiver/Transmitter (USART)
Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.
Data Link Layer - 1 Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS School of Computing, UNF.
Line Coding, Modem, RS232 interfacing sequences.
Universal Asynchronous Receiver/Transmitter (UART)
Serial Communications
Advanced Embedded Systems Design Lecture 8 Serial I/O BAE Fall 2004 Instructor: Marvin Stone Biosystems and Agricultural Engineering Oklahoma.
Chapter 5: Local Asynchronous Communication 1. Bit-wise data transmission 2. Asynchronous communication 3. Sending bits with electric current 4. Standard.
DEVICES AND COMMUNICATION BUSES FOR DEVICES NETWORK
1 Data Link Layer Lecture 20 Imran Ahmed University of Management & Technology.
BR 6/001 Universal Serial Bus Universal Serial Bus is a new synchronous serial protocol for low to medium speed data transmission Full speed signaling.
ECS 152A 4. Communications Techniques. Asynchronous and Synchronous Transmission Timing problems require a mechanism to synchronize the transmitter and.
 8251A is a USART (Universal Synchronous Asynchronous Receiver Transmitter) for serial data communication.  Programmable peripheral designed for synchronous.
Data and Computer Communications Chapter 6 – Digital Data Communications Techniques.
Data and Computer Communications by William Stallings Eighth Edition Digital Data Communications Techniques Digital Data Communications Techniques Click.
Universal Asynchronous Receiver/Transmitter (UART)
Computer communication. Introduction Mechanisms applied in communicating between a computer and another computer or with other devices. Mainly serial.
Data Communications & Computer Networks, Second Edition1 Chapter 6 Errors, Error Detection, and Error Control.
Data Link and Flow Control Networks and Protocols Prepared by: TGK First Prepared on: Last Modified on: Quality checked by: Copyright 2009 Asia Pacific.
Digital Interfaces An interface links two devices Interface Standards define: – mechanical specifications - how many wires & connector type –electrical.
FUNDAMENTALS OF NETWORKING
Unit 1 Lecture 4.
FIT1005 FIT – Monash University
CE-2810 Dr. Mark L. Hornick 1 Serial Communications Sending and receiving data between devices.
Chapter Nine: Data Transmission. Introduction Binary data is transmitted by either by serial or parallel methods Data transmission over long distances.
BASICS OF SERIAL COMMUNICATIONS BIRLA VISHWKARMA MAHAVIDYALAYA ELECTRONICS & TELECOMMUNICATION DEPARTMENT PRESENTING BY: ABHISHEK SINGH AMANDEEP.
Serial Communications
Chapter 9: Data Link Control
USB PHYISICAL LAYER PROTOCOL ENGINE LAYER APPLICATION LAYER
Data Link Layer.
Serial I/O and Data Communication.
Local Asynchronous Communication (RS-232)
DIGITAL DATA COMMUNICATION TECHNIQUES
USB : Universal Serial Bus
Serial Communication Interface: Using 8251
Chapter Nine: Data Transmission
Serial Communications
Chapter 9: Data Link Control
Data Link Layer. Position of the data-link layer.
Introduction Communication Modes Transmission Modes
Presentation transcript:

Computer communication

Introduction Mechanisms applied in communicating between a computer and another computer or with other devices. Mainly serial (bit by bit) while in the I/O interface section, we have already studied the parallel communication (byte-wise) Serial Communication and the Universal Serial Bus (USB) are the most commonly used. A brief discussion will be given

Serial communication Serial communication is used for connecting peripheral units, such as display, modems, to a microcomputer Serial communication is a one-to-one communication, ie. only one device is connected to the communication interface Data (8-bit) is exchanged in a bit-by-bit manner or serially Only 3 wires (send, receive, and ground) to setup a communication link between two devices For serial communication, there are two types of transfer mode – asynchronous and synchronous

Serial communication Synchronous – requires a clock signal to synchronize the transmitter and the receiver Asynchronous communication, without a common clock, uses pre- defined protocol to achieve the data transfer

Asynchronous communication Data transfer is not sent in predefined time slots because there is no common clock. Data transfer can start at any given time The hardware connector for asynchronous communication is the RS232 connector. The setup in the lab-session, the connection between the PC and the ADuC832 board is via asynchronous communication.

Asynchronous communication Interface consists of receive data, transmit data, and signal common (no common clock) Data are sent one character at a time (the data bit varies in different systems, but usually either 7, or 8 bits are used) Both receiver and transmitter must agree on the number of data bits, as well as the baud rate (bits per second to be transmitted) Receiver examines synchronization bits that are included at the beginning and end of each character Start bit, parity bit and stop bit are used for synchronization

Asynchronous communication

Data bits are sent with a predefined frequency - baud rate. Both the transmitter and receiver must use the same bit frequency. If the transmitter is sending at 9600 baud but the receiver is running at baud then every bit sent by the transmitter will equal to 2 bits at the receiver side!!!!! After the first bit (the start bit) is received, the receiver calculates at which moments the other data bits will be received. It will check the line voltage levels for the stop bit (a ‘1’) at those moments.

Example For example, if the receiver gets the first bit at time X, and the pre-defined transfer rate is 9600 baud, 8-bit per character and 1 stop bit, no parity then the stop bit should be received at X ms (9x 1/9600).

Asynchronous communication operation sequence 1.A start bit is sent first – a ‘0’. Since the communication line is kept at ‘1’ when there is no data so a 1->0 transition in the line will indicate a possible start bit 2.The data bits follow the start bit 3.A stop bit is sent (stop bit has a value of ‘1’) 4.The stop bit can be detected correctly even if the previous data bit also had a value of 1, due to timing as stated previously. 5.Stop bits can be 1, 1.5, or 2 bit periods in length.

Operation sequence 1.The parity bit is optional. A parity bit affords a small amount of error checking, to help detect data corruption that might occur during transmission 2.Either even or odd parity can be used

Parity bit for error checking Parity could be even or odd When even parity is chosen, the parity bit is transmitted with a value of ‘0’ if the number of preceding `1` is an even number (i.e including the parity bit, the total data bits sent have a even number of ‘1’ if even parity is used). Even parity => no. of ‘1’ in data + parity bit = even ODD parity => no. of ‘1’ in data + parity bit = odd

Parity for error checking Example If the data is (with 5 1s – odd) using even parity then the parity bit is ‘1’ so the total number of ‘1’ sent is even. However, if odd parity is used then the parity bit is ‘0’ so total number of ‘1’ sent is ODD.

Parity bit If the original data is now if odd parity is used then the parity bit is ‘0’ so data being sent is if the received data is then comparing the received data and the parity bit “0” then you can detect possible error in the data and resending the data if necessary. But if the received data is then comparing to the parity then no error can be detected. So parity bit is not a very useful technique to detect communication errors and usually not included in the data stream in order to reduce overhead

Configure the serial communication port under WindowsXP

Question A device is connected to a computer via a serial asynchronous communication link (RS232). If the device can transmit 800 characters per second. What is the possible setting of the communication port? –The baud rate is 9600, with 1 stop bit and no parity –The baud rate is 19600, with 2 stop bit and 2 parity bits –The baud rate is 9600, with 2 stop bit and 1 parity –The baud rate is 4800, with 1 stop bit and no parity

Serial communication Serial communication is character based You send ASCII characters not values So if you want to send 101 then you need to convert the value 101 into ‘1’’0’’1’ three characters The values being sent are = ASCII of 1; 48 = ASCII of 0 At the receiving end, you need to convert the string back to value

Different kinds of communication links Simplex communication link – with one communication link and for a single direction Half-duplex – data are transmitted and received over the same line, and transmission and reception cannot take place at the same time Full duplex – with separate transmit and receive lines. Data can be transferred in both directions at the same time

The physical connection The serial data interface for a PC is usually via the RS232C connector. RS Recommend Standard number 232 and C is the latest revision of the standard. The serial ports on most computers use a subset of the RS-232C standard. The full RS-232C standard specifies a 25-pin "D" connector of which 22 pins are used. Most of these pins are not needed for normal PC communications, and indeed, most new PCs are equipped with male D type connectors having only 9 pins.

R2232C 1.Incoming signal 2.Incoming data 3.Outgoing data 4.DTR 5.Ground 6.DSR 7.RTS 8.CTS 9.Ring indicator Pin 1 and 9 are only available in Connection to a modem

RS232 The voltage level used to represent a ‘0’ (also called a space) is +5 to +15 for transmitter, and +3 to +25 for receiver. The voltage level for ‘1’ (or mark) is -5 to -15 on the transmitter and -3 to -25 on the receiver. The maximum transfer rate is 1.5Mbps. The maximum cable length is 50 feet. A device (such as the MAX232) is used to convert the voltage level from 0V and 5V to the +V to –V used by the RS232 standard.

Hardware configuration UART built-in

Applications PC ADuC832 Motor Using a PC to control a motor can be done via a ADuC832 PC talks to ADuC832 via the serial communication ADuC832 control the motor using Ports (just like the lab exercise) RS232 Communication is via the RS232 so PC sends characters to the ADuC832 PC may send a ‘1’’0’ to represent 10% duty cycle

USB to serial converter Modern computer (especially notebook) has only USB Connectors A USB to serial converter can convert the USB signal to RS232 signal so traditional serial communication techniques can still applied.

Universal Serial Bus (USB) The most popular interface between a computer and external devices in modern computer system Provides low to medium speed serial interface It is a bus – many devices can attach to the bus at the same time but RS232 is a one-to-one connection

Basic USB 2.0 Support three different communication speed: High-speed (480 Mb/s), full-speed (12Mbit/s) low-speed (1.5 Mb/s). Cable lengths are limited to 5 meters maximum for full-speed and 3 meters maximum for low-speed interface The USB uses a tiered star topology The supported devices are connected to the system host via nodes on USB hubs

USB connection Universal Serial Bus Many devices can connect to the bus at the same time

USB hub architecture Root hub

Basic USB Each device in a USB system is assigned an unique address when first attached to the bus. This process is called bus enumeration. As many as 127 different devices can be accommodated. When a USB device is first attached to a hub, the host assigns it with an address and establishes a connection between itself and the device. The characteristics of this connection provide speed, direction, required bandwidth, error-handling requirements, transfer type, maximum packet size. All these are referred to as a pipe.

USB connector There are 4-pin on the connector USB devices can be powered directly from the USB connection as long as the current drawn is less than 100mA per device The receiver defines a differential ‘1’ as D+ 200mV greater than D- and a differential ‘0’ as D+ 200mV less than D-. This is called bi-phase

USB connector PinSignal 15.0V 2-Data 3+Data 4Ground Type B connector +D > -D 200mv then it is a ‘1’ +D< -D 200mV then it is a ‘0’

USB data For RS232, there are the start bit, stop bit In USB, data transfer is more complicated and there are encoding as well as error detection, data are sent in packet Encoding - NRZI (non-return to zero inverted) data encoding for transmitting packets of data

NRZI NRZI – ‘1’ is represented by no change in signal level and ‘0’ is represented by a change in level. Example - a string of ‘0’ causes the NRZI data toggle at each bit time, while a string of ‘1’ causes long period with no transition in the data. When a logic 1 is transmitted for six bits in a row a sync bit is added. This is called bit- stuffing The sync bit is a logic 0

NRZI Example: assume idle state is ‘1’ Data: NRZI : Data are always transmitted beginning with the LSB first, followed by subsequent bits Data

NRZI Example – (assume idle is ‘1’) –Result – (assume idle is ‘0’) –Result Stuff bit

Flow chart for NRZI Data being sent

USB data communication USB is a one to many connection so the data transmitted is more complicated To begin communication, a sync byte (80H) is transmitted first, followed by the packet identification byte (PID) Packet contains many bytes of data but in RS232 it is character (8-bit) based The PID contains 8 bits, the rightmost 4 bits contain the type of packet that follows, if any. The left most 4 bits are complementing the rightmost 4 bits and this help detecting errors. Example: if 1000 is sent then PID is

Packet format

USB packet Token, Start of Frame, Data, Handshake – are packet types Only the host can issue the token packet and the token packet will determine action to be taken in the subsequent transmission. Handshake signals are employed in order to secure the data communication.

PID codes PIDNameTypeDescription E1HOUTTokenHost -> function transaction D2HACKHandshakeReceiver accepts packet C3HData0DataData packet PID even A5HSOFTokenStart of frame 69HINTokenFunction -> host transaction 5AHNAKHandshakeReceiver does not accept data 4BHData1DataData packet PID odd 3CHPRESpecialHost preamble 2DHSetupTokenSetup command 1EHStallTokenStalled

Packet format

CRC –cyclic redundancy checks CRC is used for error detection A transmitted bit stream (M-bit) is appended with a n-bit FCS (frame check sequence) so that the result, the cascading, (M+n bits) divided by P (the CRC polynomial) has NO remainder P is n+1 bits – and the FCS appended to the data has n bits Two types of CRC are used in USB communication 5-bit CRC and 16-bit CRC

CRC Original data M bits Appended FCS n bits Total data transferred M+n bits Error check (M+n) / P with no remainder then data is correct P has n+1 bits and is called the polynomial

CRC polynomial 5-bit CRC is generated by X 5 + X polynomial; P = bit CRC is generated by X 16 +X 15 +X 2 +1 P =

How to determine the FCS FCS is the remainder of M (original data) * 2 n (ie shift M n bits to the left and append n 0s ) divided by P For example is M is and n is 4 Then M * 2 n – Next / P to determine the remainder

CRC example Example : original P is = X 5 +X 4 +X 2 +1 (P has 6 bits) Appending 5 0’s get Do the division by XOR (not by normal division!!!!)

XOR111011Appended 0s XOR

Question Based on the concept of CRC (cyclic redundancy checks), if the original message is and the constant divisor is Determine the transmitted message in hexademical.

CRC creation process Get the raw frame or raw data Left shift the raw frame by n bits and the divide it by P (using XOR) The remainder of the last action is the FCS. Append the FCS to the raw frame. The result is the frame to transmit

CRC check process Receive the frame. Divide it by P. Check the reminder. If not zero then there is an error in the frame

Packet contents The ADDR – address field specifies which device the packet is designated for. Since USB can support up to 127 devices so ADDR is only 7 bits ENDP – endpoints which is the source or sink of data. Example, if a device can read/write then there will be 2 different endpoints Start of Frame Packet (SOF) are issued by the host at a nominal rate of once every 1ms. The SOF packet delivers two pieces of timing information and is used by “frame timing” related devices such as video/audio streaming. CRC – for error checking

Flow-control Token packets indicate the type of transaction to follow. There are 3 types of token packets: IN, OUT, and SETUP. IN – informs the USB device that the host wishes to read information OUT – host wishes to send information SETUP – used to begin control transfers Tokens are only sent by the host, never a device. IN and OUT tokens contain a 7-bit device address and command the device to transmit DATA packets, or receive the following DATA packets, respectively.

Token Packet ACK and NAK tokens are used to coordinate the transfer of data packets between the host system and the USB device. Host transfers a data packet to a USB device, the device must either transmit an ACK (acknowledge) or a NAK (not acknowledge) token back to the host. If data and CRC are received correctly then ACK is sent; if not NAK is sent If the host received the NAK then it re-transmits the data packet until the receiver finally receives it correctly. The flow control method is called stop and wait flow control. The host must wait for the client to send an ACK or NAK before transferring additional data packets

Flow-control 1.Host issues OUT token (host wants to send data to a device) 2.Data Packet follows (host sends the data packet) 3.Wait for Ack Handshake from device