-
Notifications
You must be signed in to change notification settings - Fork 745
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
feat(usb): Prepare embassy-usb
for USB Audio, and add USB Audio Class 1.0 (playback only)
#3212
base: main
Are you sure you want to change the base?
Conversation
Awesome! Do you have a basic usage example to include? |
Thanks! I just fixed formatting. I could add an example for the STM32H7, because I can test that. However, such an example would still be a bit useless without explicit feedback. There will be jumps in the audio due to the rate discrepancies of SAI output and USB input. Measuring the value that has to be provided over the feedback endpoint is hardware dependent. I will try to make something useful. |
I guess I have to do this first, in order to create an example: embassy-rs/stm32-data#509 Maybe some details for the reasoning: |
a66f3fc
to
b4292b7
Compare
embassy-usb
for USB Audioembassy-usb
for USB Audio, and add USB Audio Class 1.0 (playback only)
1190b76
to
42905b2
Compare
42905b2
to
ea748d5
Compare
This should now be ready for review. You can go through the commits one-by-one:
The class is meant to be extended by more "applications" in the future. I implemented only a "speaker" application, where the device receives audio from the host. It has the following features:
Disclaimer: I did not test the example on the STM32F4 platform, because I don't have that hardware. I only tested on my STM32H723, which does not exist as an example platform, and I feel like it makes more sense to use the more common F4. Can someone please test it? For example, print the measured feedback value (in the |
2d75f14
to
90e7292
Compare
90e7292
to
14de351
Compare
ISO endpoint support itself in the USB drivers was split off to #3314. Therefore, this depends on the other PR and does not build without it. |
14de351
to
29de089
Compare
Hello,
I implemented a UAC 1.0 device, but this required some extensions and fixes to the implementation of
embassy-usb
.Some changes are taken from or inspired by #2736.
Here is an example of where this is in use (still rough): https://github.com/blus-audio/firmware-rs
The feedback endpoint is not yet in use.
Features:
extra_fields
that can be appended to an endpoint descriptor. This is required for UAC (e.g.bRefresh
andbSynchAddress
fields for UAC1.0)synch
endpoint must follow the audio streaming endpoint, but the descriptor of the latter must contain the endpoint index of the former. So I allocate the endpoints first, then write the descriptors with the information about the endpoints. Find an implementation of that approach here: https://github.com/blus-audio/firmware-rs/blob/main/firmware/src/uac1/mod.rs#L223Fixes: