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
UAC2: Implement feedback by fifo counting. #2328
base: master
Are you sure you want to change the base?
Conversation
476a593
to
65225c0
Compare
Test welcomed @Protoxy22 @Lurcy38 @kf6gpe @PanRe |
Wow great work, I will have time to test this next week on an STM32H743 Eval Board with USB HS Thank you |
a48a5bd
to
db6b822
Compare
This is interesting. I'm curious where can I find audio_debug.py. Any ideas? Thanks a lot! |
Just in the PR examples/device/uac2_speaker_fb/src/audio_debug.py |
Ah, so not in main yet. Ok, thanks! |
great :) , I will be very happy to test this implementation in my app, but i cannot reach the branch rx_fb , how to do ? |
@Lurcy38 it's under my user space |
@hathach After more tests this PR is ready. |
Hi, what is the status of this PR? what is missing for it to be approved? |
Hi, great work, Could this be due to the fact that macOS does not accept this feedback method or some other reason such as incorrect descriptors for the MAC? Thanks! |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Back from holiday...
No it's not how it works... |
@Marcus2060 What do you mean crash, does the kernel panic or having popping sound or something else ? You can try to change tinyusb/src/class/audio/audio_device.h Line 196 in 2720392
From other people's experience it seems this format incompatibility issue exist.
I see there are 3 solutions:
|
Hi, I've done other experiments and I get the impression that the usbd_edpt_xfer() function on low-level stack doesn't work well when we try to send 3 bytes. MAC:
Windows:
Also: So, could the problem be on the low level of the Tinyusb stack when we try to send 3 bytes feedback via usbd_edpt_xfer() to Host ??? Thanks! |
No it can't be, you also tested 3 bytes works on MAC.
It's true.
Pico use UAC 1.0 while TUSB uses UAC 2.0, you can see their descriptors are quite different. |
Hi,
No, my previous comment is precisely because I tested that the 3 bytes don't seem to work (see my pont 1, 2 about MAC):
I highlighted the 3 bytes sent problem because: Thanks anyway for your attention. |
Sorry I've some problem understanding, you mean |
Below 4 different tests on MAC using 10.14 format:
Below the function to send feedback (feedback value is an uint32_t) : |
I agree it seems strange but I don't see any issue in TUSB side (maybe something wrong in RP2040 porting ?), could you use Wireshark USB capture to see what happened ? |
Hi,
Thanks again for your attention. |
@Marcus2060 I come back to this.
No the stack works (tries to) the same way across all OSes, the issue is some OS doesn't respect the UAC specification as I mentioned earlier.
Unfortunately the descriptor difference is pretty large, some major changes are needed. To be honest I don't see a hassle-free way to make it work across all OSes, Windows can be detected as it ask for MS OS 2.0 descriptor, but it happens after the configuration descriptor where |
Testing this feature with ESP32-S3 has been very successful. The device plays sound without any noise, and the FIFO consistently maintains a stable intermediate level. |
Describe the PR
Finally I had time to integrate my feedback work into UAC2 class :)
Compared to other methods the only thing needed is add a callback to set sample rate, all calculations are done inside the class.
A new example
uac2_speaker_fb
has been added to show how the mechanism work with a stereo speaker. Both FS (STM32F429) and HS (LPC55S69) configs are tested and FIFO level is well maintained half filled.A HID debug interface can be enabled by setting
CFG_AUDIO_DEBUG=1
which export UAC class information and can be read byaudio_debug.py
.