我用的芯片是STM32的USB,上位机用的驱动为winUSB的驱动,自定义了一个应用,在win xp下能够正常安装驱动使用,但在win7下就出现了提示错误:设备无法启动(代码10)。详细的BUS Hound的捕获的枚举如下:
Bus Hound 5.00 capture. Complements of www.perisoft.net
Device - Device ID (followed by the endpoint for USB devices)
(31) MCD USB Device
Phase - Phase Type
CTL USB control transfer
DI Data in
USTS USB status
Data - Hex dump of the data transferred
Descr - Description of the phase
Cmd... - Position in the captured data
Device Phase Data Description Cmd.Phase.Ofs(rep)
------ ----- -------------------------------------------------- ---------------- ------------------
31.0 CTL 80 06 00 01 00 00 12 00 GET DESCRIPTOR 1.1.0
31.0 DI 12 01 00 02 00 00 00 08 ff ff 20 00 00 01 01 02 .......... ..... 1.2.0
03 01 .. 1.2.16
31.0 CTL 80 06 00 02 00 00 09 00 GET DESCRIPTOR 2.1.0
31.0 DI 09 02 20 00 01 01 00 60 32 .. ....`2 2.2.0
31.0 CTL 80 06 00 02 00 00 20 00 GET DESCRIPTOR 3.1.0
31.0 DI 09 02 20 00 01 01 00 60 32 09 04 00 00 02 00 00 .. ....`2....... 3.2.0
00 00 07 05 01 02 10 00 01 07 05 82 02 80 00 01 ................ 3.2.16
31.0 CTL 80 00 00 00 00 00 02 00 GET STATUS 4.1.0
31.0 DI 03 00 .. 4.2.0
31.0 CTL 00 09 01 00 00 00 00 00 SET CONFIG 5.1.0
31.0 USTS 00 03 00 80 bad parameter 5.2.0
最后一步总是出现 bad parameter的问题,但放在win xp下,set config之后就能正常运行了。
后来还用了winUSBtrace去看log,错误如下:
[1]0004.0030::03/16/2011-14:30:39.740 - DriverObject 0x878DC638
[1]0004.0030::03/16/2011-14:30:39.741 - Preparing hardware
[0]0004.0030::03/16/2011-14:30:39.762 - Unable to select the default configuration, failing Start
[0]0004.0030::03/16/2011-14:30:39.762 - Enter: WinUSB_ReleaseHardware
[0]0004.0030::03/16/2011-14:30:39.762 - Exit: WinUSB_ReleaseHardware (STATUS_SUCCESS)
[1]0004.0034::03/16/2011-14:30:39.764 - Handling Device Cleanup
看情况像是win7的下的USB协议要求更加规范而引起的,但是具体实在是不知道哪里不规范。因为STM32的例程CUSTOM_HID也能在win7下安装驱动成功。我的程序是通过这个例程修改而来的。
望有经验的大侠给点提示。 |