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

Add ISO endpoint support #3314

Merged
merged 3 commits into from
Sep 16, 2024
Merged

Conversation

elagil
Copy link
Contributor

@elagil elagil commented Sep 5, 2024

Adds support for ISO endpoints for both the STM32 OTG USB driver and the "regular" (newer?) USB driver.

@elagil
Copy link
Contributor Author

elagil commented Sep 6, 2024

For anyone who is reviewing this, find the USB packet buffer layouts that I used. They are relevant for the functions that read/write from/to the btable. The values in the btable are the addresses of the software packet buffers, and the received/transmitted buffer sizes.

For double-buffered endpoints, both RX and TX count and address fields are used for THE SAME direction (either RX or TX, never both). I hope that is clear from the comments in the code as well.

From RM0481 (STM32H5), where #[cfg(any(usbram_32_2048, usbram_32_1024))]
image

From RM0091 (STM32F0x1), where #[cfg(not(any(usbram_32_2048, usbram_32_1024)))]
image

@M3gaFr3ak
Copy link

This is a very important PR to make embassy usable for any audio-related USB stuff. I'm currently implementing USB Audio 2.0 and thanks to this PR, I have a successfully enumerating and streaming device!
When I'm finished, I'll try to PR an example.

@elagil
Copy link
Contributor Author

elagil commented Sep 16, 2024

@M3gaFr3ak I agree, that is what I needed it for. Very curious to see your UAC 2.0 implementation! I made UAC 1.0 in #3212, but would rather use 2.0 for USB high speed.

Copy link
Member

@Dirbaio Dirbaio 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! looking great

@Dirbaio Dirbaio added this pull request to the merge queue Sep 16, 2024
@M3gaFr3ak
Copy link

M3gaFr3ak commented Sep 16, 2024

@elagil This is the test implementation I'm currently doing: https://github.com/M3gaFr3ak/rp-usb-uac2
It's only using full speed, but that's enough for demoing. I don't actually do proper handling, it currently enumerates and the endpoints receive data. I've also modified embassy-usb to allow reuse of endpoints #2994 (I will still have to implement reconfiguration of endpoints, currently it just reuses them and doesnt change their buffer size etc).
I'll continue working on this until i have a loopback device working (speaker to mic)

Update:
My testimplementation is already working (echo device) in the test_old_embassy branch. Currently working on the endpoint-reuse.

Merged via the queue into embassy-rs:main with commit ae8caf3 Sep 16, 2024
6 checks passed
@elagil elagil deleted the add_iso_endpoint_support branch September 16, 2024 20:20
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.

3 participants