I'm trying to write HID device on STM32F103. But I have problem with Configuration descriptor. When I sniffing USB packets on Host i receive next:
Code: Select all
00000000 09 02 6D 00 04 01 00 C0 32 09 04 00 00 01 03 01 ..m....À2.......
00000010 01 04 09 21 11 01 00 01 22 3F 00 07 05 81 03 08 ...!...."?...Â..
00000020 00 0A 09 04 01 00 01 03 00 00 04 09 21 11 01 00 ............!...
00000030 01 22 75 00 07 05 82 03 04 00 32 09 04 02 00 01 ."u...‚...2.....
00000040 11 01 00 01 22 75 00 07 05 82 03 04 00 32 09 04 ...."u...‚...2..
00000050 02 00 01 03 FF FF 06 09 21 11 01 00 01 22 36 00 ....ÿÿ..!...."6.
00000060 07 05 83 03 08 00 0A 09 04 03 00 01 03 ..Æ’..........
when must be
Code: Select all
static const uint8_t hid_configuration_descriptor_data[] = {
/* Configuration Descriptor.*/
USB_DESC_CONFIGURATION( 0x6D,
0x04, /* bNumInterfaces. */
0x01, /* bConfigurationValue. */
0, /* iConfiguration. */
0xC0, /* bmAttributes (self powered). */
50), /* bMaxPower (100mA). */
/* Keyboard Interface Descriptor.*/
USB_DESC_INTERFACE (0x00, /* bInterfaceNumber. */
0x00, /* bAlternateSetting. */
0x01, /* bNumEndpoints. */
0x03, /* bInterfaceClass (HID). */
0x01, /* bInterfaceSubClass (Boot). */
0x01, /* bInterfaceProtocol (Boot Kbd). */
0x04), /* iInterface. */
/* Header Functional Descriptor (HID).*/
USB_HID_DESCRIPTOR (0x0111,
0x00,
0x01,
HID_DTYPE_Report,
sizeof(KeyboardReport)),
/* In Endpoint Descriptor.*/
USB_DESC_ENDPOINT (KEYBOARD_IN_EPNUM|0x80,
USB_EP_MODE_TYPE_INTR, /* bmAttributes (Interrupt). */
EPSIZE_KEYBOARD_IN, /* wMaxPacketSize. */
0x0A), /* bInterval. */
/* Keyboard Ex Interface Descriptor.*/
USB_DESC_INTERFACE (0x01, /* bInterfaceNumber. */
0x00, /* bAlternateSetting. */
0x01, /* bNumEndpoints. */
0x03, /* bInterfaceClass (HID). */
0x00, /* bInterfaceSubClass (No Boot). */
0x00, /* bInterfaceProtocol (No Boot). */
0x04), /* iInterface. */
/* Header Functional Descriptor (HID).*/
USB_HID_DESCRIPTOR (0x0111,
0x00,
0x01,
HID_DTYPE_Report,
sizeof(KeyboardExReport)),
/* In Endpoint Descriptor.*/
USB_DESC_ENDPOINT (KEYBOARD_EX_IN_EPNUM|0x80, /* bEndpointAddress.*/
USB_EP_MODE_TYPE_INTR, /* bmAttributes (Interrupt) */
EPSIZE_KEYBOARD_EX_IN, /* wMaxPacketSize. */
50), /* bInterval. */
/* Mouse Interface Descriptor.*/
USB_DESC_INTERFACE (0x02, /* bInterfaceNumber. */
0x00, /* bAlternateSetting. */
0x01, /* bNumEndpoints. */
0x03, /* bInterfaceClass (HID). */
0xFF, /* bInterfaceSubClass (No Boot). */
0xFF, /* bInterfaceProtocol (No Boot). */
0x06), /* iInterface. */
/* Header Functional Descriptor (HID).*/
USB_HID_DESCRIPTOR (0x0111,
0x00,
0x01,
HID_DTYPE_Report,
sizeof(MouseReport)),
/* In Endpoint Descriptor.*/
USB_DESC_ENDPOINT (MOUSE_IN_EPNUM|0x80, /* bEndpointAddress.*/
USB_EP_MODE_TYPE_INTR, /* bmAttributes (Interrupt) */
EPSIZE_MOUSE_IN, /* wMaxPacketSize. */
10), /* bInterval. */
/* HID Interface Descriptor.*/
USB_DESC_INTERFACE (0x03, /* bInterfaceNumber. */
0x00, /* bAlternateSetting. */
0x01, /* bNumEndpoints. */
0x03, /* bInterfaceClass (HID). */
0x00, /* bInterfaceSubClass (No Boot). */
0x00, /* bInterfaceProtocol (No Boot). */
0x03), /* iInterface. */
/* Header Functional Descriptor (HID).*/
USB_HID_DESCRIPTOR (0x0111,
0x00,
0x01,
HID_DTYPE_Report,
sizeof(GenericReport)),
/* In Endpoint Descriptor.*/
USB_DESC_ENDPOINT (GENERIC_IN_EPNUM|0x80, /* bEndpointAddress.*/
USB_EP_MODE_TYPE_INTR, /* bmAttributes (Interrupt) */
EPSIZE_GENERIC_IN, /* wMaxPacketSize. */
200),
}As we can see in packet dump at 0x00000040 address beginig wrong data. Why?
I'm trying to change hid_configuration_descriptor_data length and content, but BUG always exist in different place.
What I can do wrong?
PS. gcc version 4.6.3 (Sourcery CodeBench Lite 2012.03-56)