AN249 Silicon_Laboratories, AN249 Datasheet - Page 5

no-image

AN249

Manufacturer Part Number
AN249
Description
Human Interface Device Tutorial
Manufacturer
Silicon_Laboratories
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
AN2490NFHP
Manufacturer:
PANASONIC/松下
Quantity:
20 000
Part Number:
AN2491NFHP
Manufacturer:
PANASON
Quantity:
5 510
Part Number:
AN2491NFHP
Manufacturer:
MAXIM
Quantity:
5 510
4. Enumeration and Device Detection
Before the HID device can enter its normal operating mode and transfer data with the host, the device must
properly enumerate. The enumeration process consists of a number of calls made by the host for descriptors
stored in the device that describe the device’s capabilities.
The device must respond with descriptors that follow a standard format. Descriptors contain all basic information
about a device. The USB specification defines some of the descriptors retrieved, and the HID specification defines
other required descriptors. The next section discusses the descriptor structure a host expects to receive. The two
sections after that describe the responsibilities of the device and the host during enumeration. These sections refer
to sections of the HID firmware template, which is discussed in detail later in this document.
4.1. Descriptor Structure
Descriptors begin with a byte describing the descriptor length in bytes. This length equals the total number of bytes
in the descriptor including the byte storing the length. The next byte indicates the descriptor type, which allows the
host to correctly interpret the rest of the bytes contained in the descriptor. The content and values of the rest of the
bytes are specific to the type of descriptor being transmitted. Descriptor structure must follow specifications
exactly; the host will ignore received descriptors containing errors in size or value, potentially causing enumeration
to fail and prohibiting further communication between the device and the host.
Descriptor contents are typically stored in FLASH memory space. The file named USB_Descriptor.h in the HID
firmware template declares each value of every descriptor. The file USB_Descriptor.c defines the contents for each
descriptor.
4.1.1. Descriptor Declaration Example
A declaration might look like the following.
//------------------------------------------
// Standard Device Descriptor Type Definition
//------------------------------------------
typedef struct
{
} device_descriptor;
This declaration exactly conforms to the USB specification’s requirements for the size and content order of the
device descriptor. Some contents are stored in single bytes while others require two bytes.
BYTE bLength;
BYTE bDescriptorType;
WORD bcdUSB;
BYTE bDeviceClass;
BYTE bDeviceSubClass;
BYTE bDeviceProtocol;
BYTE bMaxPacketSize0;
WORD idVendor;
WORD idProduct;
WORD bcdDevice;
BYTE iManufacturer;
BYTE iProduct;
BYTE iSerialNumber;
BYTE bNumConfigurations;
// Size of this Descriptor in Bytes
// Descriptor Type (=1)
// USB Spec Release Number in BCD
// Device Class Code
// Device Subclass Code
// Device Protocol Code
// Maximum Packet Size for EP0
// Vendor ID
// Product ID
// Device Release Number in BCD
// Index of String Desc for Manufacturer
// Index of String Desc for Product
// Index of String Desc for SerNo
// Number of possible Configurations
// End of Device Descriptor Type
Rev. 0.2
AN249
5

Related parts for AN249