例程有说吧,再具体点就是ST官方发布的USB的例程mass storage,STM32_USB-FS-Device_Lib_V3.3.0;产生将其接口描述符修改如/******************** Descriptor of Mass Storage interface ********************/
/* 09 */ //接口描述符
0x09, /* bLength: Interface Descriptor size */
0x04, /* bDescriptorType: */
/* Interface descriptor type */
0x00, /* bInterfaceNumber: Number of Interface */
0x00, /* bAlternateSetting: Alternate setting */
0x02, /* bNumEndpoints*/
0x00, /* bInterfaceClass: MASS STORAGE Class修改为测试类型 */
0x08, /* bInterfaceSubClass : */
0x01, /* nInterfaceProtocol */
4, /* iInterface: */
/* 18 */ //端点描述符
0x07, /*Endpoint descriptor length = 7*/
0x05, /*Endpoint descriptor type */
0x81, /*Endpoint address (IN, address 1) */
0x02, /*Bulk endpoint type */
0x40, /*Maximum packet size (64 bytes) */
0x00,
0x00, /*Polling interval in milliseconds */
/* 25 */
0x07, /*Endpoint descriptor length = 7 */
0x05, /*Endpoint descriptor type */
0x02, /*Endpoint address (OUT, address 2) */
0x02, /*Bulk endpoint type */
0x40, /*Maximum packet size (64 bytes) */
0x00,
0x00 /*Polling interval in milliseconds*/
/*32*/
,其目的是为了测试PC发送数据以便STM32处理;pc的驱动程序已经在107上面有过测试,运行ok |