USB host resets my device after 'get configuration descriptor'

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by siangming on Sat Dec 13 01:09:02 MST 2014
hi all

i am using a LPC11U37H to implement a USB 2.0 full-speed device...i am going to implement it with a winusb driver on a windows 7 host pc.

Right now, i am getting a host reset after the 'get configuration descriptor' request.. the request is asking for a 255 bytes data payload.

i have only 1 configuration, 1 interface and 1 endpoint (excluding endpoint 0 IN and OUT). so i send my configuration as below:

typedef struct{
unsigned char bLength;
unsigned char bDescriptorType;
unsigned short int wTotalLength;
unsigned char bNumInterfaces;
unsigned char bConfigurationValue;
unsigned char iConfiguration;
unsigned char bmAttributes;
unsigned char bMaxPower;

unsigned char bLength_interface;
unsigned char bDescriptor_Typeinterface;
unsigned char bInterfaceNumber;
unsigned char bAlternateSetting;
unsigned char bNumEndpoints;
unsigned char bInterfaceClass;
unsigned char bInterfaceSubclass;
unsigned char bInterfaceProtocol;
unsigned char iInterface;

unsigned char bLength0;
unsigned char bDescriptorType0;
unsigned char bEndpointAddress0;
unsigned char bmAttributes0;
unsigned short wMaxPacketSize0;
unsigned char bInterval0;
} getconfig_descriptor;

getconfig_descriptor My_getconfig_desc = {
25, //total length of descriptor and subordinate descriptors
1, //number of interface
1, //configuration number, must be above 00. 00 = not configured.
0, //no string descriptor
0b11000000, //self-powered, NO remote wakeup
0x32, //100mA current

0, //interface number
0, //default alternate setting
1, //number of physical endpoints (excluding EP0)
0xFF, //interface class
0, //interface subclass
0, //interface protocol
0, //no string descriptor

0b10000001, //IN, logical endpoint address
0b00000011, //attributes: interrupt endpoint
64, //Maxpacketsize
0x64 //100ms max latency

After the setup request from the host,  i checked that the endpoint0 IN (data stage) and endpoint0 OUT (status stage) completed sucessfully because my endpoint0 IN interrupts fired off and i checked that NBytes are 0, meaning all 255 bytes of data are sent to the host. My endpoint0 OUT interrupt also fired off, meaning i received a ZLP status (stage completion) from the host.
(for the 255 bytes of data to send, i fill up the first 25bytes of the buffer with my structure above and the remaining of the 230 bytes with 0.)

i am thinking there must be something wrong with my descriptors since there is no other reason for the host to reset my device.

can anyone help check my descriptors above?

Note: i did not supply my INF file to the win7 host yet before i plugged in my device.... on the host, i get a 'device not recognised' message after i plugged in the device.
But i guess the INF file does not matter because i supposed if the enumeration went ok, i should see a message asking for drivers if the INF is not found...