我利用STM32的库函数,使USB的端点0和上位机通信,用的是控制传输。USB这一块,是在Custom HID这个官方例程的基础上改动得来的,已经可以正常工作了,但是发现一个小问题,请看以下通过Bus Hound抓到的数据。
为什么建立过程(1)与数据过程(2)之间,间隔了16ms?
在建立过程(7)之后,为什么返回了一个USTS(8)?
这是不是下位机没有及时响应引起的?
现在要求通讯时间尽可能的少,怎么样解决以上的两个问题?
我刚刚接触USB,希望能得到大家的指点,提供一些思路。谢谢!
Bus Hound 6.01 capture on Windows XP Service Pack 3 (x86). Complements of www.perisoft.net
Device - Device ID (followed by the endpoint for USB devices)
(24) USB 人体学输入设备
(25) HID-compliant device
(26) USB Mass Storage Device
(27) Kingston DataTraveler G3 [ROM=PMAP]
(28) EMV Smartcard Reader
Phase - Phase Type
CTL USB control transfer
IN Data in transfer
OUT Data out transfer
USTS USB status
Data - Hex dump of the data transferred
Descr - Description of the phase
Cmd... - Position in the captured data
Time - Time the phase occurred in hour:minute:second.millisec form
Device Phase Data Description Cmd.Phase.Ofs(rep) Time
------ ----- -------------------------------------------------- ---------------- ------------------ ------------
24.0 CTL 21 09 06 03 00 00 ff 00 SET REPORT 1.1.0 11:34:48.484 (1)
24.0 OUT 06 aa f0 00 0e 80 00 00 00 00 00 00 ff 03 fd d4 ................ 1.2.0 11:34:48.500 (2)
12 00 1a 09 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1.2.16
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1.2.32
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1.2.48
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1.2.64
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1.2.80
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1.2.96
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1.2.112
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1.2.128
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1.2.144
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1.2.160
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1.2.176
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1.2.192
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1.2.208
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 1.2.224
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ............... 1.2.240
24.0 CTL a1 01 06 03 00 00 ff 00 GET REPORT 2.1.0 11:34:48.515 (3)
24.0 IN 06 55 00 00 0e 00 00 ff 00 ff 00 00 00 ff 02 fe .U.............. 2.2.0 11:34:48.515 (4)
d5 13 18 86 .... 2.2.16
24.0 CTL 21 09 06 03 00 00 ff 00 SET REPORT 3.1.0 11:34:48.515 (5)
24.0 OUT 06 aa f0 00 0f 80 00 00 00 00 00 00 ff 04 fc d4 ................ 3.2.0 11:34:48.515 (6)
4a 01 00 e1 ac 00 00 00 00 00 00 00 00 00 00 00 J............... 3.2.16
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 3.2.32
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 3.2.48
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 3.2.64
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 3.2.80
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 3.2.96
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 3.2.112
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 3.2.128
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 3.2.144
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 3.2.160
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 3.2.176
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 3.2.192
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 3.2.208
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 3.2.224
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ............... 3.2.240
24.0 CTL a1 01 06 03 00 00 ff 00 GET REPORT 4.1.0 11:34:48.531 (7)
24.0 USTS c0000004 stall pid 4.2.0 11:34:48.546 (8)
24.0 CTL a1 01 06 03 00 00 ff 00 GET REPORT 5.1.0 11:34:48.562 (9)
24.0 IN 06 55 00 00 18 00 00 ff 00 ff 00 00 00 ff 0c f4 .U.............. 5.2.0 11:34:48.562 (10)
d5 4b 01 01 00 04 08 04 9d 1c 92 db a8 bc .K............ 5.2.16 |