0% found this document useful (0 votes)
17 views11 pages

USB

IP packets contain a header and payload. The IP header includes information like the version number, source and destination addresses, flags, time to live, and checksum. This allows routers to properly deliver packets across networks. USB is a standard interface that connects devices like keyboards, mice and printers to computers. It supports faster transfer rates than older ports. USB packets contain fields like sync, packet ID, address, endpoint, CRC and end of packet to control data exchange and detect errors. Transactions involve token, data and handshake phases to successfully transfer data.

Uploaded by

Marupaka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views11 pages

USB

IP packets contain a header and payload. The IP header includes information like the version number, source and destination addresses, flags, time to live, and checksum. This allows routers to properly deliver packets across networks. USB is a standard interface that connects devices like keyboards, mice and printers to computers. It supports faster transfer rates than older ports. USB packets contain fields like sync, packet ID, address, endpoint, CRC and end of packet to control data exchange and detect errors. Transactions involve token, data and handshake phases to successfully transfer data.

Uploaded by

Marupaka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Internet Protocol being a layer-3 protocol (OSI) takes data Segments from layer-4 (Transport)

and divides it into packets. IP packet encapsulates data unit received from above layer and add to
its own header information.

IP Encapsulation

The encapsulated data is referred to as IP Payload. IP header contains all the necessary
information to deliver the packet at the other end.

IP Header

IP header includes many relevant information including Version Number, which, in this context,
is 4. Other details are as follows:

Version: Version no. of Internet Protocol used (e.g. IPv4).

IHL: Internet Header Length; Length of entire IP header.

DSCP: Differentiated Services Code Point; this is Type of Service.

ECN: Explicit Congestion Notification; It carries information about the congestion seen in the
route.
Total Length: Length of entire IP Packet (including IP header and IP Payload).

Identification: If IP packet is fragmented during the transmission, all the fragments contain
same identification number. to identify original IP packet they belong to.

Flags: As required by the network resources, if IP Packet is too large to handle, these ‘flags’
tells if they can be fragmented or not. In this 3-bit flag, the MSB is always set to ‘0’.

Fragment Offset: This offset tells the exact position of the fragment in the original IP Packet.

Time to Live: To avoid looping in the network, every packet is sent with some TTL value set,
which tells the network how many routers (hops) this packet can cross. At each hop, its value is
decremented by one and when the value reaches zero, the packet is discarded.

Protocol: Tells the Network layer at the destination host, to which Protocol this packet belongs
to, i.e. the next level Protocol. For example protocol number of ICMP is 1, TCP is 6 and UDP is
17.

Header Checksum: This field is used to keep checksum value of entire header which is then
used to check if the packet is received error-free.

Source Address: 32-bit address of the Sender (or source) of the packet.

Destination Address: 32-bit address of the Receiver (or destination) of the packet.

Options: This is optional field, which is used if the value of IHL is greater than 5. These options
may contain values for options such as Security, Record Route, Time Stamp, etc.

USB (abbreviation of Universal Serial Bus) is an industry standard that establishes specifications
for cables, connectors and protocols for connection, communication and power supply between
personal computers and their peripheral devices.
Stands for "Universal Serial Bus." USB is the most common type of computer port used in
today's computers. It can be used to connect keyboards, mice, game controllers, printers,
scanners, digital cameras, and removable media drives, just to name a few. With the help of a
few USB hubs, you can connect up to 127 peripherals to a single USB port and use them all at
once (though that would require quite a bit of dexterity).

USB is also faster than older ports, such as serial and parallel ports. The USB 1.1 specification
supports data transfer rates of up to 12Mb/sec and USB 2.0 has a maximum transfer rate of 480
Mbps. Though USB was introduced in 1997, the technology didn't really take off until the
introduction of the Apple iMac (in late 1998) which used USB ports exclusively. It is somewhat
ironic, considering USB was created and designed by Intel, Compaq, Digital, and IBM. Over the
past few years, USB has become a widely-used cross-platform interface for both Macs and PCs.

USB Protocol: Types of USB Packets and USB Transfers


These packets generally contain information related to:
• Controlling the data exchange
• Data exchange in the form of actual payload
• Error detection and correction through status check up

USB Packet Fields

In USB the LSB of the packet is transmitted first. An USB packet contains different fields. They
are:

• Sync: It is a mandatory field occurring at starting of the packet. This field synchronizes the
clock of the receiver with the transmitter. For low and full speed mode, this field is 8 bytes long
and for high speed mode it is 32 bytes long.
• PID: PID means Packet ID. It indicates the packet type that is being sent. This field is of 8 bits
long. The upper four bits identifies the type of packet and lower four bits are bit-wise
compliment of upper four bits. The lower four bits helps in detecting errors.
• ADDR: This field contains the designation address of the USB device. It is of 7 bits, this
means it can supports 27 ¬ = 127 devices.
• ENDP: This field specifies the endpoint number. It is of 4 bits, this means it can indicate
2¬¬4¬¬ ¬¬= 16 possible endpoints.
• CRC: CRC stands for Cyclic Redundancy Check. This field is used to check data in the packet
for any error using CRC process

For token packets, 5-bit CRC is used and for data packets 16-bit CRC is used

• EOP: EOP stands for End of Packet. This field signals the data lines for Single Ended
Zero(SE0) for approximately 2 bit times, followed by J state(idle state) for 1 bit time

Types of USB packets

Basically there are four types of data packets:

1. Token packets: These packets are only sent by host. The packet structure contains a PID
byte, 11 bits of address and a 5-bit CRC. Types of token packets :

• In – This packet notifies the USB device that host wants to read information.
• Out – This packet notifies the USB device that host wants to write information.
• Setup – This packet is used to start the control transfer
With USB2.0, two more packets were added:
• Ping – Before sending OUT/DATA packet pair, this token asks the USB device if it is ready to
receive OUT/DATA packet pair.
• Split – This token is used to communicate to a low/full speed device on a high speed bus
2. Data packets: Two types of data packets are there, Data0 and Data1. The packet structure
contains a PID byte, data field and 16-bit CRC. The data field can carry 0- 1023 bytes of data.
Data must be always sent in multiple of bytes.

• For low speed devices, maximum data field is of 8bytes.


• For full speed devices, maximum data field is of 1023bytes.
• For high speed devices, maximum data field is of 1024bytes
er USB2.0, two more types were added Data2 and MData. They are only used in high speed
transfer high bandwidth isochronous transfer when there is a need to transfer more than 1024
bytes at 8192 kB/s.

3. Handshake Packets: These packets are mostly sent in response to data packets. They simply
consist of a PID byte. There are three types of handshake packets :

• ACK – Acknowledgment for packet received


• NAK – indicating that packets cannot be temporarily received or send. Also used to indicate
that there is no data to send
• STALL – indicating that the device is in error state and needs intervention from the host
With USB2.0, two more packets were added:
• NYET – indicating Split transaction is not yet complete.
• ERR – indicating Split transaction failed

4. Start of Frame packets (SOF): The SOF packet consists of an incrementing 11-bit frame
number. On a full speed bus, this packet is sent by the host every 1ms and on a high speed bus
every 125 us. This packet is used to synchronize isochronous transfer.

Transactions

A successful transaction consists of up-to three phases that occur in sequence. They are Token
phase, Data phase and Handshake phase.
Simple analog communication over the telephone wires to the typical USB cables for data

exchange, we surely have come a long way in the field of communication. RS232 was the first

milestone reached in this journey. It was a standard for electromechanical typewriters and

modems for digital data exchange introduced in 1962 by the Radio Sector of EIA. It made the

data exchange more reliable over analog channel. The standard defined voltage levels that made

it immune to noise disturbances and reduced the error in data exchange.

As the technology was growing many electronic devices were being developed during this time
like computers, printers, test instrument etc. There came a time where manufacturers felt the
need to exchange information between these electronic devices. For example data exchange
between a computer and a printer or two computers. But there was no standard or method to
accomplish this task. RS232 was the only available standard at the time which was used for data
exchange. So, they thought of adopting this standard in electronic devices for digital data
exchange. But the standard was unable to fulfill the requirements as it was developed
specifically for modem and teletypewriter. To overcome this problem, designers started
implementing an RS232 interface compatible to their equipments. Like a computer of HP will
only be able to use HP peripheral devices. Because of this the market was flooded with different
manufactures with their own standards for their devices. This led to the common problems like
non-standard pin assignment of circuits on connectors, and incorrect or missing control signals.
The lack of adherence to the standard produced a thriving industry of breakout boxes, patch
boxes, test equipments, books and other aids for the connection of dissimilar equipments. So, to
put an end to all theses disparities in equipments, syndicate of manufacturers built a transmitter
that supplied +5V and -5v and labeled them as “RS-232” compatible and they are same till date.
The standard has been revised many times after the initial one and updated by Electronic
industries association. The name of standard was also changed from RS232 to EIA232. The
Electronic Industries Association published three modifications, the most recent being EIA232F
introduced in 1997.

What is RS232 - "RECOMMENDED STANDARD 232"


RS-232 is a standard communication protocol for linking computer and its peripheral

devices to allow serial data exchange. In simple terms RS232 defines the voltage for the

path used for data exchange between the devices. It specifies common voltage and signal

level, common pin wire configuration and minimum, amount of control signals. As

mentioned above this standard was designed with specification for electromechanically

teletypewriter and modem system and did not define elements such as character encoding,

framing of characters, error detection protocols etc that are essential features when data transfer

takes place between a computer and a printer. Without which it could not be adopted to transfer

data between a computer and a printer. To overcome this problem a single integrated circuit

called as UART known as universal asynchronous receiver/transmitter is used in conjunction

with RS232.
It is clear from this figure that UART, line drivers and RS232 are three separate parts in the

system each having its own characteristic features. UART and line drivers are the parts in RS232

to enhance quality of system during serial data exchange.

A standard definition was given by EIA to define RS232 as “an interface between Data terminal

equipment and Data communication equipment”. A typical RS232 system is shown below.

E-A DTE stands for data terminal equipment is an end instrument that convert user information

into signals or reconverts the receive signal. It is a functional unit of station that serves as data

source or data sink and provides for communication control function according to the link

protocol. A male connector is used in DTE and has pin out configuration.

DCE-A DCE stands for data communication equipments. It sits between the DTE and data

transmission circuit for example modem. A DCE device uses a female connector which has

holes on the surface to hold male connector.

A minimum of three signals are required for communication between a DTE and a DCE devices.

These signals are a transmission line, a reception line and ground. These two devices
communicate with each other by handshaking. It allows a DTE and a DCE device system to

acknowledge each other before sending the data.

Handshaking is a process in which a DTE device sends a signal to a DCE device to establish a

connection between the devices before the actual transfer of data. It sets the parameters of

communication channel established between two equipments before normal communication over

the channel begins. It follows physical establishment of the channel and precedes normal

information transfer. Handshaking makes it possible to connect relatively heterogeneous systems

or equipment over a communication channel without the need for human intervention to set

parameters. This same concept is used in RS232 to allow two devices communicate with each

other before the actual exchange of information.

All these terms put together gives a complete picture of a RS232 system starting from DTE to

DCE with UART, line drivers and RS232 as conjunction between them.

iMPLementation & Specifications

Implementation of RS232 standard


Fig. 3: Block Diagram Explaining Implementation of RS232 in Devices

The RS-232 interface works in combination with UART universal asynchronous

receiver/transmitter. It is a piece of integrated circuit integrated inside the processor or

controller. It takes bytes and transmits the individual bits in a sequential fashion in a frame. A

frame is defined structure, carrying meaningful sequence of bit or bytes of data. It has a start bit

followed by 8 data bits, a parity bit and a stop bit. Once data is changed into bits separate line

drivers are used to convert the logic level of UART to RS-232 logic. Finally the signals are

transferred along the interface cable at the specified voltage level of RS-232. The data is sent

serially on RS232. Each bit is sent one after the other. This mode of transmission requires that

receiver is aware when the actual data bits are arriving to synchronize itself with coming data.

So logic 0 is sent as a start bit. The start bit in the frame signals the receiver that a new character

is coming. Once the receiver acknowledges the next five to eight bits are sent which represents

the character. This is followed by parity bit used for error detection. Parity bit is used to specify

even or odd number of one’s in the set of bits. For error detection we add an extra bit to the data

word. The transmitter calculates the value of the bit depending on the information sent and

receiver also performs the same calculation. It checks the parity value to the calculated

value. The stop bit helps the receiver to identify the end of message. The start bit always has

space value and stop bit has mark value. Now, if a receiver detects a value other than mark when

stop bit should be present, it knows that’s there is synchronization error. This causes a framing

error condition in the receiving UART. The device then tries to resynchronize on new incoming

bits. At the other end again the line driver interface converts it into UART compatible logic
levels. At the destination, a second UART re-assembles the bits into bytes. This is how RS232

made the data exchange compatible and reliable.

Standard RS232 specifications

RS 232 is known as a complete standard. It ensures perfect compatibility by defining not only

electrical characteristics but also functional and mechanical. For example voltage levels, slew

rate, signaling rate, pluggable connector, pin identification etc. All the specifications are

summarized in this block diagram with their values and examples.

You might also like