hi I am working on a HID_Device this is my USB_DeviceDescriptor
const BYTE USB_DeviceDescriptor[] = { USB_DEVICE_DESC_SIZE, /* bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0110), /* 1.10 */ /* bcdUSB */ 0x00, /* bDeviceClass */ 0x00, /* bDeviceSubClass */ 0x00, /* bDeviceProtocol */ USB_MAX_PACKET0, /* bMaxPacketSize0 */ WBVAL(0xA5C8), /* idVendor */ WBVAL(0x526A), /* idProduct */ WBVAL(0x0100), /* 1.00 */ /* bcdDevice */ 0x04, /* iManufacturer */ 0x20, /* iProduct */ 0x42, /* iSerialNumber */ 0x01 /* bNumConfigurations */ };
And This is My USB_StringDescriptor:
/* USB String Descriptor (optional) */ BYTE USB_StringDescriptor[] = { /* Index 0x00: LANGID Codes */ 0x04, /* bLength */ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0409), /* US English */ /* wLANGID */ /* Index 0x04: Manufacturer */ 0x1C, /* bLength */ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */ 'M',0, 'A',0, 'N',0, 'S',0, 'H',0, 'O',0, 'O',0, 'R',0, 'S',0, 'I',0, 'M',0, 'I',0, 'N',0, /* Index 0x20: Product */ 0x22, /* bLength */ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */ 'M',0, '.',0, 'S',0, '.',0, 'L',0, 'O',0, 'C',0, 'K',0, 'V',0, '4',0, '.',0, '1',0, ' ',0, '0',0, '0',0, '0',0, /* Index 0x42: Serial Number */ 0x1A, /* bLength */ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */ 'V',0, 'E',0, 'R',0, ' ',0, ' ',0, '.',0, '1',0, '.',0, '0',0, '0',0, ' ',0, ' ',0, /* Index 0x5C: Interface 0, Alternate Setting 0 */ 0x08, /* bLength */ USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */ 'H',0, 'I',0, 'D',0, };
but I can not get My Specifications from my HID! please show me , where is my mistake!
Sorry, I missed that you do have unicode encoding, then only wrong things are indexes, but I suppose your problem is in your configuration descriptor which you haven't specified here.
thank you for your Attention. Yes,you are right,I have no study in USB Specification. This is my First project in ARM. I Can Not Found Any Source About USB Specification in ARM:-( and I am in trial and error!
And This Is My USB_ConfigDescriptor:
const BYTE USB_ConfigDescriptor[] = { /* Configuration 1 */ USB_CONFIGUARTION_DESC_SIZE, /* bLength */ USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL( /* wTotalLength */ USB_CONFIGUARTION_DESC_SIZE + USB_INTERFACE_DESC_SIZE + HID_DESC_SIZE + USB_ENDPOINT_DESC_SIZE*2 ), 0x01, /* bNumInterfaces */ 0x01, /* bConfigurationValue */ 0x00, /* iConfiguration */ USB_CONFIG_BUS_POWERED /*|*/ /* bmAttributes */ /*USB_CONFIG_REMOTE_WAKEUP*/, USB_CONFIG_POWER_MA(100), /* bMaxPower */ /* Interface 0, Alternate Setting 0, HID Class */ USB_INTERFACE_DESC_SIZE, /* bLength */ USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ 0x00, /* bInterfaceNumber */ 0x00, /* bAlternateSetting */ 0x01, /* bNumEndpoints */ USB_DEVICE_CLASS_HUMAN_INTERFACE, /* bInterfaceClass */ HID_SUBCLASS_NONE, /* bInterfaceSubClass */ HID_PROTOCOL_NONE, /* bInterfaceProtocol */ 0x5C, /* iInterface */ /* HID Class Descriptor */ /* HID_DESC_OFFSET = 0x0012 */ HID_DESC_SIZE, /* bLength */ HID_HID_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(0x0100), /* 1.00 */ /* bcdHID */ 0x00, /* bCountryCode */ 0x01, /* bNumDescriptors */ HID_REPORT_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL(HID_REPORT_DESC_SIZE), /* wDescriptorLength */ /* Endpoint, HID Interrupt In */ USB_ENDPOINT_DESC_SIZE, /* bLength */ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ USB_ENDPOINT_IN(1), /* bEndpointAddress */ USB_ENDPOINT_TYPE_BULK, /* bmAttributes */ WBVAL(0x0008), /* wMaxPacketSize */ 0x00, /* 32ms */ /* bInterval */ /* Terminator */ 0 /* bLength */ };
I Want To Send & Receive 64 Bye By ARM. I Know That, This Must Take 1 millisecond,It Means That I Have To Set Sleep(1) Between SetOutPutReport & GetInputReport In My Program. But I Have To Wait More Than This. I Don't Know Why!
Unfortunately, you will have to learn enough of USB to be able to make use of things you want to achieve.
For example, in your configuration size you have size calculated by using USB_ENDPOINT_DESC_SIZE*2 but in your configuration you only have one endpoint specified and that is bulk in.
There are two major options you have, 1-st is to take a product like Keil middleware which will help you to achieve your goal without deep understanding of the USB itself, and 2-nd is to study USB thoroughly and put all of the necessary pieces together.
Your chosen option with trial and error is very problematic here as little inconsistencies in implementation can bring to not working device or device crashing during runtime.
Dear Milorad. Thank you So Much For Your Guidance.
Good Luck.