| Author |
Message |
|
okmn
|
Post subject: Maximum USB Throughput Posted: Fri Jan 27, 2012 5:28 am |
|
Joined: Wed Nov 30, 2011 2:05 am Posts: 4
|
|
Hi Simon,
Have you tried calculating the maximum data throughput using bulk data transfer? If so, how did you do it? If not, any suggestions on the best way to calculate the practical throughput?
|
|
 |
|
 |
|
Simon Inns
|
Post subject: Re: Maximum USB Throughput Posted: Fri Jan 27, 2012 7:18 am |
|
Joined: Thu Apr 01, 2010 6:23 am Posts: 893
|
I haven't calculated this but it should be simply a case of placing a timer around the bulk transfer in the host code and timing how long it takes to send 128 packets. I doubt it will be that fast though; Generic HID isn't really for high-speed bulk data as there are other USB protocols far more suited to the job. If you do have a go at timing it please post back the results; it would be interesting to know  /Simon
|
|
 |
|
 |
|
okmn
|
Post subject: Re: Maximum USB Throughput Posted: Fri Feb 03, 2012 7:51 pm |
|
Joined: Wed Nov 30, 2011 2:05 am Posts: 4
|
|
I've set up a stopwatch around test3() in your generic bulk transfer project. Test3 sends a single packet to the device, then the host receives 128 packets from the device. The stopwatch results are 130ms, and the data sent is 8192 bytes in the bulk transfer (128 packets * 64bytes per packet = 8192 bytes). The throughput is then 8192 bytes/130ms = 504kb/s = 63kB/s = 0.5Mb/s. Are these results consistent with what you would expect?
EDIT: Also I removed all debug string printing in the device firmware and host software.
|
|
 |
|
 |
|
Simon Inns
|
Post subject: Re: Maximum USB Throughput Posted: Fri Feb 03, 2012 8:16 pm |
|
Joined: Thu Apr 01, 2010 6:23 am Posts: 893
|
Sounds reasonable given the speed of the PIC18F. If you want to go faster you can use USB protocols like the mass storage and use the PIC18F's USB DMA transfer feature to throw the data to and from external RAM very quickly (since the CPU core isn't used for DMA). With Generic HID the transfer is more flexible, but also slower. Thanks for sharing your results 
|
|
 |
|
 |
|
okmn
|
Post subject: Re: Maximum USB Throughput Posted: Fri Feb 03, 2012 8:26 pm |
|
Joined: Wed Nov 30, 2011 2:05 am Posts: 4
|
|
Oops, I should have mentioned that I have adapted your projects for use with a dsPIC33EP which runs at 60MHz.
|
|
 |
|
 |
|
Simon Inns
|
Post subject: Re: Maximum USB Throughput Posted: Fri Feb 03, 2012 8:44 pm |
|
Joined: Thu Apr 01, 2010 6:23 am Posts: 893
|
I did think it was a very good result for a little 18F  It would be interesting to see the speed difference between the dsPIC and the 18F though. If I find some time I might measure it just out of interest.
|
|
 |
|
 |
|
ChopperLee
|
Post subject: Re: Maximum USB Throughput Posted: Mon Mar 12, 2012 8:00 am |
|
Joined: Thu Sep 29, 2011 4:18 pm Posts: 51
|
|
Hi.. i want to measure the USB communication speed . How to apply Stopwatch class into USB device application ??
|
|
 |
|
 |
|
Simon Inns
|
Post subject: Re: Maximum USB Throughput Posted: Mon Mar 12, 2012 12:07 pm |
|
Joined: Thu Apr 01, 2010 6:23 am Posts: 893
|
|
Use C#'s timer class. Set it up using the form designer then enable the timer when communication starts and then disable it when communication ends. It's very easy to use.
|
|
 |
|
 |
|
ChopperLee
|
Post subject: Re: Maximum USB Throughput Posted: Mon Mar 12, 2012 2:24 pm |
|
Joined: Thu Sep 29, 2011 4:18 pm Posts: 51
|
|
Sorry.. Can i know what is the form designer ?
|
|
 |
|
 |
|
ChopperLee
|
Post subject: Re: Maximum USB Throughput Posted: Mon Mar 12, 2012 2:35 pm |
|
Joined: Thu Sep 29, 2011 4:18 pm Posts: 51
|
|
I am understand on the timer enable and disable part when toggle an input. But how to calculate the USB communication speed ? What method can used in C# to calculate the speed ?
|
|
 |
|
 |
|