cancel
Showing results for 
Search instead for 
Did you mean: 

USBX mic streaming on WBA65

hugomendiondo
Visitor

Hello ST Community,

I'm working on implementing USB Audio Class 2.0 with both speaker and microphone functionality on STM32WBA65 using USBX middleware.

Request for Example: Are there any complete working examples of USBX Audio Class 2.0 with microphone streaming (USB Audio input) for STM32WBA series? The existing examples I've found only demonstrate speaker/playback functionality.

Current Issue: 

I have implemented a USB Audio Class 2.0 device configured for both speaker and microphone, but only the speaker is working.

The device descriptor is correctly recognized by Windows 11:

  • Both speaker and microphone appear in Windows audio devices
  • Speaker functionality works correctly (playback stream activates when selected)
  • No Windows system crashes or USB enumeration issues

Problem: The microphone stream never initializes. Specifically:

  • USBD_AUDIO_PlaybackStreamChange() is called when Windows selects the speaker
  • USBD_AUDIO_RecordStreamChange() is never called, even when:
    • Selecting the device as default microphone in Windows
    • Opening recording applications (Voice Recorder, etc.)
    • Manually trying to access the microphone

Configuration:

  • USBD_AUDIO_STREAM_NMNBER = 2
  • Stream 0: Playback (working)
  • Stream 1: Record (configured but never activated)
  • Both streams return success in ux_device_class_audio_stream_get()
  • USBD_AUDIO_Activate() is called successfully

This suggests the USB descriptor is being accepted by Windows, but something prevents the microphone stream from being activated by the host.

Has anyone encountered this issue? Any insights on what might cause Windows to recognize but not activate a USB Audio input stream?

This is the descriptor read by USB descriptor dumper:

Information for device STM32 AUDIO20 STREAMING-L (VID=0x0483 PID=0x5740):

------------------------------
Connection Information:
------------------------------
Device current bus speed: HighSpeed
Device supports USB 1.1 specification
Device supports USB 2.0 specification
Device address: 0x0022
Current configuration value: 0x01
Number of open pipes: 0


------------------------------
Device Descriptor:
------------------------------
0x12	bLength
0x01	bDescriptorType
0x0200	bcdUSB
0x00	bDeviceClass      
0x00	bDeviceSubClass   
0x00	bDeviceProtocol   
0x40	bMaxPacketSize0   (64 bytes)
0x0483	idVendor
0x5740	idProduct
0x0200	bcdDevice
0x01	iManufacturer   "STMicroelectronics"
0x02	iProduct        "STM32 AUDIO20 STREAMING-L"
0x03	iSerialNumber   "CDC_ACM_AUDIO_001_L"
0x01	bNumConfigurations

Device Qualifier Descriptor:
------------------------------
0x0A	bLength
0x06	bDescriptorType
0x0200	bcdUSB
0x00	bDeviceClass      
0x00	bDeviceSubClass   
0x00	bDeviceProtocol   
0x40	bMaxPacketSize0   (64 bytes)
0x01	bNumConfigurations 
0x00	bReserved 


-------------------------
Configuration Descriptor:
-------------------------
0x09	bLength
0x02	bDescriptorType
0x00FB	wTotalLength   (251 bytes)
0x03	bNumInterfaces
0x01	bConfigurationValue
0x00	iConfiguration
0xC0	bmAttributes   (Self-powered Device)
0x32	bMaxPower      (100 mA)

Interface Association Descriptor:
------------------------------
0x08	bLength
0x0B	bDescriptorType
0x00	bFirstInterface
0x03	bInterfaceCount
0x01	bFunctionClass      (Audio Device Class)
0x00	bFunctionSubClass   
0x20	bFunctionProtocol   (Audio Protocol IP version 2.00)
0x00	iFunction

Interface Descriptor:
------------------------------
0x09	bLength
0x04	bDescriptorType
0x00	bInterfaceNumber
0x00	bAlternateSetting
0x00	bNumEndPoints
0x01	bInterfaceClass      (Audio Device Class)
0x01	bInterfaceSubClass   (Audio Control Interface)
0x20	bInterfaceProtocol   (Audio Protocol IP version 2.00)
0x00	iInterface

AC Interface Header Descriptor:
------------------------------
0x09	bLength
0x24	bDescriptorType
0x01	bDescriptorSubtype
0x0200	bcdADC
0x03	bCategory   (MICROPHONE)
0x0073	wTotalLength   (115 bytes)
0x00	bmControls

AC Clock Source Descriptor:
------------------------------
0x08	bLength
0x24	bDescriptorType
0x0A	bDescriptorSubtype
0x18	bClockID
0x01	bmAttributes
0x01	bmControls
          Clock Frequency Control - read only
0x00	bAssocTerminal
0x00	iClockSource

AC Input Terminal Descriptor:
------------------------------
0x11	bLength
0x24	bDescriptorType
0x02	bDescriptorSubtype
0x12	bTerminalID
0x0101	wTerminalType   (USB Streaming)
0x00	bAssocTerminal
0x18	bCSourceID
0x02	bNrChannels   (2 channels)
0x00000003	bmChannelConfig
0x00	iChannelNames
0x00	bmControls
0x00	iTerminal

AC Feature Unit Descriptor:
------------------------------
0x12	bLength
0x24	bDescriptorType
0x06	bDescriptorSubtype
0x16	bUnitID
0x12	bSourceID
0x0000000F	bmaControls(0)
          Mute Control              - host programmable
          Volume Control            - host programmable
0x00000000	bmaControls(1)
0x00000000	bmaControls(2)
0x00	iFeature

AC Output Terminal Descriptor:
------------------------------
0x0C	bLength
0x24	bDescriptorType
0x03	bDescriptorSubtype
0x14	bTerminalID
0x0301	wTerminalType   (Speaker)
0x00	bAssocTerminal
0x16	bSourceID
0x18	bCSourceID
0x0000	bmControls
0x00	iTerminal

AC Clock Source Descriptor:
------------------------------
0x08	bLength
0x24	bDescriptorType
0x0A	bDescriptorSubtype
0x19	bClockID
0x01	bmAttributes
0x01	bmControls
          Clock Frequency Control - read only
0x00	bAssocTerminal
0x00	iClockSource

AC Input Terminal Descriptor:
------------------------------
0x11	bLength
0x24	bDescriptorType
0x02	bDescriptorSubtype
0x20	bTerminalID
0x0201	wTerminalType   (Microphone)
0x00	bAssocTerminal
0x19	bCSourceID
0x01	bNrChannels   (1 channels)
0x00000001	bmChannelConfig
0x00	iChannelNames
0x00	bmControls
0x00	iTerminal

AC Feature Unit Descriptor:
------------------------------
0x0E	bLength
0x24	bDescriptorType
0x06	bDescriptorSubtype
0x22	bUnitID
0x20	bSourceID
0x0000000F	bmaControls(0)
          Mute Control              - host programmable
          Volume Control            - host programmable
0x00000000	bmaControls(1)
0x00	iFeature

AC Output Terminal Descriptor:
------------------------------
0x0C	bLength
0x24	bDescriptorType
0x03	bDescriptorSubtype
0x24	bTerminalID
0x0101	wTerminalType   (USB Streaming)
0x00	bAssocTerminal
0x22	bSourceID
0x19	bCSourceID
0x0000	bmControls
0x00	iTerminal

Interface Descriptor:
------------------------------
0x09	bLength
0x04	bDescriptorType
0x01	bInterfaceNumber
0x00	bAlternateSetting
0x00	bNumEndPoints
0x01	bInterfaceClass      (Audio Device Class)
0x02	bInterfaceSubClass   (Audio Streaming Interface)
0x20	bInterfaceProtocol   (Audio Protocol IP version 2.00)
0x00	iInterface

Interface Descriptor:
------------------------------
0x09	bLength
0x04	bDescriptorType
0x01	bInterfaceNumber
0x01	bAlternateSetting
0x01	bNumEndPoints
0x01	bInterfaceClass      (Audio Device Class)
0x02	bInterfaceSubClass   (Audio Streaming Interface)
0x20	bInterfaceProtocol   (Audio Protocol IP version 2.00)
0x00	iInterface

AS Interface Descriptor:
------------------------------
0x10	bLength
0x24	bDescriptorType
0x01	bDescriptorSubtype
0x12	bTerminalLink
0x00	bmControls
0x01	bFormatType   (FORMAT_TYPE_1)
0x00000001	bmFormats
          PCM
0x02	bNrChannels   (2 channels)
0x00000003	bmChannelConfig
0x00	iChannelNames

AS Format Type 1 Descriptor:
------------------------------
0x06	bLength
0x24	bDescriptorType
0x02	bDescriptorSubtype
0x01	bFormatType   (FORMAT_TYPE_1)
0x02	bSubslotSize
0x10	bBitResolution   (16 bits per sample)

Endpoint Descriptor:
------------------------------
0x07	bLength
0x05	bDescriptorType
0x03	bEndpointAddress  (OUT endpoint 3)
0x01	bmAttributes      (Transfer: Isochronous / Synch: None / Usage: Data)
0x001C	wMaxPacketSize    (1 x 28 bytes)
0x01	bInterval         (1 microframes)

AS Isochronous Data Endpoint Descriptor:
------------------------------
0x08	bLength
0x25	bDescriptorType
0x01	bDescriptorSubtype
0x00	bmAttributes
0x00	bmControls
0x00	bLockDelayUnits   (undefined)
0x0000	wLockDelay

Interface Descriptor:
------------------------------
0x09	bLength
0x04	bDescriptorType
0x02	bInterfaceNumber
0x00	bAlternateSetting
0x00	bNumEndPoints
0x01	bInterfaceClass      (Audio Device Class)
0x02	bInterfaceSubClass   (Audio Streaming Interface)
0x20	bInterfaceProtocol   (Audio Protocol IP version 2.00)
0x00	iInterface

Interface Descriptor:
------------------------------
0x09	bLength
0x04	bDescriptorType
0x02	bInterfaceNumber
0x01	bAlternateSetting
0x01	bNumEndPoints
0x01	bInterfaceClass      (Audio Device Class)
0x02	bInterfaceSubClass   (Audio Streaming Interface)
0x20	bInterfaceProtocol   (Audio Protocol IP version 2.00)
0x00	iInterface

AS Interface Descriptor:
------------------------------
0x10	bLength
0x24	bDescriptorType
0x01	bDescriptorSubtype
0x24	bTerminalLink
0x00	bmControls
0x01	bFormatType   (FORMAT_TYPE_1)
0x00000001	bmFormats
          PCM
0x01	bNrChannels   (1 channels)
0x00000001	bmChannelConfig
0x00	iChannelNames

AS Format Type 1 Descriptor:
------------------------------
0x06	bLength
0x24	bDescriptorType
0x02	bDescriptorSubtype
0x01	bFormatType   (FORMAT_TYPE_1)
0x02	bSubslotSize
0x10	bBitResolution   (16 bits per sample)

Endpoint Descriptor:
------------------------------
0x07	bLength
0x05	bDescriptorType
0x84	bEndpointAddress  (IN endpoint 4)
0x0D	bmAttributes      (Transfer: Isochronous / Synch: Synchronous / Usage: Data)
0x000C	wMaxPacketSize    (1 x 12 bytes)
0x01	bInterval         (1 microframes)

AS Isochronous Data Endpoint Descriptor:
------------------------------
0x08	bLength
0x25	bDescriptorType
0x01	bDescriptorSubtype
0x00	bmAttributes
0x00	bmControls
0x00	bLockDelayUnits   (undefined)
0x0000	wLockDelay


-------------------------------------
Other Speed Configuration Descriptor:
-------------------------------------
0x09	bLength
0x07	bDescriptorType
0x00FB	wTotalLength   (251 bytes)
0x03	bNumInterfaces
0x01	bConfigurationValue
0x00	iConfiguration
0xC0	bmAttributes   (Self-powered Device)
0x32	bMaxPower      (100 mA)

Interface Association Descriptor:
------------------------------
0x08	bLength
0x0B	bDescriptorType
0x00	bFirstInterface
0x03	bInterfaceCount
0x01	bFunctionClass      (Audio Device Class)
0x00	bFunctionSubClass   
0x20	bFunctionProtocol   (Audio Protocol IP version 2.00)
0x00	iFunction

Interface Descriptor:
------------------------------
0x09	bLength
0x04	bDescriptorType
0x00	bInterfaceNumber
0x00	bAlternateSetting
0x00	bNumEndPoints
0x01	bInterfaceClass      (Audio Device Class)
0x01	bInterfaceSubClass   (Audio Control Interface)
0x20	bInterfaceProtocol   (Audio Protocol IP version 2.00)
0x00	iInterface

AC Interface Header Descriptor:
------------------------------
0x09	bLength
0x24	bDescriptorType
0x01	bDescriptorSubtype
0x0200	bcdADC
0x03	bCategory   (MICROPHONE)
0x0073	wTotalLength   (115 bytes)
0x00	bmControls

AC Clock Source Descriptor:
------------------------------
0x08	bLength
0x24	bDescriptorType
0x0A	bDescriptorSubtype
0x18	bClockID
0x01	bmAttributes
0x01	bmControls
          Clock Frequency Control - read only
0x00	bAssocTerminal
0x00	iClockSource

AC Input Terminal Descriptor:
------------------------------
0x11	bLength
0x24	bDescriptorType
0x02	bDescriptorSubtype
0x12	bTerminalID
0x0101	wTerminalType   (USB Streaming)
0x00	bAssocTerminal
0x18	bCSourceID
0x02	bNrChannels   (2 channels)
0x00000003	bmChannelConfig
0x00	iChannelNames
0x00	bmControls
0x00	iTerminal

AC Feature Unit Descriptor:
------------------------------
0x12	bLength
0x24	bDescriptorType
0x06	bDescriptorSubtype
0x16	bUnitID
0x12	bSourceID
0x0000000F	bmaControls(0)
          Mute Control              - host programmable
          Volume Control            - host programmable
0x00000000	bmaControls(1)
0x00000000	bmaControls(2)
0x00	iFeature

AC Output Terminal Descriptor:
------------------------------
0x0C	bLength
0x24	bDescriptorType
0x03	bDescriptorSubtype
0x14	bTerminalID
0x0301	wTerminalType   (Speaker)
0x00	bAssocTerminal
0x16	bSourceID
0x18	bCSourceID
0x0000	bmControls
0x00	iTerminal

AC Clock Source Descriptor:
------------------------------
0x08	bLength
0x24	bDescriptorType
0x0A	bDescriptorSubtype
0x19	bClockID
0x01	bmAttributes
0x01	bmControls
          Clock Frequency Control - read only
0x00	bAssocTerminal
0x00	iClockSource

AC Input Terminal Descriptor:
------------------------------
0x11	bLength
0x24	bDescriptorType
0x02	bDescriptorSubtype
0x20	bTerminalID
0x0201	wTerminalType   (Microphone)
0x00	bAssocTerminal
0x19	bCSourceID
0x01	bNrChannels   (1 channels)
0x00000001	bmChannelConfig
0x00	iChannelNames
0x00	bmControls
0x00	iTerminal

AC Feature Unit Descriptor:
------------------------------
0x0E	bLength
0x24	bDescriptorType
0x06	bDescriptorSubtype
0x22	bUnitID
0x20	bSourceID
0x0000000F	bmaControls(0)
          Mute Control              - host programmable
          Volume Control            - host programmable
0x00000000	bmaControls(1)
0x00	iFeature

AC Output Terminal Descriptor:
------------------------------
0x0C	bLength
0x24	bDescriptorType
0x03	bDescriptorSubtype
0x24	bTerminalID
0x0101	wTerminalType   (USB Streaming)
0x00	bAssocTerminal
0x22	bSourceID
0x19	bCSourceID
0x0000	bmControls
0x00	iTerminal

Interface Descriptor:
------------------------------
0x09	bLength
0x04	bDescriptorType
0x01	bInterfaceNumber
0x00	bAlternateSetting
0x00	bNumEndPoints
0x01	bInterfaceClass      (Audio Device Class)
0x02	bInterfaceSubClass   (Audio Streaming Interface)
0x20	bInterfaceProtocol   (Audio Protocol IP version 2.00)
0x00	iInterface

Interface Descriptor:
------------------------------
0x09	bLength
0x04	bDescriptorType
0x01	bInterfaceNumber
0x01	bAlternateSetting
0x01	bNumEndPoints
0x01	bInterfaceClass      (Audio Device Class)
0x02	bInterfaceSubClass   (Audio Streaming Interface)
0x20	bInterfaceProtocol   (Audio Protocol IP version 2.00)
0x00	iInterface

AS Interface Descriptor:
------------------------------
0x10	bLength
0x24	bDescriptorType
0x01	bDescriptorSubtype
0x12	bTerminalLink
0x00	bmControls
0x01	bFormatType   (FORMAT_TYPE_1)
0x00000001	bmFormats
          PCM
0x02	bNrChannels   (2 channels)
0x00000003	bmChannelConfig
0x00	iChannelNames

AS Format Type 1 Descriptor:
------------------------------
0x06	bLength
0x24	bDescriptorType
0x02	bDescriptorSubtype
0x01	bFormatType   (FORMAT_TYPE_1)
0x02	bSubslotSize
0x10	bBitResolution   (16 bits per sample)

Endpoint Descriptor:
------------------------------
0x07	bLength
0x05	bDescriptorType
0x03	bEndpointAddress  (OUT endpoint 3)
0x01	bmAttributes      (Transfer: Isochronous / Synch: None / Usage: Data)
0x00C4	wMaxPacketSize    (1 x 196 bytes)
0x01	bInterval         (1 frames)

AS Isochronous Data Endpoint Descriptor:
------------------------------
0x08	bLength
0x25	bDescriptorType
0x01	bDescriptorSubtype
0x00	bmAttributes
0x00	bmControls
0x00	bLockDelayUnits   (undefined)
0x0000	wLockDelay

Interface Descriptor:
------------------------------
0x09	bLength
0x04	bDescriptorType
0x02	bInterfaceNumber
0x00	bAlternateSetting
0x00	bNumEndPoints
0x01	bInterfaceClass      (Audio Device Class)
0x02	bInterfaceSubClass   (Audio Streaming Interface)
0x20	bInterfaceProtocol   (Audio Protocol IP version 2.00)
0x00	iInterface

Interface Descriptor:
------------------------------
0x09	bLength
0x04	bDescriptorType
0x02	bInterfaceNumber
0x01	bAlternateSetting
0x01	bNumEndPoints
0x01	bInterfaceClass      (Audio Device Class)
0x02	bInterfaceSubClass   (Audio Streaming Interface)
0x20	bInterfaceProtocol   (Audio Protocol IP version 2.00)
0x00	iInterface

AS Interface Descriptor:
------------------------------
0x10	bLength
0x24	bDescriptorType
0x01	bDescriptorSubtype
0x24	bTerminalLink
0x00	bmControls
0x01	bFormatType   (FORMAT_TYPE_1)
0x00000001	bmFormats
          PCM
0x01	bNrChannels   (1 channels)
0x00000001	bmChannelConfig
0x00	iChannelNames

AS Format Type 1 Descriptor:
------------------------------
0x06	bLength
0x24	bDescriptorType
0x02	bDescriptorSubtype
0x01	bFormatType   (FORMAT_TYPE_1)
0x02	bSubslotSize
0x10	bBitResolution   (16 bits per sample)

Endpoint Descriptor:
------------------------------
0x07	bLength
0x05	bDescriptorType
0x84	bEndpointAddress  (IN endpoint 4)
0x0D	bmAttributes      (Transfer: Isochronous / Synch: Synchronous / Usage: Data)
0x0060	wMaxPacketSize    (1 x 96 bytes)
0x01	bInterval         (1 frames)

AS Isochronous Data Endpoint Descriptor:
------------------------------
0x08	bLength
0x25	bDescriptorType
0x01	bDescriptorSubtype
0x00	bmAttributes
0x00	bmControls
0x00	bLockDelayUnits   (undefined)
0x0000	wLockDelay

Microsoft OS Descriptor is not available. Error code: 0x0000001F


--------------------------------
String Descriptor Table
--------------------------------
Index  LANGID  String
0x00   0x0000  0x0409 
0x01   0x0409  "STMicroelectronics"
0x02   0x0409  "STM32 AUDIO20 STREAMING-L"
0x03   0x0409  "CDC_ACM_AUDIO_001_L"

------------------------------

Connection path for device: 
Controladora de host USB genérico compatible con xHCI
Root Hub
Concentrador USB genérico
STM32 AUDIO20 STREAMING-L (VID=0x0483 PID=0x5740) Port: 2

Running on: Windows 10 or greater (Build Version 19045)

Brought to you by TDD v2.19.0, Dec  5 2023, 12:08:38

 

Thanks in advance for any help!

0 REPLIES 0