SEARCH
TOOLBOX
LANGUAGES
Register    Login    Forum    Search    FAQ

Board index » Electronics Projects » PIC18F USB development




Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Maximum USB Throughput
 Post Posted: Fri Jan 27, 2012 5:28 am 
Offline

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?


Top 
 Profile  
 
 Post subject: Re: Maximum USB Throughput
 Post Posted: Fri Jan 27, 2012 7:18 am 
Offline

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


Top 
 Profile  
 
 Post subject: Re: Maximum USB Throughput
 Post Posted: Fri Feb 03, 2012 7:51 pm 
Offline

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.


Top 
 Profile  
 
 Post subject: Re: Maximum USB Throughput
 Post Posted: Fri Feb 03, 2012 8:16 pm 
Offline

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 :)


Top 
 Profile  
 
 Post subject: Re: Maximum USB Throughput
 Post Posted: Fri Feb 03, 2012 8:26 pm 
Offline

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.


Top 
 Profile  
 
 Post subject: Re: Maximum USB Throughput
 Post Posted: Fri Feb 03, 2012 8:44 pm 
Offline

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.


Top 
 Profile  
 
 Post subject: Re: Maximum USB Throughput
 Post Posted: Mon Mar 12, 2012 8:00 am 
Offline

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 ??


Top 
 Profile  
 
 Post subject: Re: Maximum USB Throughput
 Post Posted: Mon Mar 12, 2012 12:07 pm 
Offline

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.


Top 
 Profile  
 
 Post subject: Re: Maximum USB Throughput
 Post Posted: Mon Mar 12, 2012 2:24 pm 
Offline

Joined: Thu Sep 29, 2011 4:18 pm
Posts: 51
Sorry.. Can i know what is the form designer ?


Top 
 Profile  
 
 Post subject: Re: Maximum USB Throughput
 Post Posted: Mon Mar 12, 2012 2:35 pm 
Offline

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 ?


Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

Board index » Electronics Projects » PIC18F USB development


Who is online

Users browsing this forum: No registered users and 1 guest

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Translated by Maël Soucaze © 2009 phpBB.fr