MIN_FREQ and DEFAULT_FREQ Ignored in USB Audio

Discussions about USB Audio on XMOS devices
Post Reply
tbjr6
Member++
Posts: 16
Joined: Sun May 20, 2018 2:41 pm

MIN_FREQ and DEFAULT_FREQ Ignored in USB Audio

Post by tbjr6 »

Hi.

I am trying to do UAC2 to i2s, which is working fine for the most part. I have included the following in my customdefines.h:

Code: Select all

#define MAX_FREQ            (192000)
#define MIN_FREQ            (192000)
#define DEFAULT_FREQ        (192000)
The max frequency changes properly, but when I change the minimum frequency and default frequency nothing changes. I do want this card rate-locked to 192K, but it seems that no matter what I set the values to it comes up the same in Windows. I have also tried changing the device PID each compile just to make sure Windows wasn't reusing config data. This is a custom board based on the Multichannel audio reference design
Screenshot 2021-04-11 110942.jpg
Screenshot 2021-04-11 110942.jpg (22.17 KiB) Viewed 3082 times
Screenshot 2021-04-11 110942.jpg
Screenshot 2021-04-11 110942.jpg (22.17 KiB) Viewed 3082 times
It shows like this no matter what these values are set to


tbjr6
Member++
Posts: 16
Joined: Sun May 20, 2018 2:41 pm

Post by tbjr6 »

I take it no one has encountered this or is willing to test on their hardware
User avatar
Ross
XCore Expert
Posts: 962
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

Try removing the entries in the windows driver cache using https://www.nirsoft.net/utils/usb_devices_view.html

Edit, I just noticed you had tried changing the PID. I wonder if windows always wants to expose 48/44.1 audio device (it will rate convert from you 192kHz). This is not something I have tried personally - most customers what to support a range of sample frequencies.
tbjr6
Member++
Posts: 16
Joined: Sun May 20, 2018 2:41 pm

Post by tbjr6 »

I remember I tried digging through the code and I couldn't find any references to default or min frequency. Its almost as if those defines weren't implemented, but were put in for the future.
User avatar
Ross
XCore Expert
Posts: 962
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

tbjr6 wrote: Tue Nov 15, 2022 1:45 am I remember I tried digging through the code and I couldn't find any references to default or min frequency. Its almost as if those defines weren't implemented, but were put in for the future.
No, they are used.

For example, populating the list of sample-rates to report to the host on UAC2 mode:

Code: Select all

                                /* Just keep doubling for standard freqs >= 44.1/48kHz */
                                currentFreq44 = 44100;
                                currentFreq48 = 48000;
                                while(1)
                                {
                                    if((currentFreq44 <= maxFreq) && (currentFreq44 >= MIN_FREQ))
                                    {
                                        storeFreq((buffer, unsigned char[]), i, currentFreq44);
                                        num_freqs++;
                                        currentFreq44*=2;
                                    }
tbjr6
Member++
Posts: 16
Joined: Sun May 20, 2018 2:41 pm

Post by tbjr6 »

Where is this code found? I may be able to modify it to suit
User avatar
Ross
XCore Expert
Posts: 962
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

tbjr6 wrote: Tue Nov 15, 2022 1:21 pm Where is this code found? I may be able to modify it to suit
audiorequests.xc, but I'm pretty sure its doing the right thing... (for voice stuff we set MIN_FREQ down to 16kHz). Most likely a Windows oddity always exposing 44.1/48kHz.
tbjr6
Member++
Posts: 16
Joined: Sun May 20, 2018 2:41 pm

Post by tbjr6 »

Its possible. I'll have to look at the raw descriptor again and check which is making the change. Thanks for the help!
User avatar
Ross
XCore Expert
Posts: 962
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

tbjr6 wrote: Tue Nov 15, 2022 2:18 pm Its possible. I'll have to look at the raw descriptor again and check which is making the change. Thanks for the help!
The sample rate list is not in the descriptors (like in UAC v1.0) but in the response to a RANGE request to a Clock Source with the Control Selector CS_SAM_FREQ_CONTROL
Post Reply