OSX UAC2 Feedback weirdness #2978
-
|
I am working on a UAC2 audio device with an explicit feedback endpoint. I am using the QUIRK_OS_GUESSING with the alternate feedback format for OSX. It works very reliably on Windows, however on OSX I am noticing the FIFO size oscillating about once every second or so. This is an rp2350 device, full speed. Does anyone have any inkling on what may be causing this? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
|
Honestly it's a pain to make OS X happy with UAC, apart from feedback format correction and OS guessing. OS X's feedback rate adjustment is slower than Windows/Linux and somehow has a 2nd order response, so when the feedback variation is too big it becomes unstable. Is anything change if you use sample rate multiples of 48k (or vice versa) ? Otherwise rate_const need to be lowered: tinyusb/src/class/audio/audio_device.c Line 1989 in 2a3025e |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the reply! So I mentioned this on another discussion thread regarding board support. I possibly need to report my custom clock setup to tinyusb? After more testing, a stock pico2 running the stock uac2_playback_fb works perfectly. A stock pico2 running a different clock oscillator (we are running 12.288mhz instead of 12mhz for i2s reasons), has issues. I'm adding all the correct directives so that the pico-sdk reports the correct clock speed and the PLL is adjusted so the USB peripheral runs at the correct rate (48mhz). For some reason this is messing with the feedback behavior but only on OSX. |
Beta Was this translation helpful? Give feedback.
-
|
Sorry I don't play with raspberry MCUs so I don't have precise suggestions.
I assume you are playing with stock example without I2S implemented yet ? In the example audio sample consumption speed is determined by If you clock I2S at 12.288MHz and read sample using I2S clock I hope the feedback will be stable. |
Beta Was this translation helpful? Give feedback.
-
|
Alright, problem solved. 1.) We noticed that the averaging filter/HPF filter in audiod_fb_fifo_count_update() was possibly causing a phase shift that interacted with the OSX's 2nd order behavior. We started by lowering the number of averages, and eventually removing it completely. This caused the FIFO to stabilize fairly quickly with seemingly no ill effects on either OSX or Windows. 2.) As you suggested, lowering the rate (P-gain) significantly stabilized the behavior on both OSX and Windows. I just shifted it right one bit. Initial testing is showing a much more stable feedback control now. Here's the modified audiod_fb_fifo_count_update() function I ended up with: I can put together a proper PR next week if you'd like and I'm curious of your thoughts. Thanks again for your help on this. |
Beta Was this translation helpful? Give feedback.

Alright, problem solved.
1.) We noticed that the averaging filter/HPF filter in audiod_fb_fifo_count_update() was possibly causing a phase shift that interacted with the OSX's 2nd order behavior. We started by lowering the number of averages, and eventually removing it completely. This caused the FIFO to stabilize fairly quickly with seemingly no ill effects on either OSX or Windows.
2.) As you suggested, lowering the rate (P-gain) significantly stabilized the behavior on both OSX and Windows. I just shifted it right one bit. Initial testing is showing a much more stable feedback control now.
Here's the modified audiod_fb_fifo_count_update() function I ended up with: