Hello everybody,
i have here an MCBSTM32E and i tried to write my own HID client on the PC. It worked already fine but now i want to send more then just one Byte. But i dont know how i have to change the ReportDescriptor on the Board and which other settings i have to change. I hope you can help me and explain which settings need to be changed.
regards Mathias
See this topic, http://www.keil.com/forum/11137/
Above topic was discussed on HID example for LPC2148. Keil example code is common with STM32, at least, on descriptors.
Tsuneo
Hi Tsuneo,
thanks for you answer. I read the Topic and changed the HID-Example of the MCBSTM32E like you wrote there. But i still have some problems. This is my ReportDescriptor
usbdesc.c #define HID_INPUT_REPORT_BYTES 64 /* size of report in Bytes */ #define HID_OUTPUT_REPORT_BYTES 1 /* size of report in Bytes */ #define HID_FEATURE_REPORT_BYTES 1 /* size of report in Bytes */ const U8 HID_ReportDescriptor[] = { HID_UsagePageVendor( 0x00 ), HID_Usage ( 0x01 ), HID_Collection ( HID_Application ), HID_LogicalMin ( 0 ), /* value range: 0 - 0xFF */ HID_LogicalMaxS ( 0xFF ), HID_ReportSize ( 8 ), /* 8 bits */ HID_ReportCount ( HID_INPUT_REPORT_BYTES ), HID_Usage ( 0x01 ), HID_Input ( HID_Data | HID_Variable | HID_Absolute ), HID_ReportCount ( HID_OUTPUT_REPORT_BYTES ), HID_Usage ( 0x01 ), HID_Output ( HID_Data | HID_Variable | HID_Absolute ), HID_ReportCount ( HID_FEATURE_REPORT_BYTES ), HID_Usage ( 0x01 ), HID_Feature ( HID_Data | HID_Variable | HID_Absolute ), HID_EndCollection, }; /* USB Configuration Descriptor */ /* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor) */ const U8 USB_ConfigDescriptor[] = { ... /* Endpoint, HID Interrupt In */ USB_ENDPOINT_DESC_SIZE, /* bLength */ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ USB_ENDPOINT_IN(1), /* bEndpointAddress */ USB_ENDPOINT_TYPE_INTERRUPT, /* bmAttributes */ WBVAL(0x0040), /* wMaxPacketSize */ 0x20, /* 32ms */ /* bInterval */ /* Terminator */ 0 /* bLength */ };
The variable InReport i defined like this:
main.c U8 InReport[HID_INPUT_REPORT_BYTES];
But when i try to compile i get two errors. Both here:
usbuser.c #if USB_CONFIGURE_EVENT void USB_Configure_Event (void) { if (USB_Configuration) { /* Check if USB is configured */ GetInReport(); USB_WriteEP(HID_EP_IN, &InReport, sizeof(InReport)); } } #endif /* * USB Endpoint 1 Event Callback * Called automatically on USB Endpoint 1 Event * Parameter: event */ void USB_EndPoint1 (U32 event) { switch (event) { case USB_EVT_IN: GetInReport(); USB_WriteEP(HID_EP_IN, &InReport, sizeof(InReport)); break; } }
The problem is the &InReport but what should i write here instead? Just InReport oder &InReport[0]?
The same here:
hiduser.c BOOL HID_GetReport(void){ /*ReportID = SetupPacket.wValue.WB.L; */ switch (SetupPacket.wValue.WB.H){ case HID_REPORT_INPUT: GetInReport(); EPOBuf[0] = InReport; break; case HID_REPORT_OUTPUT: return (__FALSE); /*Not Supported*/ case HID_REPORT_FEATURE: return (__FALSE); /*Not Supported*/ } return (__TRUE) }
What should i write instead of
EPOBuf[0] = InReport;
Hope you can help me.