Even with USB 2.x, which has a 480 Mb/s reported speed, implementers are often surprised that their data throughput is actually slower than RS-232 or even the parallel port. How could this happen?
The reason this can happen is poor utilization of the USB transfer protocol. There are two main data transfer types in USB, isochronous and bulk. The isochronous transfer can achieve the 480 Mbps rate, but this comes at a cost. The isochronous primary emphasis is speed. In order to achieve this data rate, the isochronous protocol makes no guarantees about the data arriving in order, no guarantees of data arriving without errors, and no guarantees about the data arriving at all.
USB bulk transfers are exact opposite. It is important that data arrive as sent and in order sent. In order to achieve this, USB bulk transfers add overhead but this reduces throughput. Let's run the numbers:
Theoretical maximum throughput of USB 2.x for bulk transfers:
480 Mbs = 480 Mb / s = 480 Megabits / second = 503 316 480 bits/seconds
Time in USB 2.x
1 frame = 1 ms
1 uframe = 125 us
8000 uframes / 1 second
Max data payload size of bulk usb 2.x transfer = 512 bytes
Max bytes per frame(Table 5-10, USB 2.0 spec) = 6665
6665 bytes / uframe * 8000 uframes / s = 53248000 bytes / s = 406.2 Mb/s
406.2 Mb/s is fast but this can only be approached if the USB 2.x bulk transfer is used efficiently.
Tips on reaching the max limit of the USB 2.x bulk transfer protocol
- Minimize the amount of reading and writing of data. If possible, let data only transfer in one direction. USB 2.x is a half-duplex protocol.
- As much as possible, fill the entire transfer to its maximum data payload size of 512 bytes.
- Directly connect the USB 2.x peripheral to the host PC's hub.
No comments:
Post a Comment