Specifications

high. A host computer will not typically attempt to transmit data to the keyboard until it has received a power up status
indication from the keyboard.
The D+/D- lines are then polled approximately every 2uS for a duration of 1mS. If, on any four consecutive samples, either
or both of the D+ or D- lines are sampled as non-zero, the interface is determined to be PS/2. Otherwise (both D+ and D-
remain low), the D- pullup is engaged by enabling Q1, causing a USB connect condition. The firmare then delays 10uS
longer, and examines the lines once again to verify that the connect condition (D+ low, D- high) persists on the lines. If so,
the interface is determined to be USB. If not, the connect resistor is disconnected from D-, and the host is assumed to be a
PS/2 interface which happens to be driving both Clock and Data. See Figure XX.
USB Interface
All USB Human Interface Device (HID) class applications such as a keyboard, follow the same USB start-up procedure. The
procedure is as follows (see Figure 9.)
Figure 2. USB Start-Up Procedure
Device Plug-in (Power On Reset)
The USB device is powered when it is connected to the bus. The pull-up resistor on D– notifies the hub that a low-speed (1.5
Mbps) device has just been connected. Program execution begins at address 0 (see Figure 10).
Figure 2. Power On Reset
Bus Reset
The host recognizes the presence of a new USB device and resets it (see Figure 11).
Figure 2. Bus Reset ISR
Enumeration
The host sends a SETUP packet followed by IN packets to read the device description from default address 0. When the
description is received, the host assigns a new USB address to the device. The device begins responding to communication
with the newly assigned address. The host then asks for the device descriptor, configuration descriptor and HID report
descriptor. The descriptors hold the information about the device. They will be discussed in detail below. Using the infor-
mation returned from the device, the host now knows the number of data endpoints supported by the device (in a USB
keyboard, there is only one data endpoint). The host will issue a Set Configuration with a value of 1. At this point, the
process of enumeration is completed. See Figures 12, 13, and 14.
Endpoint 0 ISR
Enable device address 0
Enable 1ms Timer Interrupt
Enable End Point 0 to respond to SETUP packets