View previous topic :: View next topic |
Author |
Message |
chrispol
Joined: 18 Oct 2009 Posts: 14
|
USB Speed |
Posted: Mon Oct 26, 2009 9:30 am |
|
|
I'm using bulk transfer, using usb_puts writing a 8 byte packet, using Microchip's bulk driver & dll. The execution time is horrid. I need to stream a total of 9 bytes every 400us. Right now it's taking about 4500us.
Any ideas?
Thanks |
|
|
Ttelmah Guest
|
|
Posted: Mon Oct 26, 2009 10:17 am |
|
|
Seriously, don't use bulk transfers.....
The 'point' about bulk transfers, is that they are designed to transfer _large amounts of data_, _without_ interfering with other transfers. As such, they 'defer' to just about everything else on the bus...
They are ideal for sending a lot of data to something _where timing is not critical_, but are not at all suitable if timing is an issue.
Look at the examples for keyboard/mouse transfers. These are designed to give fast response, at a cost in terms of not being suitable for moving large amounts of data.
Best Wishes |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Mon Oct 26, 2009 11:47 am |
|
|
A full speed host is polling the device every 1 ms for new data, so you can't send data from the device every 400 us. |
|
|
Rohit de Sa
Joined: 09 Nov 2007 Posts: 282 Location: India
|
|
Posted: Tue Oct 27, 2009 8:32 am |
|
|
FvM has rightly pointed out the maximum poll rate - the host doesn't poll faster than 1ms. However, you can reduce 4500us to a smaller number by removing all other devices on the USB bus.
Bulk mode data is low priority data - it will send data on the bus only if the transfer doesn't 'interfere' with the other transfers taking places simultaneously on the bus (that is one of the reasons why, if you have multiple devices on a USB bus, and you try to transfer files from a USB harddisk the transfer rate slows down tremedously). Remove all other devices on the bus.
Rohit |
|
|
chrispol
Joined: 18 Oct 2009 Posts: 14
|
|
Posted: Wed Oct 28, 2009 8:04 am |
|
|
Right now i'm doing bulk transfer of a 512k packet, so buffering a bunch of data then sending it out, but you notice a hiccup when it sends out data, maybe i will try the same method on hid. |
|
|
|