DatasheetQ Logo
Electronic component search and free download site. Transistors,MosFET ,Diode,Integrated circuits

AN249 데이터 시트보기 (PDF) - Silicon Laboratories

부품명
상세내역
제조사
AN249
Silabs
Silicon Laboratories Silabs
AN249 Datasheet PDF : 42 Pages
1 2 3 4 5 6 7 8 9 10 Next Last
AN249
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
{
BYTE bLength;
// Size of this Descriptor in Bytes
BYTE bDescriptorType;
// Descriptor Type (=1)
WORD bcdUSB;
// USB Spec Release Number in BCD
BYTE bDeviceClass;
// Device Class Code
BYTE bDeviceSubClass;
// Device Subclass Code
BYTE bDeviceProtocol;
// Device Protocol Code
BYTE bMaxPacketSize0;
// Maximum Packet Size for EP0
WORD idVendor;
// Vendor ID
WORD idProduct;
// Product ID
WORD bcdDevice;
// Device Release Number in BCD
BYTE iManufacturer;
// Index of String Desc for Manufacturer
BYTE iProduct;
// Index of String Desc for Product
BYTE iSerialNumber;
// Index of String Desc for SerNo
BYTE bNumConfigurations;
// Number of possible Configurations
} device_descriptor;
// End of Device Descriptor Type
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.
Rev. 0.2
5

Share Link: 

datasheetq.com  [ Privacy Policy ]Request Datasheet ] [ Contact Us ]