Hello,
I am stuck in implementing USB composite (VCP+MSC) using FS-Device_Lib_V4.0.0 (STM32L151). Individually both works but when I try composite VCP+MSC, MSC works well but PC can't communicate via VCP (although it can recognize as COM port).
I've edited .inf file and updated device descriptions. What else I am missing to config? I request your suggestion how to fix this issue. I posted same query in ST forum, didnt have any clue there.
Thank you in advance.
NB: I'm using ENDP1 in+out for MSC, ENDP3 in+out for VCP, ENDP2 in for VCP interrupt. End point address combined as:
#define BTABLE_ADDRESS (0x00) #define ENDP0_RXADDR (0x0040) #define ENDP0_TXADDR (0x0080) /* EP1 MSC */ #define ENDP1_TXADDR (0x0150) #define ENDP1_RXADDR (0x0190) /* EP2 VCP Int*/ #define ENDP2_TXADDR (0x0100) /* EP3 VCP*/ #define ENDP3_TXADDR (0x00C0) #define ENDP3_RXADDR (0x0110)
To include VCP interfaces (interface 0 for MSC, 1 and 2 for VCP int), I've edited stmcdc.inf file of virtual com port driver like this:
[Version] Signature="$Windows NT$" Class=Ports ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} Provider=%PRVDR% CatalogFile=stmcdc.cat DriverVer=04/25/2010,1.3.1 ;[SourceDisksNames] ;1=%DriversDisk%,,, ;[SourceDisksFiles] [Manufacturer] %MFGNAME%=DeviceList,NT,NTamd64 ;[DestinationDirs] ;DefaultDestDir = 12 ; ========== VID PID =========== [DeviceList.NT] %DESCRIPTION%=DriverInstall,USB\VID_0483&PID_5741&MI_00 %DESCRIPTION%=DriverInstall,USB\VID_0483&PID_5741&MI_01 %DESCRIPTION%=DriverInstall,USB\VID_0483&PID_5741&MI_02 [DeviceList.NTamd64] %DESCRIPTION%=DriverInstall,USB\VID_0483&PID_5741&MI_00 %DESCRIPTION%=DriverInstall,USB\VID_0483&PID_5741&MI_01 %DESCRIPTION%=DriverInstall,USB\VID_0483&PID_5741&MI_02 ; ========== Class definition =========== [ClassInstall32] AddReg = ClassInstall_AddReg [ClassInstall_AddReg] HKR,,,,%ClassName% HKR,,NoInstallClass,,1 HKR,,IconPath,%REG_MULTI_SZ%,"%systemroot%\system32\setupapi.dll,-20" HKR,,LowerLogoVersion,,5.2 ; =================== Installation =================== [DriverInstall.NT] Include=mdmcpq.inf CopyFiles=FakeModemCopyFileSection AddReg=DriverInstall.NT.AddReg [DriverInstall.NT.AddReg] HKR,,DevLoader,,*ntkern HKR,,NTMPDriver,,usbser.sys HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" [DriverInstall.NT.Services] AddService=usbser, 0x00000002, DriverServiceInst [DriverServiceInst] DisplayName=%SERVICE% ServiceType = 1 ; SERVICE_KERNEL_DRIVER StartType = 3 ; SERVICE_DEMAND_START ErrorControl = 1 ; SERVICE_ERROR_NORMAL ServiceBinary= %12%\usbser.sys LoadOrderGroup = Base [Strings] PRVDR = "STMicroelectronics" MFGNAME = "STMicroelectronics." DESCRIPTION = "STMicroelectronics Virtual COM Port" SERVICE = "STM Virtual COM Port" DriversDisk = "STM Drivers Disk" REG_MULTI_SZ = 0x00010000 ClassName="Universal Serial Bus devices"
[contd. Device des]
/******************** Descriptor of Mass Storage interface ********************/ 0x09, /* bLength: Interface Descriptor size */ 0x04, /* bDescriptorType: */ 0x00, /* bInterfaceNumber: Number of Interface */ 0x00, /* bAlternateSetting: Alternate setting */ 0x02, /* bNumEndpoints*/ 0x08, /* bInterfaceClass: MASS STORAGE Class */ 0x06, /* bInterfaceSubClass : SCSI transparent*/ 0x50, /* nInterfaceProtocol */ 5, /* iInterface: */ 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 */ 0x07, /*Endpoint descriptor length = 7 */ 0x05, /*Endpoint descriptor type */ 0x01, /*Endpoint address (OUT, address 1) */ 0x02, /*Bulk endpoint type */ 0x40, /*Maximum packet size (64 bytes) */ 0x00, 0x00 /*Polling interval in milliseconds*/ };
Device Descriptor: ------------------
const uint8_t Composite_DeviceDescriptor[] = { 0x12, // bLength USB_DEVICE_DESCRIPTOR_TYPE, // bDescriptorType=01 0x00, 0x02, // bcdUSB = 2.00 0xEF, // bDeviceClass // Base Class 0x00 previously 0x02, // bDeviceSubClass //0x00 previously 0x01, // bDeviceProtocol //0x00 previously 0x40, // bMaxPacketSize0 0x83, // idVendor = 0x0483 (STMicroelectronics) 0x04, 0x41, // idProduct = 0x5741 New 0x57, 0x00, 0x02, // bcdDevice = 2.00 1, // Index of string descriptor describing manufacturer 2, // Index of string descriptor describing product 3, // Index of string descriptor describing the device's serial number 0x01 // bNumConfigurations }; const uint8_t Composite_ConfigDescriptor[] = { 0x09, // bLength: Configuration Descriptor size USB_CONFIGURATION_DESCRIPTOR_TYPE, // bDescriptorType: Configuration = 02 Composite_SIZ_CONFIG_DESC, // wTotalLength: no of returned bytes= 108 0x00, 0x03, // bNumInterfaces: 3 interface-----2 VCP, 1 MSC 0x01, // bConfigurationValue: Configuration value 0x00, // iConfiguration: Index of string descriptor describing the configuration 0x80, // bmAttributes: bus powered, for Self powered 0xC0 0xFA, // MaxPower 500mA. 0x7D for 250mA, 0x32 for 100mA /* IAD to associate the two CDC interfaces */ 0x08, /* bLength */ 0x0B, /* bDescriptorType */ 0x01, /* bFirstInterface */ 0x02, /* bInterfaceCount */ 0x02, /* bFunctionClass */ 0x02, /* bFunctionSubClass */ 0x01, /* bFunctionProtocol */ 0x04, /* iFunction (Index of string descriptor describing this function) */ 0x09, // bLength: Interface Descriptor size USB_INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType: Interface= 04 0x01, // bInterfaceNumber: Number of Interface 0x00, // bAlternateSetting: Alternate setting 0x01, // bNumEndpoints: One endpoint used 0x02, // bInterfaceClass: Communication Interface Class 0x02, // bInterfaceSubClass: Abstract Control Model 0x01, // bInterfaceProtocol: Common AT commands 0x05, // 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 0x00, // bMasterInterface: Communication class interface 0x01, // bSlaveInterface0: Data Class Interface // Endpoint 2 Descriptor 0x07, // bLength: Endpoint Descriptor size USB_ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType: Endpoint=05 0x82, // bEndpointAddress: (IN2) 0x03, // bmAttributes: Interrupt Composite_INT_SIZE, // wMaxPacketSize= 08 0x00, 0xFF, // bInterval: // Data class interface descriptor 0x09, // bLength: Endpoint Descriptor size USB_INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType=04 0x02, // bInterfaceNumber: Number of Interface 0x00, // bAlternateSetting: Alternate setting 0x02, // bNumEndpoints: Two endpoints used 0x0A, // bInterfaceClass: CDC 0x00, // bInterfaceSubClass: 0x00, // bInterfaceProtocol: 0x05, // iInterface: // Endpoint 3 out Descriptor 0x07, // bLength: Endpoint Descriptor size USB_ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType: Endpoint=05 0x03, // bEndpointAddress: (OUT3) 0x02, // bmAttributes: Bulk Composite_DATA_SIZE, // wMaxPacketSize: 64 0x00, 0x00, // bInterval: ignore for Bulk transfer // Endpoint 3 in Descriptor 0x07, // bLength: Endpoint Descriptor size USB_ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType: Endpoint=05 0x83, // bEndpointAddress: (IN3) 0x02, // bmAttributes: Bulk Composite_DATA_SIZE, // wMaxPacketSize: 64 0x00, 0x00, // bInterval
View all questions in Keil forum