
大家好! 我现在做USB复合设备,参照网上了代码完成了复合设备代码的修改。但是现在遇到一个问题,就是CDC和MSC设备同时只能识别出一个来。我在其它部分代码不变动的情况下如果将PID设置为: #define USBD_PID_FS 22336 就可以识别出CDC设备; 设置为: #define USBD_PID_FS 22314 就可以识别出MSC设备; 但是就是不能同时识别出CDC和MSC,麻烦各位指导一下; 下面是参考网上复合设备的描述 /* USB composite device Configuration Descriptor */ /* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */ __ALIGN_BEGIN uint8_t USBD_Composite_CfgFSDesc[] __ALIGN_END = #if 1 { 0x09, /* bLength: Configuation Descriptor size */ USB_DESC_TYPE_CONFIGURATION, /* bDescriptorType: Configuration */ 0x67,//WBVAL(USBD_COMPOSITE_DESC_SIZE), 0x00, USBD_MAX_NUM_INTERFACES , /* bNumInterfaces: */ 0x01, /* bConfigurationValue: */ 0x04, /* iConfiguration: */ 0xC0, /* bmAttributes: */ 0x32, /* MaxPower 300 mA */ /****************************CDC************************************/ /* Interface Association Descriptor */ USBD_IAD_DESC_SIZE, // bLength USBD_IAD_DESCRIPTOR_TYPE, // bDescriptorType USBD_CDC_FIRST_INTERFACE, // bFirstInterface USBD_CDC_INTERFACE_NUM, // bInterfaceCount 0x02, // bFunctionClass 0x02, // bFunctionSubClass 0x01, // bInterfaceProtocol 0x04, // iFunction /*Interface Descriptor */ 0x09, /* bLength: Interface Descriptor size */ USB_DESC_TYPE_INTERFACE, /* bDescriptorType: Interface */ /* Interface descriptor type */ USBD_CDC_CMD_INTERFACE, /* bInterfaceNumber: Number of Interface */ 0x00, /* bAlternateSetting: Alternate setting */ 0x01, /* bNumEndpoints: One endpoints used */ 0x02, /* bInterfaceClass: Communication Interface Class */ 0x02, /* bInterfaceSubClass: Abstract Control Model */ 0x01, /* bInterfaceProtocol: Common AT commands */ 0x01, /* iInterface: */ /*Header Functional Descriptor*/ 0x05, /* bLength: Endpoint Descriptor size */ 0x24, /* bDescriptorType: CS_INTERFACE */ 0x00, /* bDescriptorSubtype: Header Func Desc */ 0x10, /* bcdCDC: spec release number */ 0x01, /*Call Management Functional Descriptor*/ 0x05, /* bFunctionLength */ 0x24, /* bDescriptorType: CS_INTERFACE */ 0x01, /* bDescriptorSubtype: Call Management Func Desc */ 0x00, /* bmCapabilities: D0+D1 */ 0x01, /* bDataInterface: 1 */ /*ACM Functional Descriptor*/ 0x04, /* bFunctionLength */ 0x24, /* bDescriptorType: CS_INTERFACE */ 0x02, /* bDescriptorSubtype: Abstract Control Management desc */ 0x02, /* bmCapabilities */ /*Union Functional Descriptor*/ 0x05, /* bFunctionLength */ 0x24, /* bDescriptorType: CS_INTERFACE */ 0x06, /* bDescriptorSubtype: Union func desc */ USBD_CDC_CMD_INTERFACE, /* bMasterInterface: Communication class interface */ USBD_CDC_DATA_INTERFACE, /* bSlaveInterface0: Data Class Interface */ /*Endpoint 2 Descriptor*/ 0x07, /* bLength: Endpoint Descriptor size */ USB_DESC_TYPE_ENDPOINT, /* bDescriptorType: Endpoint */ CDC_CMD_EP, /* bEndpointAddress */ 0x03, /* bmAttributes: Interrupt */ LOBYTE(CDC_CMD_PACKET_SIZE), /* wMaxPacketSize: */ HIBYTE(CDC_CMD_PACKET_SIZE), 0x10, /* bInterval: */ /*---------------------------------------------------------------------------*/ /*Data class interface descriptor*/ 0x09, /* bLength: Endpoint Descriptor size */ USB_DESC_TYPE_INTERFACE, /* bDescriptorType: */ USBD_CDC_DATA_INTERFACE, /* bInterfaceNumber: Number of Interface */ 0x00, /* bAlternateSetting: Alternate setting */ 0x02, /* bNumEndpoints: Two endpoints used */ 0x0A, /* bInterfaceClass: CDC */ 0x02, /* bInterfaceSubClass: */ 0x00, /* bInterfaceProtocol: */ 0x01, /* iInterface: */ /*Endpoint OUT Descriptor*/ 0x07, /* bLength: Endpoint Descriptor size */ USB_DESC_TYPE_ENDPOINT, /* bDescriptorType: Endpoint */ CDC_OUT_EP, /* bEndpointAddress */ 0x02, /* bmAttributes: Bulk */ LOBYTE(CDC_DATA_FS_MAX_PACKET_SIZE), /* wMaxPacketSize: */ HIBYTE(CDC_DATA_FS_MAX_PACKET_SIZE), 0x00, /* bInterval: ignore for Bulk transfer */ /*Endpoint IN Descriptor*/ 0x07, /* bLength: Endpoint Descriptor size */ USB_DESC_TYPE_ENDPOINT, /* bDescriptorType: Endpoint */ CDC_IN_EP, /* bEndpointAddress */ 0x02, /* bmAttributes: Bulk */ LOBYTE(CDC_DATA_FS_MAX_PACKET_SIZE), /* wMaxPacketSize: */ HIBYTE(CDC_DATA_FS_MAX_PACKET_SIZE), 0x01, /* bInterval: ignore for Bulk transfer */ /****************************MSC************************************/ /* Interface Association Descriptor */ USBD_IAD_DESC_SIZE, // bLength USBD_IAD_DESCRIPTOR_TYPE, // bDescriptorType USBD_MSC_FIRST_INTERFACE, // bFirstInterface USBD_MSC_INTERFACE_NUM, // bInterfaceCount 0x08, // bFunctionClass 0x06, // bFunctionSubClass 0x50, // bInterfaceProtocol 0x05, /******************** Mass Storage interface ********************/ 0x09, /* bLength: Interface Descriptor size */ USB_DESC_TYPE_INTERFACE, /* bDescriptorType: */ USBD_MSC_INTERFACE, /* bInterfaceNumber: Number of Interface */ 0x00, /* bAlternateSetting: Alternate setting */ 0x02, /* bNumEndpoints*/ 0x08, /* bInterfaceClass: MSC Class */ 0x06, /* bInterfaceSubClass : SCSI transparent*/ 0x50, /* nInterfaceProtocol */ 0x05, /* iInterface: */ /******************** Mass Storage Endpoints ********************/ 0x07, /*Endpoint descriptor length = 7*/ 0x05, /*Endpoint descriptor type */ MSC_EPIN_ADDR, /*Endpoint address (IN, address 1) */ 0x02, /*Bulk endpoint type */ LOBYTE(MSC_MAX_FS_PACKET), HIBYTE(MSC_MAX_FS_PACKET), 0x01, /*Polling interval in milliseconds */ 0x07, /*Endpoint descriptor length = 7 */ 0x05, /*Endpoint descriptor type */ MSC_EPOUT_ADDR, /*Endpoint address (OUT, address 1) */ 0x02, /*Bulk endpoint type */ LOBYTE(MSC_MAX_FS_PACKET), HIBYTE(MSC_MAX_FS_PACKET), 0x01, /*Polling interval in milliseconds*/ }; |
ART-PI H750-USB-MSC 设备描述符异常
stm32h743 usbh msc 读写 u盘 新购买的 u盘只能识别到但不能进行读写 ?
stm32哪个系列芯片支持2个USB,主设备,且usb可以支持标准的uvc协议,哪里可以下载usb开发库
新手小白,SMT32 TP Tool Windows无法安装驱动怎么处理
如何用c#使用ST25R3911DISCOComm.dll来读取和写入NDEF区的数据,需要相关例程,感谢各位大佬拯救一下我啊!????
USBx配置有哪些小的需要注意的细节?
H743ZIT6 USB虚拟串口 CDC电脑无法识别(获取描述符失败)
STM32F407的高速USB,采用的是虚拟串口方式,VCP驱动有linux系统的吗
STM32H533的USB使用问题
stlink 串口驱动安装前面有叹号软件里无法找到
谢谢你的解答!但是我遇到的问题还不是安装不了驱动,而是连设备也没识别到。如果是识别到了两个设备打个感叹号估计都好处理一点。
F1的官方培训资料里面有
https://www.stmcu.org.cn/document/detail/index/id-218175
0x67是不是改为0x6A?