Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow more endpoint packet sizes for SAMD #1523

Merged
merged 1 commit into from Oct 19, 2022

Conversation

maddyaby
Copy link
Contributor

Tested on SAMD51 in an audio application with ISO OUT endpoint - we can allow more packet sizes by checking that the set size value is greater than the requested packet size instead of exactly the same.

Tested on SAMD51 - we can allow more packet sizes by checking that the set size value is greater than the requested packet size instead of exactly the same.
@pigrew
Copy link
Collaborator

pigrew commented Jun 30, 2022

I see that a == was changed to >=. I'm not so familiar with SAMD, but I figure this could cause issues with INT IN endpoints:

  1. Class defines INT IN endpoint with wMaxPacketSize=10
  2. Driver sets hardware to use wMaxPacketSize=16
  3. Class starts transfer of 25 bytes.
  4. Peripheral transmits packet of size 10 which would confuse the host since it expects a max packet size of 10 bytes.

Copy link
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for the PR and sorry for late response. I have been too busy with other works.

@hathach
Copy link
Owner

hathach commented Oct 19, 2022

I see that a == was changed to >=. I'm not so familiar with SAMD, but I figure this could cause issues with INT IN endpoints:

  1. Class defines INT IN endpoint with wMaxPacketSize=10
  2. Driver sets hardware to use wMaxPacketSize=16
  3. Class starts transfer of 25 bytes.
  4. Peripheral transmits packet of size 10 which would confuse the host since it expects a max packet size of 10 bytes.

Thank you @pigrew for reviewing, this is SAMD port specific. SAMD endppoint can only have endpoint with power of two size i.e 8/16/.../512/1023. Therefore normally application on SAMD must take this into account and must define endpoint size accordingly. The use case here is for ISO endpoint which will have arbitrary depending on constant data rate e.g audio with 44.1 Mhz may have endpoint of 131 bytes while 48Mh would be 150 bytes. Normally ISO endpoint will only send 1 packet per constant interval, which is handle by audio driver, which make sure that it send data at constant rate. Of course for other use-case such as HID, SAMD user should only stick with power of two size. Hopefully this explanation make sense to you.

image

@hathach hathach merged commit 2cd4e27 into hathach:master Oct 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants