Hello All!
I use my own PCB with EFM32GG332F1024 MCU. I'm trying to run USB HID.
However, my Report Descriptor is not read correctly! Could someone check my descriptor?
Here is my Report Descriptor:
SL_ALIGN(4) const char HID_ReportDescriptor[] SL_ATTRIBUTE_ALIGN(4) = { 0x06, 0x00, 0xff, // USAGE_PAGE (Vendor Defined Page 1) 0x09, 0x01, // USAGE (Vendor Usage 1) 0xa1, 0x01, // COLLECTION (Application) 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) 0x15, 0x00, // LOGICAL_MINIMUM (0) 0x75, 0x08, // REPORT_SIZE (8) 0x85, OUT_CONTROL_ID, // Report ID = 0x01 0x95, 0x40, // REPORT_COUNT (0x40=64 Bytes) 0x09, 0x01, // USAGE (Vendor Usage 1) 0x91, 0x02, // INPUT (Data,Var,Abs) 0x85, IN_CONTROL_ID, // Report ID = 0x02 0x95, 0x40, // REPORT_COUNT (0x40=64 Bytes) 0x09, 0x01, // USAGE (Vendor Usage 1) 0x81, 0x02, // OUTPUT (Data,Var,Abs) 0x85, OUT_DATA_ID, // Report ID = 0x03 0x95, 0x40, // REPORT_COUNT (0x40=64 Bytes) 0x09, 0x01, // USAGE (Vendor Usage 1) 0x91, 0x02, // OUTPUT (Data,Var,Abs) 0x85, IN_DATA_ID, // Report ID = 0x04 0x95, 0x40, // REPORT_COUNT () 0x09, 0x01, // USAGE (Vendor Usage 1) 0x81, 0x02, // INPUT (Data,Var,Abs) 0xC0, // End Application Collection };
And here is what USBView sees:
Device Descriptor: bcdUSB: 0x0200 bDeviceClass: 0x00 bDeviceSubClass: 0x00 bDeviceProtocol: 0x00 bMaxPacketSize0: 0x40 (64) idVendor: 0x7777 idProduct: 0x2233 bcdDevice: 0x0000 iManufacturer: 0x01 iProduct: 0x02 iSerialNumber: 0x03 bNumConfigurations: 0x01 ConnectionStatus: DeviceConnected Current Config Value: 0x01 Device Bus Speed: Full Device Address: 0x0C Open Pipes: 2 Endpoint Descriptor: bEndpointAddress: 0x82 Transfer Type: Interrupt wMaxPacketSize: 0x0040 (64) bInterval: 0x01 Endpoint Descriptor: bEndpointAddress: 0x00 Transfer Type: Control wMaxPacketSize: 0x0507 (1287) wInterval: 0x0302 bSyncAddress: 0x40
Continuation of previous post!
Here is my Descriptors.h:
// *** Descriptors.h #include "em_usb.h" #include "HID_Exchange.h" #ifndef __DESCRIPTORS_H__ #define __DESCRIPTORS_H__ #ifdef __cplusplus extern "C" { #endif #define CONFIG_DESC_TOTAL_LEN (USB_CONFIG_DESCSIZE+\ USB_HID_DESCSIZE+\ USB_INTERFACE_DESCSIZE+\ USB_ENDPOINT_DESCSIZE+\ USB_ENDPOINT_DESCSIZE) // *** USB Device Descriptors SL_ALIGN(4) const USB_DeviceDescriptor_TypeDef USBDESC_deviceDesc SL_ATTRIBUTE_ALIGN(4) = { .bLength = USB_DEVICE_DESCSIZE, // 18 .bDescriptorType = USB_DEVICE_DESCRIPTOR, .bcdUSB = 0x0200, .bDeviceClass = 0, .bDeviceSubClass = 0, .bDeviceProtocol = 0, .bMaxPacketSize0 = USB_FS_CTRL_EP_MAXSIZE, .idVendor = 0x7777, // For example only .idProduct = 0x2233, // For example only .bcdDevice = 0x0000, .iManufacturer = 1, .iProduct = 2, .iSerialNumber = 3, .bNumConfigurations = 1 }; // *** USB Configuration Descriptors SL_ALIGN(4) const uint8_t USBDESC_configDesc[] SL_ATTRIBUTE_ALIGN(4) = { // *** Actually Configuration Descriptor USB_CONFIG_DESCSIZE, // bLength USB_CONFIG_DESCRIPTOR, // bDescriptorType CONFIG_DESC_TOTAL_LEN, // wTotalLength (LSB) CONFIG_DESC_TOTAL_LEN>>8, // wTotalLength (MSB) 1, // bNumInterfaces 1, // bConfigurationValue 0, // iConfiguration #if defined(BUSPOWERED) CONFIG_DESC_BM_RESERVED_D7, // bmAttrib: Bus powered #else CONFIG_DESC_BM_RESERVED_D7 // bmAttrib: Self powered | CONFIG_DESC_BM_SELFPOWERED, #endif CONFIG_DESC_MAXPOWER_mA(200), // bMaxPower: 200 mA // *** HID (Human Interface Device) Interface Descriptor USB_INTERFACE_DESCSIZE, // bLength USB_INTERFACE_DESCRIPTOR, // bDescriptorType 0, // bInterfaceNumber 0, // bAlternateSetting NUM_EP_USED, // bNumEndpoints 0x03, // bInterfaceClass (HID) 0, // bInterfaceSubClass 0, // bInterfaceProtocol 0, // iInterface // *** HID descriptor USB_HID_DESCSIZE, // bLength USB_HID_DESCRIPTOR, // bDescriptorType 0x11, // bcdHID (LSB) 0x01, // bcdHID (MSB) 0, // bCountryCode 1, // bNumDescriptors USB_HID_REPORT_DESCRIPTOR, // bDecriptorType sizeof(HID_ReportDescriptor), // wDescriptorLength(LSB) sizeof(HID_ReportDescriptor) >> 8, // wDescriptorLength(MSB) // *** IN Endpoint Descriptor (Mandatory for HID) USB_ENDPOINT_DESCSIZE, // bLength USB_ENDPOINT_DESCRIPTOR, // bDescriptorType HID_INTR_IN_EP_ADDR, // bEndpointAddress (IN) USB_EPTYPE_INTR, // bmAttributes IN_DATA_SIZE, // wMaxPacketSize (LSB) 0, // wMaxPacketSize (MSB) HID_POLL_RATE, // bInterval // *** OUT Endpoint descriptor (Mandatory for HID) USB_ENDPOINT_DESCSIZE, // bLength USB_ENDPOINT_DESCRIPTOR, // bDescriptorType HID_INTR_OUT_EP_ADDR, // bEndpointAddress (OUT) USB_EPTYPE_INTR, // bmAttributes OUT_DATA_SIZE, // wMaxPacketSize (LSB) 0, // wMaxPacketSize (MSB) HID_POLL_RATE, // bInterval }; STATIC_CONST_STRING_DESC_LANGID (langID, 0x04, 0x09); STATIC_CONST_STRING_DESC (iManufacturer,'O','N','I','C','','P','r','o','d', 'u','c','t'); STATIC_CONST_STRING_DESC (iProduct,'M','1','0','8','0',' ','E','F','M','3','2'); STATIC_CONST_STRING_DESC (iSerialNumber,'0','0','0','0','0','0','3','4','7','9', '0','0'); const void * const USBDESC_strings[] = { &langID, &iManufacturer, &iProduct, &iSerialNumber }; void *USBDESC_HidDescriptor = (void*) &USBDESC_configDesc[USB_CONFIG_DESCSIZE + USB_INTERFACE_DESCSIZE]; // *** Endpoint buffer sizes // *** 1 = single buffer, 2 = double buffering, 3 = triple buffering const uint8_t USBDESC_bufferingMultiplier[NUM_EP_USED + 1] = { 1, 1, 1 }; #ifdef __cplusplus } #endif #endif /* __DESCRIPTORS_H__ */
That is, only one interrupts endpoint is read and one control endpoint is read! And control endpoint is generally not read correctly!
What could be the reason?
Thank you in advance!
Regards
Onic