PDA

View Full Version : Varying USB Latency



waynepauly
- 11th July 2008, 14:09
USB latency seems to vary from about 1 msec to 15 msec and back to 1 msec every few seconds like a heartbeat; very regular! Using a 4550, PBP easy-HID template and a loop of writebacks from VisualBasic/Xp. Anyone have any ideas why? I need reliable low latency for this app.

Wayne

locko
- 11th July 2008, 19:31
Hi wayne,

I'm not 100% sure what you are describing so correct me if im wrong..
As I undersatand it, you are sending data from a pic which is recieved by the PC application and then the application sends data back to the pic, and you are seeing the 1 - 15ms difference between the transfers or vice-versa.
If this is correct and from what I have gathered, HID is not an exactly timed data transfer method. The PC will try to service the report request within the time asked for by the device as specified in the descriptors. The pic will only transfer/receive HID data when it has received a in/out report request from the PC.
I had an issue when I made a pic scope, where I could not transfer the data fast enough and got glitches in the waveform displayed in Visual Studio.
I'm not sure what you need to acheive, but it sounds like you may need to look into inturrupt or asyncronous transfer for a more reliable data packet request time.
You can also use ping pong buffering so that data is always ready to be send but I have no idea if PBP handles these - I doubt it does.
I'm not an expert and may not have understood you correctly but I'm sure someone else will come along and help you out.

Paul

waynepauly
- 12th July 2008, 13:03
Paul,

You are correct, the pc seems slow to respond sometimes at it's own whim, same as you experienced with your pic-scope. You mentioned interrupt or asyncronous transfers as a solution; do you know how to modify the easy-HID template to do them, or do you have to start over with a different approach?

Wayne

locko
- 12th July 2008, 16:16
Wayne,

I'm affraid not, I have been trying to modify the core assembler files and come up with PBP code to handle interrupt transfers for an outstanding project of mine but without any luck. No ones else on here seems to have a solution either so it looks like were on our own. I'm about to start packing my stuff up for a move back to the States so wont be able to work on this for a while.
You may have to look into something like Jungo, but your looking at $$.

I will be keeping an eye out on the internet for an answer and if I find something, Ill give you a shout.

Paul

falingtrea
- 14th July 2008, 18:39
The only way you can be guaranteed low latency is to establish an isochronous connection. The USB bus is assigned bandwidth on a first come first served basis, with the exception of isochronous connections, which receive guaranteed bandwidth if possible.