This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Usb-Hid example: Computer keeps crashing

Hi,

I modified the Usb-Hid example to use it for my own Projekt. I'm working with a At91Sam7X256

Basically I only changed the Report-descriptor, to only send. Basically it is working(quiet good, I tested it with a small C++ program and got about 250kbit/sec, and it is not more complicated than programming a serial-port)

This is my descriptor

/* HID Report Descriptor */
const BYTE HID_ReportDescriptor[] = { HID_UsagePageVendor(0x00), HID_Usage(0x01), HID_Collection(HID_Application), HID_UsagePage(HID_USAGE_PAGE_BUTTON), HID_UsageMin(1), HID_UsageMax(5), HID_LogicalMin(0), HID_LogicalMax(2), HID_ReportCount(62), HID_ReportSize(8), HID_Input(HID_Data | HID_Variable | HID_Absolute), HID_EndCollection,
};

const WORD HID_ReportDescSize = sizeof(HID_ReportDescriptor);

/* USB Standard Device Descriptor */
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(0xC251), /* idVendor */ WBVAL(0x1A01), /* idProduct */ WBVAL(0x0100), /* 1.00 */ /* bcdDevice */ 0x04, /* iManufacturer */ 0x20, /* iProduct */ 0x42, /* iSerialNumber */ 0x01 /* bNumConfigurations */
};

/* USB Configuration Descriptor */
/* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
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 ), 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(3), /* bEndpointAddress */ USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */ WBVAL(0x0040),//64 /* wMaxPacketSize */ 0x01, /* 32ms */ /* bInterval */
/* Terminator */ 0 /* bLength */
};

String-descriptor is the same as in the demo_project.

The Problem now is, that i plug in the usb-connector and the Pc is crashing. I Tried it with a Win2k Sp4 and a WinXp computer(one laptop and one desctop). Sometimes the Usb-Hid device is not recognisec(with the yellow !) and sometimes it is working.

I don't think that it is a hardware issue, because I tried with the EK-Board and my own developed board.
Basically I think it is something with the Report-descriptor, because a second try with a Keyboard-Hid-Device gives me the same result(Bluescreen, yeah!)
But I don't know why windows is crashing.

please help, any guess whould help me.
thanks

Michael

0