Hi @EdwinHz,
Thanks very much for your reply.
As it happens, it was while working through AN13447 that I encountered this issue.
Following the approach taken in AN13447 I was able to add 32 bit support but when adding additional sample rate frequencies encountered the following results (note failure in UAC 2.0 case) :-
excerpt from usb_audio_descriptor.c: uint8_t g_UsbDeviceConfbDescriptorSubtypeigurationDescriptor[]
Class 1.0 audio descriptor (USB_DEVICE_CONFIG_AUDIO_CLASS_2_0 == 0U) - single sample rate supported :-
/* Audio Class Specific type I format INTERFACE Descriptor */
USB_AUDIO_STREAMING_TYPE_I_DESC_SIZE, /* bLength (11) */
USB_DESCRIPTOR_TYPE_AUDIO_CS_INTERFACE, /* bDescriptorType (CS_INTERFACE) */
USB_DESCRIPTOR_SUBTYPE_AUDIO_STREAMING_FORMAT_TYPE, /* bDescriptorSubtype: AUDIO STREAMING FORMAT TYPE */
USB_AUDIO_FORMAT_TYPE_I, /* bFormatType - Format Type: Type I */
AUDIO_FORMAT_CHANNELS, /* bNrChannels - Number of Channels: one channel */
AUDIO_FORMAT_SIZE, /* bSubFrameSize - SubFrame Size: one byte per audio subframe */
AUDIO_FORMAT_BITS, /* bBitResolution - Bit Resolution: 8 bits per sample */
0x01U, /* bSamFreqType - One sample frequency supported */
TSAMFREQ2BYTES(AUDIO_SAMPLING_RATE_KHZ * 1000), /* 3 bytes - 48 kHz */
lsusb -v reports :-
AudioStreaming Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 2
bSubframeSize 4
bBitResolution 32
bSamFreqType 1 Discrete
tSamFreq[ 0] 48000
Class 1.0 audio descriptor (USB_DEVICE_CONFIG_AUDIO_CLASS_2_0 == 0U) - two sample rates supported :-
/* Audio Class Specific type I format INTERFACE Descriptor */
USB_AUDIO_STREAMING_TYPE_I_DESC_SIZE + 3, /* bLength (14) */
USB_DESCRIPTOR_TYPE_AUDIO_CS_INTERFACE, /* bDescriptorType (CS_INTERFACE) */
USB_DESCRIPTOR_SUBTYPE_AUDIO_STREAMING_FORMAT_TYPE, /* bDescriptorSubtype: AUDIO STREAMING FORMAT TYPE */
USB_AUDIO_FORMAT_TYPE_I, /* bFormatType - Format Type: Type I */
AUDIO_FORMAT_CHANNELS, /* bNrChannels - Number of Channels: one channel */
AUDIO_FORMAT_SIZE, /* bSubFrameSize - SubFrame Size: one byte per audio subframe */
AUDIO_FORMAT_BITS, /* bBitResolution - Bit Resolution: 8 bits per sample */
0x02U, /* bSamFreqType - Two sample frequencies supported */
TSAMFREQ2BYTES(AUDIO_SAMPLING_RATE_KHZ * 1000), /* 3 bytes - 48 kHz */
TSAMFREQ2BYTES(72 * 1000), /* 3 bytes - 72 kHz */
lsbusb -v reports :-
AudioStreaming Interface Descriptor:
bLength 14
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 2
bSubframeSize 4
bBitResolution 32
bSamFreqType 2 Discrete
tSamFreq[ 0] 48000
tSamFreq[ 1] 72000
Class 2.0 audio descriptor (USB_DEVICE_CONFIG_AUDIO_CLASS_2_0 == 1U) - two sample rates supported :-
/* Audio Class Specific type I format INTERFACE Descriptor */
USB_AUDIO_STREAMING_TYPE_I_DESC_SIZE + 3, /* bLength (14) */
USB_DESCRIPTOR_TYPE_AUDIO_CS_INTERFACE, /* bDescriptorType (CS_INTERFACE) */
USB_DESCRIPTOR_SUBTYPE_AUDIO_STREAMING_FORMAT_TYPE, /* bDescriptorSubtype: AUDIO STREAMING FORMAT TYPE */
USB_AUDIO_FORMAT_TYPE_I, /* bFormatType - Format Type: Type I */
AUDIO_FORMAT_CHANNELS, /* bNrChannels - Number of Channels: one channel */
AUDIO_FORMAT_SIZE, /* bSubFrameSize - SubFrame Size: one byte per audio subframe */
AUDIO_FORMAT_BITS, /* bBitResolution - Bit Resolution: 8 bits per sample */
0x02U, /* bSamFreqType - Two sample frequencies supported */
TSAMFREQ2BYTES(AUDIO_SAMPLING_RATE_KHZ * 1000), /* 3 bytes - 48 kHz */
TSAMFREQ2BYTES(72 * 1000), /* 3 bytes - 72 kHz */
lsbusb -v reports :-
AudioStreaming Interface Descriptor:
bLength 13
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bSubslotSize 4
bBitResolution 32
junk at descriptor end: 02 80 bb 00 40 19 01
Various documentation including, USB Device Class Definition for Audio Devices - Release 2.0, state that in UAC2 the supported sample rates are requested by the host and provided by the device in the Minimum (MIN), Maximum (MAX), and Resolution (RES) format listed in my original question.
As stated initially, the following changes to audio_speaker.c did enable the host to determine the device supported 2 sample rates.
g_UsbDeviceAudioSpeaker.freqControlRange = {1U, 44100U, 48000U, 0U}, // gives 44.1 + 48
This looks to be on the right track for UAC 2 but more info is needed on how to properly utilise this interface.
Thanks and regards,
Paul.