请问各位,本人要用STM32F207枚举成USB HID自定义设备,IN 64 BYTES,OUT 64 BYTES。用STM32_USB-Host-Device_Lib_V2.1.0中的Joystick Mouse进行修改,现在的状况是PC可以识别到HID设备,MCU可以发送64 bytes数据给PC,但是PC发送64 bytes数据给MCU时却收不到(可能是本人没摸清楚在哪里收取)。
当PC发数据给MCU时,MCU可进入中断 DCD_HandleRxStatusQueueLevel_ISR(pdev);
1、请问MCU程序中要在哪个函数中收取PC发来的数据?
2、本人的描述符如下:
USBD_DeviceDesc[USB_SIZ_DEVICE_DESC] =
{
0x12, /*bLength */
USB_DEVICE_DESCRIPTOR_TYPE, /*bDescriptorType*/
0x00, /*bcdUSB */
0x02,
0x00, /*bDeviceClass*/
0x00, /*bDeviceSubClass*/
0x00, /*bDeviceProtocol*/
0x40, /*bMaxPacketSize*/
LOBYTE(USBD_VID), /*idVendor*/
HIBYTE(USBD_VID), /*idVendor*/
LOBYTE(USBD_PID), /*idVendor*/
HIBYTE(USBD_PID), /*idVendor*/
0x00, /*bcdDevice rel. 2.00*/
0x02,
0x01, /*Index of manufacturer string*/
0x02, /*Index of product string*/
0x00, /*Index of serial number string*/
0x01 /*bNumConfigurations*/
} ; /* USB_DeviceDescriptor */
USBD_HID_CfgDesc[USB_HID_CONFIG_DESC_SIZ] =
{
// FullSpeedConfigDscr:
0x09 , //;; Descriptor length
USB_CONFIGURATION_DESCRIPTOR_TYPE , //;; Descriptor type
USB_HID_CONFIG_DESC_SIZ ,//;; Total Length (LSB)
0x00, //;; Total Length (MSB)
0x01, //;; Number of interfaces
0x01, // ;; Configuration number
0x00, // ;; Configuration string
0xA0, //;; Attributes (b7 - buspwr, b6 - selfpwr, b5 - rwu)
0x32, // ;; Power requirement (div 2 ma)
//;; Interface Descriptor
0x09, //;; Descriptor length
USB_INTERFACE_DESCRIPTOR_TYPE, // ;; Descriptor type
0x0, //;; Zero-based index of this interface
0x0, // ;; Alternate setting
0x02, // ;; Number of end points
0x03, // ;; Interface class
0x00, // ;; Interface sub class
0x00, // ;; Interface sub sub class
0x00, // ;; Interface descriptor string index
//;; HID Descriptor
0x09, // ; length
HID_DESCRIPTOR_TYPE, // ; type: HID
0x10,
0x01, // ; release: HID class rev 1.1
0x00, // ; country code (none)
0x01, // ; number of HID class descriptors to follow
0x22, // ; report descriptor type (HID)
// 0x1b,//(HIDReportDscrEnd - HIDReportDscr) //; length of HID descriptor
HID_REPORT_DESC_SIZE,//20140428
0x00,
//;; Endpoint Descriptor
0x07, //;; Descriptor length
USB_ENDPOINT_DESCRIPTOR_TYPE, // ;; Descriptor type
HID_IN_EP, // ;; Endpoint number, and direction
0x03, // ;; Endpoint type
HID_IN_PACKET, //// ;; Maximun packet size (LSB)
0x00, // ;; Max packect size (MSB)
0x0A, // ;; Polling interval
//;; Endpoint Descriptor
0x07, //;; Descriptor length
USB_ENDPOINT_DESCRIPTOR_TYPE, // ;; Descriptor type
HID_OUT_EP, // ;; Endpoint number, and direction
0x03, // ;; Endpoint type
HID_OUT_PACKET, // ;; Maximun packet size (LSB)
0x00, // ;; Max packect size (MSB)
0x0A, // ;; Polling interval
} ;
HID_ReportDesc[HID_REPORT_DESC_SIZE] __ALIGN_END =
{
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x00, // USAGE (0)
0xa1, 0x01, // COLLECTION (Application)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0xFF, // LOGICAL_MAXIMUM (255)
0x19, 0x00, // USAGE_MINIMUM(0)
0x29, 0xFF, // USAGE_MAXIMUM(255)
0x95, 0x40, // REPORT_COUNT
0x75, 0x08, // REPORT_SIZE (8)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x19, 0x00, // USAGE_MINIMUM (0)
0x29, 0xFF, // USAGE_MAXIMUM (255)
0x91, 0x02, // OUTPUT (Data,Var,Abs)
0xc0, // END_COLLECTION
};
谢谢各位!
|
|