JM60 USB HID transfer speed

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

JM60 USB HID transfer speed

2,931 Views
donw
Contributor IV
I have the DemoJM60 board, running the CMX USB stack
demo code, patched to echo back 64 byte data packets.
My PC code is Visual Basic 6 running  USBHIDIO.vbp  from lvr.com
which uses the HID driver of XP.
I have now increased the report size to 576 bytes , so on receipt of  a transaction from the PC
the micro sends 9 transactions (of 64bytes).
This has decreased the total transfer time (mostly due to less OUT transactions from the PC, I guess)
so I now get 2MByte of data to the PC in 130seconds. This is still very slow.
Does anyone have a (compiled) Visual C program which sends (anything) & recieves data transaction using the HID driver,  just to see if Visual Basic is part of the speed problem?

My other thought:
Reading between the lines on USB transfers, I get the impression that multiple EndPoints data packets
can/are send in the same transaction (ie the 1 msec blocks). Hence if I have 2 (or more ) endpoints running I would double the transfer speed.
Is this idea correct?
Does anyone have the micro code for added another endpoint to the CMX demo code? It is
way beond my limited C coding ability!...

Labels (1)
0 Kudos
Reply
4 Replies

541 Views
JimDon
Senior Contributor III
This is equal to about 150K baud.
For one thing, are you certain that you are not dropping any packets in the code chain.
I had to do a lot of buffering to insure I did not drop packets.
If you have not done so, you should put test data in the reports. I used a count pattern, and insured that each packet came in order. I also used a crc ins the last packet across all the data sent.

It is also possible that the hub and or cable you are using are causing retransmission issues - if a packet is bad coming in from the device it will resend it.
0 Kudos
Reply

541 Views
donw
Contributor IV
I am using the DEMOJM eval. board, with its USB cable, and a XP 1.6Ghz laptop, XP sp3.
So I dont think there is any hardware problem. (The transfer time is constant every time)
The PC data send increments a count in the data, which is echoed back by the micro.
So I seem to get all data transfers OK.
Where did you have to do data buffering? In the PC or micro?
The micro code Main loop does nothing except wait for packets & send back.
The PC HID code for recieve does a
ReadFile   then
WaitForSingleObject
which seems to work OK.

0 Kudos
Reply

541 Views
JimDon
Senior Contributor III
Are you saying that you code is like (pseudo code);

start:
Send 64 bytes to USB port
wait for 64 bytes back
check the data
increment some thing
goto start

0 Kudos
Reply

541 Views
donw
Contributor IV
Yes that is what I initially did, and got packet sends from the micro every ~12msecs
giving a transfer rate of ~10k in 7 ses.
Then I changed the Report Size to 576 bytes and in the micro do:

     /*  (incoming data) . */   
    if (hid_report_pending(out_report))
      {
                            
      PTED_PTED2= ~PTED_PTED2;    
     
      hid_read_report(out_report, USB_Report_Out);

    /* 1 Send report to PC*/
    while (hid_report_pending(in_report)) ;
     hid_write_report(in_report,USB_Report_Out); //micom
      hid_process();   // This only sends therefore does not need to be polled elsewhere
    

    /* 2 Send report to PC*/
    while (hid_report_pending(in_report)) ;
     hid_write_report(in_report,USB_Report_Out); //micom
      hid_process();   // This only sends therefore does not need to be polled elsewhere

 and repeat above sequence for total of  9 times (64bytes *9= 576)     


This speed transfers up a little. (Probably only because there is less PC OUT commands?)



0 Kudos
Reply