AnsweredAssumed Answered

Issues with MIMXRT1060-EVK and usb_device_audio_generator example...

Question asked by Ed Sutter on Apr 29, 2020
Latest reply on May 7, 2020 by Ed Sutter

Hi,

I've been using an MIMXRT1060-EVK for a month or so now just getting comfortable with the processor and features.  Now I'm getting more application specific (my project is usb audio), so I'm headed down the USB rabbit hole.

I install and run the usb_device_audio_generator example, and while it does work, I see what seems to be some strange output from "lsusb" on Linux (I'm using a raspberry pi4 at the moment)...

Here's what I do...

1. First I run "arecord -l" on my Linux host to see/verify no audio devices:

pi@homepi401: arecord -l
**** List of CAPTURE Hardware Devices ****

2. Run the usb_device_audio_generator application on my MIMXRT1060-EVK.

3. Plug the EVK into my host, and run "arecord -l" again and now see the device:

pi@homepi401:arecord -l
**** List of CAPTURE Hardware Devices ****
card 2: DEMO [USB AUDIO DEMO], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

At this point I can run an alsa program I wrote that will pull the stream out of the device and play it out a USB speaker (another USB device on that Linux box).  The audio is strange, so I built my own stream and inserted it into the example just to make sure I was streaming something real.  I had to create audio in 8-bit samples and 8kHz sampling rate, but ignoring that, things worked ok... I could hear the audio I created (I updated the wavData[] array in audio_data.c) coming out of the EVK.  

Next step is to decipher the descriptors.  Being new to USB at this level, this is apparently not a trivial task.  I use the "lsusb" tool on Linux to read them out, and this is where my confusion starts...

The first few lines of the response from "lsusb --verbose -d1fc9:0097" are:

Bus 001 Device 019: ID 1fc9:0097 NXP Semiconductors
Couldn't open device, some information will be missing

 and after that is what appears to be the full descriptor tree for the usb_device_audio_generator example: 

 

pi@homepi401:lsusb --verbose -d1fc9:0097

Bus 001 Device 022: ID 1fc9:0097 NXP Semiconductors
Couldn't open device, some information will be missing
Device Descriptor:
   bLength 18
   bDescriptorType 1
   bcdUSB 2.00
   bDeviceClass 0
   bDeviceSubClass 0
   bDeviceProtocol 0
   bMaxPacketSize0 64
   idVendor 0x1fc9 NXP Semiconductors
   idProduct 0x0097
   bcdDevice 1.01
   iManufacturer 1
   iProduct 2
   iSerial 0
   bNumConfigurations 1
   Configuration Descriptor:
      bLength 9
      bDescriptorType 2
      wTotalLength 0x0076
      bNumInterfaces 2
      bConfigurationValue 1
      iConfiguration 0
      bmAttributes 0xc0
         Self Powered
      MaxPower 100mA
      Interface Descriptor:
         bLength 9
         bDescriptorType 4
         bInterfaceNumber 0
         bAlternateSetting 0
         bNumEndpoints 1
         bInterfaceClass 1 Audio
         bInterfaceSubClass 1 Control Device
         bInterfaceProtocol 0
         iInterface 0
         AudioControl Interface Descriptor:
            bLength 9
            bDescriptorType 36
            bDescriptorSubtype 1 (HEADER)
            bcdADC 1.00
            wTotalLength 0x0027
            bInCollection 1
            baInterfaceNr(0) 1
         AudioControl Interface Descriptor:
            bLength 12
            bDescriptorType 36
            bDescriptorSubtype 2 (INPUT_TERMINAL)
            bTerminalID 1
            wTerminalType 0x0201 Microphone
            bAssocTerminal 0
            bNrChannels 1
            wChannelConfig 0x0000
            iChannelNames 0
            iTerminal 0
         AudioControl Interface Descriptor:
            bLength 9
            bDescriptorType 36
            bDescriptorSubtype 6 (FEATURE_UNIT)
            bUnitID 2
            bSourceID 1
            bControlSize 1
            bmaControls(0) 0x03
               Mute Control
               Volume Control
            bmaControls(1) 0x00
            iFeature 0
         AudioControl Interface Descriptor:
            bLength 9
            bDescriptorType 36
            bDescriptorSubtype 3 (OUTPUT_TERMINAL)
            bTerminalID 3
            wTerminalType 0x0101 USB Streaming
            bAssocTerminal 0
            bSourceID 2
            iTerminal 0
         Endpoint Descriptor:
            bLength 9
            bDescriptorType 5
            bEndpointAddress 0x81 EP 1 IN
            bmAttributes 3
               Transfer Type Interrupt
               Synch Type None
               Usage Type Data
            wMaxPacketSize 0x0008 1x 8 bytes
            bInterval 4
            bRefresh 0
            bSynchAddress 0
      Interface Descriptor:
         bLength 9
         bDescriptorType 4
         bInterfaceNumber 1
         bAlternateSetting 0
         bNumEndpoints 0
         bInterfaceClass 1 Audio
         bInterfaceSubClass 2 Streaming
         bInterfaceProtocol 0
         iInterface 0
      Interface Descriptor:
         bLength 9
         bDescriptorType 4
         bInterfaceNumber 1
         bAlternateSetting 1
         bNumEndpoints 1
         bInterfaceClass 1 Audio
         bInterfaceSubClass 2 Streaming
         bInterfaceProtocol 0
         iInterface 0
         AudioStreaming Interface Descriptor:
            bLength 7
            bDescriptorType 36
            bDescriptorSubtype 1 (AS_GENERAL)
            bTerminalLink 3
            bDelay 0 frames
            wFormatTag 0x0002 PCM8
         AudioStreaming Interface Descriptor:
            bLength 11
            bDescriptorType 36
            bDescriptorSubtype 2 (FORMAT_TYPE)
            bFormatType 1 (FORMAT_TYPE_I)
            bNrChannels 1
            bSubframeSize 1
            bBitResolution 8
            bSamFreqType 1 Discrete
            tSamFreq[ 0] 8000
         Endpoint Descriptor:
            bLength 9
            bDescriptorType 5
            bEndpointAddress 0x82 EP 2 IN
            bmAttributes 1
               Transfer Type Isochronous
               Synch Type None
               Usage Type Data
            wMaxPacketSize 0x0008 1x 8 bytes
            bInterval 4
            bRefresh 0
            bSynchAddress 0
            AudioStreaming Endpoint Descriptor:
               bLength 7
               bDescriptorType 37
               bDescriptorSubtype 1 (EP_GENERAL)
               bmAttributes 0x00
               bLockDelayUnits 0 Undefined
               wLockDelay 0x0000

There are a few immediate questions (probably more to come)...

1. What does the early message (Couldn't open device, some information will be missing) mean?

2. Why is it "Self-powered" when I have it running off VBUS?

3. How well designed is this Descriptor tree?  Is this typical?

 

Any thoughts would be appreciated.

Outcomes