Thursday, December 5, 2013

Human Interface Devices

History of the Universal Serial Bus (USB) is quite short compare to RS232 for example. Development started in 1994 by effort of six companies - IBM, Compaq, Intel, Microsoft, NEC, Nortel and DEC. The first idea was to develop universal bus simple to use with small and compact connectors (to reduce many connectors in the personal computers). To have a possibility to connect devices such as digital cameras, webcams (or any other devices with big data transfers in a short time), there was also requirement for high transfer speeds.

  • 1995 - USB Implementers Forum (USB-IF) was formed on the First Windows Hardware Engineering <>Conference (WinHec). During this conference Intel introduced first USB silicon.
  • 1996 - USB Specification 1.0 was released.
  • 1997 - Membership increased in the USB-IF to 400 members. In the world was developed more than 500 USB products this year.
  • 2000 - USB 2.0 was released.
  • 2001 - Standardization of USB 2.0 by USB-IF.
  • 2008 - USB 3.0 announced by USB 3.0 Prometer Group.

Low speed and full speed baud rates were included in the USB 1.1 specification. High speed came with USB 2.0 in the year 2000. High speed USB was some attack to compete with Firewire Serial Bus (IEEE1394a), which was developed and presented in 1995 by Apple. It was basically developed for big data transfers (e.g. digital video transfers), so the baud rates were 100, 200, or 400 Mbits/s. In 1995 Firewire had no competitors, because USB 1.0 could not compete wit it. USB 2.0 was little bit faster than Firewire400, but it was changed in the year 2002 by presenting Firewire800 (IEEE1394b with maximal baud rate 800 Mbits/s).

Hardware Description

Figure 1.- USB Connectors

On the figure 1 are shown the three most used types of USB connectors. Typically we can find sockets type 'A' on the computer main boards and on the hubs. Type 'B' sockets are situated on the devices ('B' plug are always connected downstream). So the upstream and downstream connectors are not mechanically interchangeable. Cables, where are e.g. both connectors of the same type, are prohibited by the specification (except cables for bridges used to connected two computers together). Because Type 'B' connector is not suitable for small devices (9 because of its size), mini-USB 'B' connectors were developed. In the table 1 there is shown connection of the pins.

Table 1.- Description of the USB pins
Pin Name Cable Color Description
1 VCC Red + 5 V DC
2 D - White Data -
3 D + Green Data +
4 GND Black Ground
x may not be used, connected to GND or used as attachment identification for some devices

Voltage levels of the USB communication depend of course on the baud rate. In the USB specification are defined three different baud rates:

  • Low speed - 1.5 Mbits/s
  • Full speed - 12 Mbits/s
  • High speed - 480 Mbits/s

Low speed is usually used for HIDs (Human Interface Devices) like a mouse, joystick, keyboard. USB cable contains four wires. On the borders are wires VBUS and GND, in the center is twisted pair marked as D+ and D- (see figure 2). Power supply wires (VBUS and GND) are useful, because smaller devices can be powered directly from the bus by these wires. USB is a half-duplex bus with differential coding. Thanks to this fact, it is robust to the electromagnetic disturbances. This bus uses NRZI (Non Return to Zero Inverted) coding. This means, that small logical values are not directly represented by different voltage levels. Important for this bus is changing state (transition)from one voltage level to another. Transition means logical zero and steady state means logical one. Although this bus is so fast, there is no extra wire for clock synchronization, but if the state is not changed 6x(six long. ones), one synchronization zero is added.

Figure 2.- USB cable structure

Voltage levels for logical values are different for different baud rates. For full and low speed devices are shown typical configurations on the figure 3 and figure 4.

Figure 3.- Typical configuration for the full speed devices
Figure 4.- Typical configuration for the low speed devices

If no device is connected to the host, pull-down resistors (15 KΩ) cause ground on both data lines. This state is also called SE0 (Single Ended Zero) and because it can not appear during ordinary data transfer, it's used for special events (e.g. reset, end of packet). Full speed devices have installed pull-up resistor on the D+ line while low speed devices on the D- line. If the device is connected to the host, only on one line will be voltage different from the ground (voltage will be approximately 3V thanks to the voltage divider - 1,5 KΩ : 15KΩ). This is used to recognize baud rate of the device. If it is high speed device, it has 1,5KΩ resistor on the D+ (as full speed device, but with additional identification after reset). If both sides support high speed USB, 1,5 KΩ resistor in the device is unplugged by transistor and another 90 Ω resistor is connected between D+ and D-, that is necessary for impedance adjustment with twisted pair.

What is a HID?

The human interface in the name suggests that HIDs interact directly with people, and many HIDs do. A mouse may detect when someone presses a key or moves the mouse, or the host may send a message that translates to a joystick effect that the user experiences. Besides keyboards, mice, and joysticks, the HID class encompasses front panels with knobs, switches, buttons, and sliders; remote controls, telephone keypads; and game controls such as data gloves and steering wheels.

But a HID doesn't have to have a human interface. The device just need to be able to function within limits of the HID class specification. These are the major abilities and limitations of HID-class devices:

  • All data exchanged resides in structures called reports. The host sends and receives data by sending and requestiing reports in control or interrupt transfers. The report format is flexible an can handle just about any type of data, but each defined report has a fixed size.
  • A HID interface must have and interrupt IN endpoint for sending Input reports.
  • A HID interface can have at most one interrupt IN endpoint and one interrupt OUT endpoint. If you need more interrupt endpoints, you can create a composite device that contains multiple HIDs. An application must obtain a separate handle for each HID in the composite device.
  • The interrupt IND endpoint enables the HID to send information to the host at unpredictable times. For example, there's no way for the computer to know when a user will press a key on the keyboard, so the hosts drive uses interrupt transactions to poll the device periodically to obtain new data.
  • The rate of data exchange is limited, especially at low and full speeds. A host can guarantee a low-speed interrupt endpoint no more than 800 bytes/sec. For full-speed endpoints, the maximum is 64 kilobytes/sec., and for high-speed endpoints, the maximum is about 24 Megabytes/sec. if the host supports high-bandwidth endpoints and about 8 Megabytes/sec. if not. Control transfers have no guaranteed bandwidth except for the bandwidth reserved for all control transfers on the bus.
  • Windows 98 Gold (original edition) supports USB 1.0, so interrupt OUT transfers aren't supported and all host to device reports must use control transfers.

Any device that can live within the class's limits is a candidate to be a HID. THe HID specification mentions bar-code readers, thermometers, and voltmeters as example of HIDs that might not have a conventional human interface. Each of these sends data to the computer and may also receive requests that configure the device. Examples of devices that mostly receive data are remote displays, control panels for remote devices, robots, and devices of any kind that receive occasional or periodic commands from the host.

A HID interface may be just one of multiple USB interfaces supported by a device. For example, a USB speaker that uses isochronous transfers for audio may also have a HID interface for controlling volume, balance, treble and bass. A HID interface is often cheaper than traditional physical controls on a device.

If you like our work in Jeal's Blog just subscribe yourself. Get our posts in your RSS reader or by email.
Written by Jefferson GoVa

Ingeniero en electronica con aficiones a escribir y compartir todo aquello que le llama la atencion o que su curiosidad atrapa..

#Curioseando #Perdiendoeltiempo #sinnadamejorquehacer.

No comments:

Post a Comment