[求助]CH375B+C8051F020 USB DEVICE数据传输测试的问题

我的硬件是C8051F020与CH375B,作为USB Device与电脑相连。 用CH372EVT中的测试程序,发现 BulkTest和Speed372测试结果令人满意,传输率最大可到400K/S左右,也没有数据错误。 但是同样的硬件用Test目录下的测试程序test.c就不行,其实CH375端口读写函数都是一样的,其它硬件相关的设置都一样。 后来增加了 读写延时(WR,RD宽度),勉强可出数据,但是从电脑上发送数据后,要等几秒钟(3~4秒)才有数据传回来, 而且比较容易出错。 请问这种现象正常吗?是什么原因造成的?哪里找问题啊? 请高手指点,谢谢! ================== BULK传输测试很好 ===================== C:\temp>BULKTEST

CH372/CH375 Bulk Data Test Program V1.1 , Copyright (C) W.ch 2004.12 test data correctness and USB speed *** Load DLL: CH375DLL.DLL *** CH375OpenDevice: 0# *** Step-0: notice MCU start test start test now *** Step-1: test data correctness: 5000 times, random length and data *** passed *** Step-2: test speed of download data: 2048KB data *** download speed = 306586.8 Bytes/Sec, total=2048000 bytes, time=6680 mS *** Step-3: test speed of upload data: 2048KB data *** upload speed = 390318.3 Bytes/Sec, total=2048000 bytes, time=5247 mS *** Total error = 0 *** CH375CloseDevice: 0

Exit.

C:\temp>SPEED372

CH372/CH375 Bulk Data Test Program V1.2 , Copyright (C) W.ch 2004.12 test data correctness and USB speed, use buffer upload mode *** Load DLL: CH375DLL.DLL *** CH375OpenDevice: 0# *** Step-0: notice MCU start test start test now *** Step-1: test data correctness: 1000 times, random length and data *** passed *** Step-2: test speed of download data: 2048KB data *** download speed = 287196.7 Bytes/Sec, total=2048000 bytes, time=7131 mS *** Step-3: test speed of upload data: 2048KB data *** upload speed = 415578.7 Bytes/Sec, total=2051712 bytes, time=4937 mS, 935 *** Total error = 0 *** CH375CloseDevice: 0

Exit.

============= test就很差 ======================= C:\temp>test

CH372/CH375 Bulk Data Test Program V1.1 , Copyright (C) W.ch 2004.12 test data correctness *** Load DLL: CH375DLL.DLL *** CH375OpenDevice: 0# *** Step-1: test data correctness: 10000000 times, random length and data S1-T2-C2 return length error: 0 (40)6CH,D6H,AEH... S1-T2-C6 return length error: 0 (13)EFH,57H,49H... S1-T0-C8 return length error: 0 (64)00H,00H,00H... S1-T2-C10 return length error: 0 (64)3H,E5H,3CH... S1-T0-C12 return length error: 0 (64)0H,00H,00H... S1-T3-C15 return length error: 0 (64)0H,A7H,54H... S1-T1-C17 return length error: 0 (39)FH,FFH,FFH... S1-T3-C19 return length error: 0 (64)FH,7EH,CAH... S1-T1-C21 return length error: 0 (45)FH,FFH,FFH... S1-T0-C24 return length error: 0 (46)0H,00H,00H... S1-T3-C27 return length error: 0 (64)DH,5AH,EAH... Cnt= 29, Len=38, Data: 21H,FFH,FFH,FFH,FFH,FFH...

按照你说的现象的话,估计和你的下位机程序上面有点关系,你可以拿TEST。C这个程序加上上位机的DEBUG372的程序来进行调试,你看下可以不可以进行数据通信,还有,在上下位机通信的时候,一定要知道彼此的通信协议才能正常的通信


感谢回复,问题解决了。 问题是CH375_WR_CMD_PORT()函数漏了2us延时,加上就好了。但是bulk测试就不需要这个延时。


只有登录才能回复,可以选择微信账号登录