用PD12做的SD读卡器,现在可以在电脑上识别和读了,但仍不能写入文件,通过Bus Hound和串口监测发现,少接收了一个64字节的数据包,直接导致超时,后面就乱了。。。下面是Bus Hound监测到写SD的数据过程:
Device Phase Data Description Delta
------ ----- ------------------------ ---------------- -----
28 CDB 2a 00 00 00 00 00 00 00 WRITE 21sc
01 00
27.2 LEN 1f 00 00 00 31 1.3ms
27.2 DO 55 53 42 43 80 41 f0 83 USBC.A.. 2us
00 02 00 00 00 00 0a 2a .......*
00 00 00 00 00 00 00 01 ........
00 00 00 00 00 00 00 .......
27.2 LEN 00 02 00 00 512 3.9ms
27.2 DO eb 58 90 4d 53 44 4f 53 .X.MSDOS 2us
35 2e 30 00 02 08 24 00 5.0...$.
02 00 00 00 00 f8 00 00 ........
3f 00 ff 00 00 00 00 00 ?....... //串口监测实际只接收到了(512-64)Byte
28 SSTS 09 timeout 9.8sc
27 RSET 58us
28 CDB 25 00 00 00 00 00 00 00 READ CAPACITY 27us
00 00
27 NSTS 00 00 00 00 success 227ms
27.2 LEN 1f 00 00 00 31 1.9ms
27.2 DO 55 53 42 43 48 2e cc 83 USBCH... 3us
08 00 00 00 80 00 0a 25 .......%
00 00 00 00 00 00 00 00 ........
00 00 00 00 00 00 00 .......
28 CDB 2a 00 00 00 00 00 00 00 WRITE 767ms
01 00
28 SSTS 09 timeout 9.0sc
27 RSET 55us
27 NSTS 00 00 00 00 success 227ms
有谁遇到这种类似情况的啊?高手帮我一起分析分析吧。。。
我是先MSC_BulkOut()中把数据放入BulkBuf[64],若写则偏移放入Memory[512],接收到一扇区后再写入到SD卡中。 |