hi
I would like to know what values you folks are specifying in your read/write handlers to make your XP USB bulk transfers efficient.
( 1 ) For the DDK Bulk sample, I see that it makes an initial check to see if the total length to transfer is greater than BULKUSB_TEST_BOARD_TRANSFER_BUFFER_SIZE, which is 64K and I guess is the maximum amount of data the USB device can store for the bulk endpoint.
( a ) Is this correct? Is the max buffer side on the usb device dictating the total length of transfer (the sum of the segment length transfers)?
( b ) Must this check be made? For example, if this was a write transaction in the function driver and the data to be written was 128K but the USB device could only store 64 K in its buffers, would the USBD subsystem fail the transaction? Or would the problem be that the transaction would end up pending until the USB device read data out of its buffers which would make room for the USBD system to write more data? I could see that pending would be bad because you would be wasting bandwidth while pending.
(2 ) For a multiple stage transfer (I.e. multiple calls to USBBuildInterruptOrBulkTransferRequest), how do you determine what to pass as the stage length (the number of bytes to transfer for each UsbBuildInterruptOrBulkTransfer request)?
( a ) I know the USB spec says that this length has to be a multiple of the MaxPacketSize, but how do you pick the segment length? In other words, how do you pick what multiple of MaxPacketSize should be specified as the segment length?
I could see that the bigger the segment length value, the less number of stage lengths you need, so you might be more efficient.
I could also see picking this segment length dynamically - for example, for the write case, you would pick the stage length to be the maximum number that does not exceed the total data buffer length.
The DDK bulk sample uses a fixed constant (#define) for this: 4 * 64 (BULKUSB_MAX_TRANSFER_SIZE) as the segment length.
( b ) How was this value picked (given that 64 is the max packet size for USB 1.1 bulk transfers)?
Does this have anything to do with some sort of buffer size in the USB device? If so, typically what would this be?
The reason I ask this is because I have a USB 1.1 bulk in and bulk out endpoints and I want to make sure I maximize throughput by adjusting the parameters correctly. I hope that some of you have already gone down this path before and have words of wisdom of what these values should be, before I start experimenting.
thanks