最近在做USB,要求实现U盘的功能,现在枚举已经通过,但在进行SCSI通信出现问题。
设定为当主机发送除INQURY和REQUEST SENSE之外的命令时,设备返回命令执行失败(既直接返回CSW且CSW最后位为1),现在出现的问题是,返回CSW后,主机一直等待(大约19s),之后主机重复发送上一条失败命令,设备返回CSW后主机再等待(19s)。用BusHound捕捉到主机在等待19s驱动后返回一个canceled指令。 BusHound数据如下
21 DO 55 53 42 43 - 08 10 8d 89 USBC.... 1.9ms 11.1.0
24 00 00 00 - 80 00 06 12 $....... 11.1.8
00 00 00 24 - 00 00 00 00 ...$.... 11.1.16
00 00 00 00 - 00 00 00 ....... 11.1.24
21 DI 00 80 00 00 - 1f 00 00 00 ........ 1.9ms 12.1.0
47 65 6e 65 - 72 69 63 20 Generic 12.1.8
55 53 42 20 - 53 44 20 52 USB SD R 12.1.16
65 61 64 65 - 72 20 20 20 eader 12.1.24
31 2e 30 30 1.00 12.1.32
21 DI 55 53 42 53 - 08 10 8d 89 USBS.... 2.0ms 13.1.0
00 00 00 00 - 00 ..... 13.1.8
21 DO 55 53 42 43 - 08 10 8d 89 USBC.... 1.9ms 14.1.0
fc 00 00 00 - 80 00 0a 23 .......# 14.1.8
00 00 00 00 - 00 00 00 fc ........ 14.1.16
00 00 00 00 - 00 00 00 ....... 14.1.24
21 DI 55 53 42 53 - 08 10 8d 89 USBS.... 2.0ms 15.1.0
fc 00 00 00 - 01 ..... 15.1.8
21 USTS 00 00 01 c0 canceled 19sc 16.1.0
21 DO 55 53 42 43 - 08 10 8d 89 USBC.... 227ms 7.1.0
fc 00 00 00 - 80 00 0a 23 .......# 17.1.8
00 00 00 00 - 00 00 00 fc ........ 17.1.16
00 00 00 00 - 00 00 00 ....... 17.1.24
21 DI 55 53 42 53 - 08 10 8d 89 USBS.... 1.9ms 18.1.0
fc 00 00 00 - 01 ..... 18.1.8
21 USTS 00 00 01 c0 canceled 19sc 19.1.0
捕捉一个普通的读卡器数据可以看到不同
16 DO 55 53 42 43 - 08 f0 81 89 USBC.... 242us 11.1.0
24 00 00 00 - 80 00 06 12 $....... 11.1.8
00 00 00 24 - 00 00 00 00 ...$.... 11.1.16
00 00 00 00 - 00 00 00 ....... 11.1.24
16 DI 00 80 00 00 - 1f 00 00 00 ........ 266us 12.1.0
47 65 6e 65 - 72 69 63 20 Generic 12.1.8
55 53 42 20 - 53 44 20 52 USB SD R 12.1.16
65 61 64 65 - 72 20 20 20 eader 12.1.24
31 2e 30 30 1.00 12.1.32
16 DI 55 53 42 53 - 08 f0 81 89 USBS.... 250us 13.1.0
00 00 00 00 - 00 ..... 13.1.8
16 DO 55 53 42 43 - 08 f0 81 89 USBC.... 117us 14.1.0
fc 00 00 00 - 80 00 0a 23 .......# 14.1.8
00 00 00 00 - 00 00 00 fc ........ 14.1.16
00 00 00 00 - 00 00 00 ....... 14.1.24
16 USTS 04 00 00 c0 pid stalled 255us 15.1.0
16 DI 55 53 42 53 - 08 f0 81 89 USBS.... 367us 16.1.0
fc 00 00 00 - 01 ..... 16.1.8
16 DO 55 53 42 43 - 08 f0 81 89 USBC.... 127us 17.1.0
12 00 00 00 - 80 00 0c 03 ........ 17.1.8
00 00 00 12 - 00 00 00 00 ........ 17.1.16
00 00 00 00 - 00 00 00 ....... 17.1.24
16 DI f0 00 02 00 - 00 00 00 0a ........ 123us 18.1.0
00 aa 55 40 - 3a 00 00 00 ..U@:... 18.1.8
00 00 .. 18.1.16
16 DI 55 53 42 53 - 08 f0 81 89 USBS.... 127us 19.1.0
00 00 00 00 - 00 ..... 19.1.8
可以看到读卡器返回CSW后,驱动返回 pid stalled 之后主机立刻发送REQUEST SENSE。而我的设备返回CSW后,主机一直等待........
不知道是什么原因..................
求教................... |