中级会员
 
- 积分
- 211
- 金钱
- 211
- 注册时间
- 2016-5-16
- 在线时间
- 67 小时
|
5金钱
本帖最后由 NUAA-DW 于 2016-6-7 23:14 编辑
STM32自定义USB设备,有人做过这种吗?速率可以达到多少?NI-VISA生成的INF文件,能读到数据。但是速率只有11K。为什么?
[mw_shl_code=c,true]const uint8_t Virtual_Com_Port_DeviceDescriptor[] =
{
0x12, /*bLength */
USB_DEVICE_DESCRIPTOR_TYPE, /*bDescriptorType*/
0x00, /*bcdUSB */
0x02,
0x00, /*bDeviceClass*/
0x00, /*bDeviceSubClass*/
0x00, /*bDeviceProtocol*/
0x40, /*bMaxPacketSize40*/
0x83, /*idVendor (0x0483)*/
0x04,
0x50, /*idProduct = 0x5750*/
0x57,
0x00, /*bcdDevice rel. 2.00*/
0x02,
1, /*Index of string descriptor describing
manufacturer */
2, /*Index of string descriptor describing
product*/
0, /*Index of string descriptor describing the
device serial number */
0x01 /*bNumConfigurations*/
};
const uint8_t Virtual_Com_Port_ConfigDescriptor[] =
{
0x09, /* bLength: Configuation Descriptor size */ //ÅäÖÃÃèêö·û
USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType: Configuration */
32,
/* wTotalLength: Bytes returned */
0x00,
0x01, /* bNumInterfaces: 1 interface */
0x01, /* bConfigurationValue: Configuration value */
0x00, /* iConfiguration: Index of string descriptor describing
the configuration*/
0xC0, /* bmAttributes: Bus powered */
0x32, /* MaxPower 100 mA: this current is used for detecting Vbus */
/************** Descriptor of Custom HID interface ****************/ //½ó¿úÃèêö·û
/* 09 */
0x09, /* bLength: Interface Descriptor size */
USB_INTERFACE_DESCRIPTOR_TYPE,/* bDescriptorType: Interface descriptor type */
0x00, /* bInterfaceNumber: Number of Interface */
0x00, /* bAlternateSetting: Alternate setting */
0x02, /* bNumEndpoints */
0xff, /* bInterfaceClass: HID */
0x00, /* bInterfaceSubClass : 1=BOOT, 0=no boot */
0x00, /* nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse */
0, /* iInterface: Index of string descriptor */
/******************** Descriptor of Custom HID endpoints ******************/ //¶ËμãÃèêö·û
/* 27 */
0x07, /* bLength: Endpoint Descriptor size */
USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: */
0x81, /* bEndpointAddress: Endpoint Address (IN) */
0x02, /* bmAttributes: Interrupt endpoint */
0x40, /* wMaxPacketSize: 96 Bytes max */
0x00,
0x00, /* bInterval: Polling Interval (32 ms) */
/******************** Descriptor of Custom HID endpoints ******************/ //¶ËμãÃèêö·û
/* 27 */
0x07, /* bLength: Endpoint Descriptor size */
USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: */
0x03, /* bEndpointAddress: Endpoint Address (IN) */
0x02, /* bmAttributes: Bulk endpoint */
0x40, /* wMaxPacketSize: 96 Bytes max */
0x00,
0x00 /* bInterval: Polling Interval (32 ms) */
};[/mw_shl_code]
|
|