I've been playing around with USB speed, burst packets etc. Perhaps someone can help me understand dma buffers better and see if I have the following understood well:
1) dma buffer should be a multiple of endpoint buffer size. So lets say you have a dma buffer that is 2x the endpoint size. 2 usb packets are committed and you get one dma buffer callback with the data.
- What would happen if the buffer wasn't a multiple? Problem?
- Do number of USB buffers further affect performance much? I haven't spend much time modifying that variable.
2) burst packets allow lots more usb packets to be committed on the host side before waiting. Easy to very with speed tests.
So now with those two ideas in place, I've noticed a lot of the firmware examples use both burst packets and a 2x size multiplier. Is this just taking the concept further and allowing 2 host bursts before having to consume cpu time to handle the data?
In my testing I haven't seen much difference when burst packets were used with or without the size multiplier. Further, I haven't seen much difference with or without the size multiplier when not using burst packets. It seems to me only burst packets have made a large difference in performance.
So... am I missing something with the size multiplier?
When I use a size multiplier and I send just one usb packet that is the size of the usb buffer, I have to then send a ZLP or the dma buffer doesn't get committed. Seems I don't need that quirk in the driver without the size multiplier. Any other issues either way?
In long run, having the buffer sizes to be a multiple of USB Packets have seem to give better results, as there is better synchronization in DMA Processing and Transfer of data. We recommend you to have the Buffer Size and Count as big as possible.
- Madhu Sudhan