Abstract—as world go for new technologies; it needs different data transmission protocols which can transfer data more efficiently and effectively

Дата канвертавання21.04.2016
Памер41.81 Kb.

PS2 and USB Data Transmission Protocols

Abhinav Jain (09BEC001) and Shivang Ghetia (09BEC019)

Electronics and Communication Engineering

Institute Of Technology

Nirma University

Abstract—as world go for new technologies; it needs different data transmission protocols which can transfer data more efficiently and effectively. In this review paper two most widely data transferring protocols which are used in computer named PS2 and USB Protocols are explained. Working, connections, different terms regarding protocols and the application of these protocols are explained in this review paper.
Index Terms—resolution, scaling factor, FPGA


THIS document is review of the most widely used data transferring protocol i.e. PS2 and USB. The name PS2 is driven from IBM Personal System 2 by series of personal computers which was introduced in 1987.When the personal computer were introduced in market the mainly used data transmission protocol was PS2 protocol. But as the invention went on, a more compatible protocol introduced named USB, it came over PS2 and in personal computers it replaced PS2 without any change in internal hardware. There are many hardware devices introduced in market that use USB for data transmission .The main use of USB is USB Flash drive that has made the work more easy, faster, and efficient.

The pin configuration of the PS2 Protocol is given below and it has 6 pins among them only 4 pins are used and rest are left unused.

Figure 1

Courtesy: Stephen A. Edwards
Pin 1. Data pin

Pin 2. Not connected

Pin 3. Ground

Pin 4. Vcc (+5 V)

Pin 5. Clock

Pin 6. Not Connected

Similarly the pin configuration of the USB port is given below and it also has for pins and their specification is given below the figure 2.


Pin 1. Ground

Pin 2. Data+

Pin 3. Data-

Pin 4. Vcc (+5 V)


A.PS2 Protocol

Introduced in 1987 and mainly focused on the transmission of data between Mouse/Keyboard and Computer. For keyboard PS2 implement a bidirectional synchronous protocol in such manner that least significant bit comes first. The bus is ideal when both lines are high .This is the only state where the keyboard/board is allowed begin transmitting data.

B.Electrical Interface for Keyboard

The PS2 interface is a bit serial interface with two signal Data and Clock .Both signals are bidirectional and logic 1 is electrically represented by 5V & logic 0 is represented by 0 V

Means Digital ground .Whenever the Data and Clock line is not used, i.e. is ideal, both the data and Clock lines are left floating, that is the host and the device both set the outputs in high impedance .Externally, at the PCB, large pull-up resistors keep the idle at 5 V (logic 1).

The figure below shows the interface of keyboard .When the FPGA (Field Program Gate Array) reads the data or clock inputs both PS2 data_out and dataclk_out are kept low which puts the tri-state buffers in high impedance mode. When the DPGA writes logic 0 on an output, the corresponding x_out signal is set high which pulls the line low .When writing logic 1 the FPGA simply sets the x_out signal low

Figure 3

Courtesy: Jonus Thor

C.Protocol for receiving data from the keyboard by PS2

Data is receiving from the keyboard as illustrates in figure 4.

Figure 4

Courtesy: Jonus Thor

  1. 1 start bit. This is always 0

  2. 8 data bits, least significant bit first.

  3. 1 parity bit (odd parity).

  4. 1 stop bit. This is always 1.

The keyboard writes a bit on the data line when clock is high and it is read by the host when it is low .The parity bit is set if there is an even number of 1’s in the data bit and reset if there is an odd number of 1’s in the data. This is used for error correction and detection. The keyboard must check this and if incorrect it should respond as if it had received an invalid command.

Figure 5

Courtesy: Stephen A. Edwards
The above figure denotes the timing of PS2.In which the clock frequency is 10-16.7 KHz. [1] the timing from the raising edge of a clock pulse to a data transition must be at least 5 msec. The timing from a data transition to falling edge of a clock pulse must be at least 5 microseconds and no greater than 25vmsec.

D.Decoding Scan Codes

Keyboard’s processor spends most of its timing scanning and monitoring the matrix of keys. If it finds that any key is being pressed, released or held down, the keyboard will send a packet of information known as a scan codes .A break code is sent when a key is released .Every key is assigned its own unique make code and break code so the host can determine exactly what happened to which key by looking at a single scan code .The set of make and break code for every key comprises a Scan Code Set (Table 1).

Table 1

Courtesy: Jonus Thor

E.Mouse interface

Using PS2 protocol mouse can be used as the interfacing hardware and a mouse can be very good decoder in reference of displacement measurement and when the Cartesian coordinate is concerned.

The PS2 port is similar to serial port(perform the function of data receiving and transmitting ) expect for the fact that inserted of using baud rates the ports uses the in-out clock to transmit and receive the data .Data is sent on synchronous clock . For the PS2 protocol the data packets that are received and sent need to be of length as explained above in the case of keyboard interfacing.

On the movement of mouse it sends the 3 bytes of information to the PS2 port. [3] The content of the data packet is described below in the figure 4.

Figure 6

Courtesy: Stephen A. Edwards
Byte 1 contains the information on the direction the mouse moved with respect to its previous position, status of the mouse buttons and the x and y overflows which are set if the counter go past 255.Byte 2 and 2 contains information regarding the x movement and the y movement respectively. The x movement and y movement are calculated of the basis of the counter values in the mouse. The counter get incremented by a value of 4 for a movement of 1 mm on the screen. [3] Communicating with the mouse accordingly can change this resolution .The PS2 mouse also allows scaling value of the mouse movements.

The PS2 mouse sends to byte of data AA and 00.The AA signifies the mouse passed its self-test and the 00 stands for the mouse ID. Once this information is received and checked the driver issues a mouse reset and waits for acknowledgement .After this mouse variable such as scaling factor, resolution etc are set by transmitting the appropriate data to the mouse. After each transmission to the mouse the driver makes sure to check that acknowledge is received if not it performs the action again. Once all the variables are set enable signal is to send the mouse asking it to start recording.


USB (Universal Serial Bus) is an industry standard developed in the mid-1990s that defines the cables, connectors and protocols used for connection, communication and power supply between computers and electronic devices.[9]It was compatible with the already existing PS2 devices.USB is intended to make all the peripheral devices used on computer, ranging from keyboards, pointing devices to smart phones and video game consoles. It also eliminates need of separate power charges for portable devices. From its beginning in 1994, many versions of USB are released, each with increasing data transfer rate. The latest is USB 3.0, having transmission speeds of up to 5 Gbit/s, which is 10 times faster than USB2.0 (480 Mbit/s).

A.USB features

It establishes a serial transmission and reception between host and serial devices, using a bus system, hence the name USB.

The data transfer is of 4 types:

a) Controlled data transfer

b) Bulk data transfer

c) Interrupt driven data transfer

d) iso-synchronous data transfer
A USB device can be attached, configured and used, reset and again reconfigured and used. The host schedules the sharing of Bandwidth among the attached devices at an instant. While attaching or detaching process, there is no need of rebooting. The device is self powered or gets from the host, external supply is not needed
Following is an example showing connections of USB devices with host, resulting in creation of nodes/hubs. If the peripheral is capable of supporting another USB device, it is a hub. All peripheral devices are essentially nodes.

Figure 7

Courtesy: Raj Kamal

B.USB Protocol

A maximum of 127 devices can be connected to a source. The USB bus cable has 4 wires, one for +5 V, two for twisted pairs and one for ground.

Termination impedances at each end are according to the device speed. An electromagnetic Interference (EMI) shielded cable is used for the 15 Mbps USB devices. Serial signals are sent using NRZI (non return to zero) encoding scheme. The synchronization clock is encoded by inserting synchronous code (SYNC) field before each USB packet. The receiver synchronizes its bits recovery clock continuously during the process.

There is a polled bus, through which the hot controller regularity polls the presence of a device as scheduled by software. It sends a token packet, which consists of fields for type, direction, USB device address and device end point number. To indicate successful transmission, the device performs a ‘handshaking’ operation with host. The error detection is permitted by the presence of a CRC field in data packet.

USB supports 3 types of pipes:

a) Stream: It does not have any USB-defined protocol. It is used when the connection is already established and the data starts flowing

b) Default control: it is for providing access

c) Message: it is for the control functions of the device [5]

C.USB Keyboard Interfacing

Like ps2 here is also bits and bytes are encoded:

Byte Description

0 Modifier keys

1 Reserved

2 Keycode 1

3 Keycode 2

4 Keycode 3

5 Keycode 4

6 Keycode 5

7 Keycode 6

Byte 1 of this report is a constant. This byte is reserved for OEM use. The

BIOS should ignore this field if it is not used. Returning zeros in unused fields is


The following table represents the keyboard output report (1 byte).

Bit Description







The LEDs are absolute output items. This means that the state of each LED

must be included in output reports (0 = off, 1 = on). Relative items would permit

reports that affect only selected controls (0 = no change, 1= change).

D.USB mouse interfacing

Comparing to PS2 mouse interfacing the following is table for USB mouse interfacing

Table 2 [6]

IV.Future Scopes For USB

Since USB is now dominant over other data transfer protocols, it is suffice to discuss its scope in future.

i) USB to USB synchronization

It is the concept in which research is going to make such a device that will make the data transfer without use of taking support of computer. It will make the data transfer very easy and more effectively and time reducing data transferring. Block diagram for such concept is given below.

Figure 8
For this, one easy method is, synchronizer has some memory element which stores the data of 1st memory unit and then transfers the data of 2nd unit to 1st memory unit and then temporary memory to 1st unit.

Already one such device, termed as OTG Bridge Box exists, that does the same task. The figure and some details are as below:

Figure 9
Ref. [10]

Copy/backup data from USB Pen Drive to another USB

 Copy/backup data from USB Card Reader to another USB

 Copy/backup data from USB Hard Disk to another USB

 Copy/backup images from digital camera to another USB

 Data transfer rate 400kB/sec

 Support USB storage devices with FAT12/16/32file system

 Functions buttons

 COPY key: it will copy USB source data to USB target

 Reset key: re-initial the USB devices detection

 Power key: power on

 Select key: select copy file

 LED indicators

 Source (Source OK/Copy Processing/Copy OK/Error)

 Target (Target OK/Copy Processing/Copy OK/Error)

 Power (System Power/Power Low)

 ALL (Copy all file)

 MP3 (copy .mp3, .wma file)

 JPG (copy .jpg file)

 DOC (copy .doc, .pdf, .xls, .ppt)

 AVI (copy .avi, .mov, .mpg)


In order to totally eliminate the need of peripheral device, it would be required to modify the design of USB mass storage such that it incorporates a microcontroller in itself along with a power supply mechanism .The controller will be programmed to perform a dual task of loading and storing data, two ways.

ii) Old PS2 Mouse as Decoder
As PS2 mouse are replaced by USB then old PS2 mouse can be used as decoder. As the working mentioned above, it can make the sense of mouse movement and using this sensitivity, one can make distance decoder from it. It can also be used as coordinate base system controller. It gives the exact change in coordinate change considering sign. It can be used very effectively in field of Robotics.


This is the review paper regarding Data Transmission protocols i.e. USB and PS2. By making them effective and by knowing their functionality, there are so many hardware and many application which can make revolution in the world of computer and applied electronics .Though PS2 is not in wide use now a days but it has its own identity and have own working theory explain above. USB is also a very effective transmission protocol due to its reliability, functionality and its independency on external power source. In near future, wide range of applications of USB, including its wireless mode for long distances, and the one without interface will be possibly the dominant ones.


1. SMD098 by jonus Thor, Lab 3.1, November 2001

2. Simple PS2 interface by Advance Logic synthesis for Electronics

3. PS2 keyboard and mouse interface by Prof. Stephen A. Edwards

4. http://ps2.kev009.com:8081/ohlandl/keyboard/Keyboard.html

5.”embedded systems” by Raj kamal, TMH publications

6. Universal Serial Bus (USB): Device Class Definition

For Human Interface Devices (HID) by USB Implementers’ Forum

7. USB.org Developers Resources [www.usb.org/developers]

8. USB tutorial by ATMEL

9.Wikipedia, http://en.wikipedia.org/wiki/USB

10. http://www.cooldrives.com/usb-otg-adapter.html

База данных защищена авторским правом ©shkola.of.by 2016
звярнуцца да адміністрацыі

    Галоўная старонка