|
From: Tim R. <ti...@pr...> - 2021-07-11 18:18:42
|
On 7/10/21 7:24 AM, Matt wrote: > > Thanks for the suggestion. Do you know of any LibUSB asynchronous > examples for bulk mode that I can use? There are many. Here's one. https://falsinsoft.blogspot.com/2015/02/asynchronous-bulk-transfer-using-libusb.html > I just thought 512 was the maximum supported for bulk mode. The maximum packet size for a bulk endpoint on a high-speed device must be 512 bytes, but that doesn't need to concern you. A single TRANSFER can be much longer than that. The host controller driver will chop your transfer up into packets for transmission across the USB wire. On most operating systems, a transfer can be many megabytes. This is an important point, because you NEED to use this in order to maintain highest performance.. Remember that USB traffic is all scheduled in advance. The host controller driver lays out the schedule for the next frame, then sends it to the hardware where it gets executed autonomously. Once the schedule is committed, it can't be changed. A high-speed frame (125 microseconds) has room for about 7kB. If you send 512 bytes at a time, you will only get one slot in that microframe. But if you send, say, a 64kB buffer, then it will fill each microframe with your packets until the transfer is finished. For a 64kB buffer, that's 1.2 microseconds vs 16 milliseconds. -- Tim Roberts, ti...@pr... Providenza & Boekelheide, Inc. |