看到论坛有不少STM32 USB虚拟串口及复合设备类似的帖子,就好奇能否验证下虚拟全部5个串口,也算是做个验证,于是有了下面的工作,现在还遇到有驱动问题,还望大家赐教。1.参照ST官网帖子Multiple USB CDC (USB IAD). How? 建立的描述符文件,其中:VCP1使用interrupt IN EP2/ bulk IN EP1/ bulk OUT EP1;VCP2使用interrupt IN EP2/ bulk IN EP3/ bulk OUT EP3
VCP3使用interrupt IN EP2/ bulk IN EP4/ bulk OUT EP4;VCP4使用interrupt IN EP2/ bulk IN EP5/ bulk OUT EP5;VCP5使用interrupt IN EP2/ bulk IN EP6/ bulk OUT EP6;
2.设备描述符表为const uint8_t Virtual_Com_Port_DeviceDescriptor[] =
{
0x12, /* bLength */
USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */
0x00,
0x02, /* bcdUSB = 2.00 */
0xEF, /* bDeviceClass (Misc) */
0x02, /* bDeviceSubClass (common) */
0x01, /* bDeviceProtocol (IAD) */
0x40, /* bMaxPacketSize0 */ // <-----------
0x83,
0x02, /* idVendor = 0x0283 */
0xFF,
0x01, /* idProduct = 0x01FF */
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 */
};
插入USB座,能检测到设备,查找驱动,但没有合适驱动,如下图所示。
3.驱动文件如下:
[Version]
Signature="$Windows NT$"
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Provider=%COMPANY%
LayoutFile=layout.inf ;; not supported in Vista and later
DriverVer =26/02/2013, V1.0.0
[Manufacturer]
%MFGNAME%=DeviceList,ntamd64
;------------------------------------------------------------------------------
; Device list
;------------------------------------------------------------------------------
[DeviceList]
%DESCRIPTION1% = STM32CDCCMP, USB\VID_0283&PID_01FF&MI_00
%DESCRIPTION2% = STM32CDCCMP, USB\VID_0283&PID_01FF&MI_02
%DESCRIPTION3% = STM32CDCCMP, USB\VID_0283&PID_01FF&MI_04
%DESCRIPTION4% = STM32CDCCMP, USB\VID_0283&PID_01FF&MI_06
%DESCRIPTION5% = STM32CDCCMP, USB\VID_0283&PID_01FF&MI_08
[DeviceList.ntamd64]
%DESCRIPTION1% = STM32CDCCMP, USB\VID_0283&PID_01FF&MI_00
%DESCRIPTION2% = STM32CDCCMP, USB\VID_0283&PID_01FF&MI_02
%DESCRIPTION3% = STM32CDCCMP, USB\VID_0283&PID_01FF&MI_04
%DESCRIPTION4% = STM32CDCCMP, USB\VID_0283&PID_01FF&MI_06
%DESCRIPTION5% = STM32CDCCMP, USB\VID_0283&PID_01FF&MI_08
;------------------------------------------------------------------------------
; Installation
;------------------------------------------------------------------------------
[SourceDisksNames]
;;; this blank section satisfies chkinf
[SourceDisksFiles]
;;; this blank section satisfies chkinf
[DestinationDirs]
;FakeModemCopyFileSection=12
DefaultDestDir = 12
[STM32CDCCMP]
include=mdmcpq.inf
CopyFiles=FakeModemCopyFileSection
AddReg= STM32CDCCMP.AddReg
[STM32CDCCMP.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,usbser.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[STM32CDCCMP.Services]
AddService=usbser, 0x00000002, DriverService
[DriverService]
DisplayName=%DRIVER.SVC%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%usbser.sys
;------------------------------------------------------------------------------
; String Definitions
;------------------------------------------------------------------------------
[Strings]
COMPANY = "Yhf"
DRIVER.SVC = "STM32 CDC Composite Driver"
DESCRIPTION1= "STM32 CDC Composite Port 1"
DESCRIPTION2= "STM32 CDC Composite Port 2"
DESCRIPTION3= "STM32 CDC Composite Port 3"
DESCRIPTION4= "STM32 CDC Composite Port 4"
DESCRIPTION5= "STM32 CDC Composite Port 5"
4.已安装过ST官网Virtual COM Port Driver V1.3.1,测试过其例程OK。系统为win7,查找并加载驱动,不稳定,每次插拔现象不同,提示概括如下:
第一次加载提示
Service段不正确,但能出现COM13的标示等。
以后插拔现象:
5.问题:(1)inf文件是否正确,该如何修改?(2)哪些工作不正确,或者该如何改正?谢谢!
|
|