USB - Enable Multi-Packet Rx and Tx - #1009
Merged
Merged
Conversation
Merged
rnd-ash
added a commit
to rnd-ash/atsamd
that referenced
this pull request
Jul 3, 2026
* Add 16KB buffer for USB option (1024 bytes per EP)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
As an improvement to #963, this PR fully enables the USB Peripheral's Multi-Packet Tx/Rx feature.
This allows for a speed up of mainly Bulk-Transfers (Getting approx 900KBps with a 64 packet size and 512 byte Endpoint buffer size - Up from 600KBps), whilst reducing the number of CPU interrupts from 13,000/sec to 1000/sec.
Tx Multi-Packet support is automatically enabled should the outgoing data size be greater than the USB Packet size.
Rx Multi-Packet support has to be manually enabled per endpoint with the new UsbBus's
configure_out_endpoint_multipacket_rxfunction. This is in order to keep default behaviour where any amount of data in an Rx Endpoint triggers a interrupt.Since endpoint allocation size is now calculated at compile time (Since #963), I have removed some logic that calculates this at runtime, since it is no longer required.
There is also a new
usb-buffer-16kfeature flag to the crate. This is for completion, allowing for up to a 1024 byte endpoint buffer.