Page 1 of 1

USB Audio ref design: bits per sample

Posted: Mon Nov 28, 2011 11:18 pm
by pmillett
I apologize in advance if this is obvious, as I'm working a little out of my element here :roll:

I've been digging through the ref design code, trying to find some indication of how many bits per sample are being sent in the USB audio stream. I can see (for example) where the sample rate gets set... but nothing about bits/sample. It almost looks like the driver is always sending the same size packets, and I2S is always 32 bits/frame, so maybe the HW doesn't even need to know?

I'd like to know this so I can display the current sample rate and bits/sample (16 or 24) on a UI.

TIA,
Pete

Re: USB Audio ref design: bits per sample

Posted: Tue Nov 29, 2011 11:59 am
by Ross
pmillett wrote:I apologize in advance if this is obvious, as I'm working a little out of my element here :roll:

I've been digging through the ref design code, trying to find some indication of how many bits per sample are being sent in the USB audio stream. I can see (for example) where the sample rate gets set... but nothing about bits/sample. It almost looks like the driver is always sending the same size packets, and I2S is always 32 bits/frame, so maybe the HW doesn't even need to know?

I'd like to know this so I can display the current sample rate and bits/sample (16 or 24) on a UI.

TIA,
Pete
In the default reference design the number of bits transmitted to/from the device is 32bits. This is made up of 24 bits of sample and 8-bits of zero padding (See bBitResolution and bSlotSize in the device descriptors/USB Audio Class specification). If a 16 bit file is being played the host will zero-pad.

Re: USB Audio ref design: bits per sample

Posted: Tue Nov 29, 2011 4:38 pm
by pmillett
Ross wrote:
In the default reference design the number of bits transmitted to/from the device is 32bits. This is made up of 24 bits of sample and 8-bits of zero padding (See bBitResolution and bSlotSize in the device descriptors/USB Audio Class specification). If a 16 bit file is being played the host will zero-pad.
Thanks Ross. So it seems only the host knows how many bits are really being used...

Pete