-
Notifications
You must be signed in to change notification settings - Fork 2
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 usb audio example #12
Conversation
If you are testing this, my own implementation is for STM32H723: https://github.com/blus-audio/firmware-rs It requires this, though: embassy-rs/stm32-data#511 |
Thanks for your answer.
Do you have any ideas what this error means? |
That looks exactly like what I was doing. It seems to not find that vector table section in your linker file, but I don't know why that would be the case. Is it building for the right target (arm)? You don't have to use my An unrelated thing in your |
It is for the right target, I think, If I do comment out specifying local metapac and comment in as embassy do in
then it is buildable... But anyway, I'll try the "good first step" later! |
If i remember correctly, I had to change the metapac in two places in the Good luck! |
OK, now my Windows recognizes the device as a "speaker"! |
current status: It is now possible to receive audio from the host and output what appears to be that audio through the SAI. But as expected, it does not works well, because audio buffer from USB is exhausted while SAI is running, which makes short "glitches" to the output audio(if I understand correctly). I'll check if the passing audio buffer from USB task to audio receiver really works (I'll check the detail of |
Not sure about the build issue, because I am not using a workspace. Regarding the glitches, that is expected without active feedback, because the rates of receiving and consuming don't match. For transferring data between the USB streaming task and the SAI task, I had good results with a zerocopy-channel. You will find that in the blus-audio firmware, or in the example that I wrote for embassy (STM32F4). |
…e to misconfiguration of the local embassy)
It turns out that |
There are still glitches in output audio from SAI. I found I checked TIM2 interrupt and control task is working(by adding |
That is strange. Are you on Windows or Linux? If the latter, can you show You may also look at Regarding the audio block length, I don't quite understand. You will get blocks of (around) 1 ms of stereo samples at 48 kHz, which is 48 (stereo) samples per ms -> 384 byte. You may get even more samples than that when the feedback mechanism indicates a consumption rate above 48 kHz. So, you should probably allow for a bigger audio block length. Then, you are only allowing for a timeout of 500 micro seconds for receiving samples in the |
Thanks for your feedback! Sorry, I missed some logs from debug probe. I'm using Windows. lsusb -d 0xdead:0xbeef -v
dmesg | grep usb(and omit some unrelevant messages)
BTW, the |
And about audio callback, sorry I didn't clearly say I'm suspicious about my current settings(that's why I wrote it). |
In relation to other committers' PRs, I will close this PR for now, but I plan to open a new issue and reopen it at a later time. |
@Dicklessgreat I didn't see your high-speed vs. full-speed question. This is only expected to work correctly with full-speed USB, as UAC 1.0 is specified for USB 1.0/1.1. In fact, I use my HS phy in FS mode. |
I didn't know that's possible! And I missed it's in FS mode.
Never mind! Just I wondered if it really works on my device!
And do you have any ideas about this? |
It is, as of recently 😄: embassy-rs/embassy#3281
Are you sure it's stuck there and not waiting for the signal? I don't know why it would get stuck, except if the host doesn't poll the endpoint. I will test on Windows again. |
from embassy-rs/embassy#3212
and
https://github.com/elagil/embassy/blob/feat_usb_prepare_for_uac/examples/stm32f4/src/bin/usb_uac_speaker.rs
changes from STM32F4 example:
hal::Config
todaisy_embassy::default_rcc()
not yet works, just quick trying it out for a bit.