Raspberry PI 2B/3 and USB audio

Brian Scott bscott at bunyatech.com.au
Thu Nov 29 03:14:45 UTC 2018


On 28/11/18 10:40 pm, Hans Petter Selasky wrote:
> On 11/28/18 11:28 AM, Brian Scott wrote:
>> On 28/11/18 9:22 pm, Hans Petter Selasky wrote:
>>> On 11/28/18 11:13 AM, Brian Scott wrote:
>>>> On 28/11/18 7:45 pm, Hans Petter Selasky wrote:
>>>>> On 11/28/18 1:46 AM, Brian Scott wrote:
>>>>>> On 27/11/18 6:38 pm, Hans Petter Selasky wrote:
>>>>>>> On 11/26/18 8:47 PM, Herbert J. Skuhra wrote:
>>>>>>>> Well, this USB sound card works perfectly fine on my desktop PC
>>>>>>>> running FreeBSD (amd64).
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> There is a problem in the DWC OTG USB controller driver that it
>>>>>>> cannot
>>>>>>> handle the big data payload 24-bit 48KHz sampling requires.
>>>>>>> Unfortunately your device has only one sample size selection.
>>>>>>>
>>>>>>> If you buy a USB sound device marked as "HIGH SPEED USB" it should
>>>>>>> work. Yours is "spd=FULL".
>>>>>>>
>>>>>>> --HPS
>>>>>> Just an additional data point,
>>>>>>
>>>>>> This one also sounds like junk but is high speed:
>>>>>>
>>>>>>        ugen0.6: <Generic USB Audio> at usbus0, cfg=0 md=HOST
>>>>>> spd=HIGH
>>>>>>        (480Mbps) pwr=ON (100mA)
>>>>>>
>>>>>>          bLength = 0x0012
>>>>>>          bDescriptorType = 0x0001
>>>>>>          bcdUSB = 0x0200
>>>>>>          bDeviceClass = 0x0000  <Probed by interface class>
>>>>>>          bDeviceSubClass = 0x0000
>>>>>>          bDeviceProtocol = 0x0000
>>>>>>          bMaxPacketSize0 = 0x0040
>>>>>>          idVendor = 0x0bda
>>>>>>          idProduct = 0x4040
>>>>>>          bcdDevice = 0x0000
>>>>>>          iManufacturer = 0x0003  <Generic>
>>>>>>          iProduct = 0x0001  <USB Audio>
>>>>>>          iSerialNumber = 0x0002  <201405280001>
>>>>>>          bNumConfigurations = 0x0001
>>>>>>
>
> Hi,
>
> Can you also dump the device descriptors?
>
> usbconfig -d 0.6 dump_curr_config_desc
>
# usbconfig -d 0.6 dump_curr_config_desc
ugen0.6: <Generic USB Audio> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps)
pwr=ON (100mA)


 Configuration index 0

    bLength = 0x0009
    bDescriptorType = 0x0002
    wTotalLength = 0x01fb
    bNumInterfaces = 0x0004
    bConfigurationValue = 0x0001
    iConfiguration = 0x0004  <USB Audio>
    bmAttributes = 0x00a0
    bMaxPower = 0x0032

    Interface 0
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0000
      bAlternateSetting = 0x0000
      bNumEndpoints = 0x0001
      bInterfaceClass = 0x0001  <Audio device>
      bInterfaceSubClass = 0x0001
      bInterfaceProtocol = 0x0000
      iInterface = 0x0005  <Realtek USB2.0 Audio>

      Additional Descriptor

      bLength = 0x0a
      bDescriptorType = 0x24
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x0a, 0x24, 0x01, 0x00, 0x01, 0x5d, 0x00, 0x02,
       0x08 | 0x01, 0x02


      Additional Descriptor

      bLength = 0x0c
      bDescriptorType = 0x24
      bDescriptorSubType = 0x02
       RAW dump:
       0x00 | 0x0c, 0x24, 0x02, 0x05, 0x03, 0x06, 0x00, 0x02,
       0x08 | 0x03, 0x00, 0x00, 0x00


      Additional Descriptor

      bLength = 0x0d
      bDescriptorType = 0x24
      bDescriptorSubType = 0x06
       RAW dump:
       0x00 | 0x0d, 0x24, 0x06, 0x07, 0x05, 0x02, 0x01, 0x00,
       0x08 | 0x02, 0x00, 0x02, 0x00, 0x00


      Additional Descriptor

      bLength = 0x09
      bDescriptorType = 0x24
      bDescriptorSubType = 0x03
       RAW dump:
       0x00 | 0x09, 0x24, 0x03, 0x06, 0x01, 0x01, 0x05, 0x04,
       0x08 | 0x00

      Additional Descriptor

      bLength = 0x0f
      bDescriptorType = 0x24
      bDescriptorSubType = 0x08
       RAW dump:
       0x00 | 0x0f, 0x24, 0x08, 0x04, 0xda, 0x0b, 0x01, 0x07,
       0x08 | 0x02, 0x03, 0x00, 0x00, 0x01, 0x01, 0x00


      Additional Descriptor

      bLength = 0x0c
      bDescriptorType = 0x24
      bDescriptorSubType = 0x02
       RAW dump:
       0x00 | 0x0c, 0x24, 0x02, 0x0e, 0x01, 0x01, 0x00, 0x02,
       0x08 | 0x03, 0x00, 0x00, 0x15


      Additional Descriptor

      bLength = 0x09
      bDescriptorType = 0x24
      bDescriptorSubType = 0x03
       RAW dump:
       0x00 | 0x09, 0x24, 0x03, 0x0f, 0x02, 0x03, 0x0e, 0x10,
       0x08 | 0x00

      Additional Descriptor

      bLength = 0x0d
      bDescriptorType = 0x24
      bDescriptorSubType = 0x06
       RAW dump:
       0x00 | 0x0d, 0x24, 0x06, 0x10, 0x0e, 0x02, 0x01, 0x00,
       0x08 | 0x02, 0x00, 0x02, 0x00, 0x00


     Endpoint 0
        bLength = 0x0009
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0087  <IN>
        bmAttributes = 0x0003  <INTERRUPT>
        wMaxPacketSize = 0x0010
        bInterval = 0x0008
        bRefresh = 0x0000
        bSynchAddress = 0x0000


    Interface 1
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0001
      bAlternateSetting = 0x0000
      bNumEndpoints = 0x0000
      bInterfaceClass = 0x0001  <Audio device>
      bInterfaceSubClass = 0x0002
      bInterfaceProtocol = 0x0000
      iInterface = 0x0013  <Line>


    Interface 1 Alt 1
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0001
      bAlternateSetting = 0x0001
      bNumEndpoints = 0x0001
      bInterfaceClass = 0x0001  <Audio device>
      bInterfaceSubClass = 0x0002
      bInterfaceProtocol = 0x0000
      iInterface = 0x0000  <no string>

      Additional Descriptor

      bLength = 0x07
      bDescriptorType = 0x24
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x07, 0x24, 0x01, 0x06, 0x01, 0x01, 0x00


      Additional Descriptor

      bLength = 0x0b
      bDescriptorType = 0x24
      bDescriptorSubType = 0x02
       RAW dump:
       0x00 | 0x0b, 0x24, 0x02, 0x01, 0x02, 0x02, 0x10, 0x01,
       0x08 | 0x44, 0xac, 0x00


     Endpoint 0
        bLength = 0x0009
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0082  <IN>
        bmAttributes = 0x0005  <ASYNC-ISOCHRONOUS>
        wMaxPacketSize = 0x00e4
        bInterval = 0x0004
        bRefresh = 0x0000
        bSynchAddress = 0x0000

      Additional Descriptor

      bLength = 0x07
      bDescriptorType = 0x25
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x07, 0x25, 0x01, 0x01, 0x00, 0x00, 0x00



    Interface 1 Alt 2
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0001
      bAlternateSetting = 0x0002
      bNumEndpoints = 0x0001
      bInterfaceClass = 0x0001  <Audio device>
      bInterfaceSubClass = 0x0002
      bInterfaceProtocol = 0x0000
      iInterface = 0x0000  <no string>

      Additional Descriptor

      bLength = 0x07
      bDescriptorType = 0x24
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x07, 0x24, 0x01, 0x06, 0x01, 0x01, 0x00


      Additional Descriptor

      bLength = 0x0b
      bDescriptorType = 0x24
      bDescriptorSubType = 0x02
       RAW dump:
       0x00 | 0x0b, 0x24, 0x02, 0x01, 0x02, 0x03, 0x18, 0x01,
       0x08 | 0x44, 0xac, 0x00


     Endpoint 0
        bLength = 0x0009
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0082  <IN>
        bmAttributes = 0x0005  <ASYNC-ISOCHRONOUS>
        wMaxPacketSize = 0x0156
        bInterval = 0x0004
        bRefresh = 0x0000
        bSynchAddress = 0x0000

      Additional Descriptor

      bLength = 0x07
      bDescriptorType = 0x25
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x07, 0x25, 0x01, 0x01, 0x00, 0x00, 0x00



    Interface 1 Alt 3
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0001
      bAlternateSetting = 0x0003
      bNumEndpoints = 0x0001
      bInterfaceClass = 0x0001  <Audio device>
      bInterfaceSubClass = 0x0002
      bInterfaceProtocol = 0x0000
      iInterface = 0x0000  <no string>

      Additional Descriptor

      bLength = 0x07
      bDescriptorType = 0x24
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x07, 0x24, 0x01, 0x06, 0x01, 0x01, 0x00


      Additional Descriptor

      bLength = 0x0b
      bDescriptorType = 0x24
      bDescriptorSubType = 0x02
       RAW dump:
       0x00 | 0x0b, 0x24, 0x02, 0x01, 0x02, 0x02, 0x10, 0x01,
       0x08 | 0x80, 0xbb, 0x00


     Endpoint 0
        bLength = 0x0009
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0082  <IN>
        bmAttributes = 0x0005  <ASYNC-ISOCHRONOUS>
        wMaxPacketSize = 0x00f8
        bInterval = 0x0004
        bRefresh = 0x0000
        bSynchAddress = 0x0000

      Additional Descriptor

      bLength = 0x07
      bDescriptorType = 0x25
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x07, 0x25, 0x01, 0x01, 0x00, 0x00, 0x00



    Interface 1 Alt 4
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0001
      bAlternateSetting = 0x0004
      bNumEndpoints = 0x0001
      bInterfaceClass = 0x0001  <Audio device>
      bInterfaceSubClass = 0x0002
      bInterfaceProtocol = 0x0000
      iInterface = 0x0000  <no string>

      Additional Descriptor

      bLength = 0x07
      bDescriptorType = 0x24
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x07, 0x24, 0x01, 0x06, 0x01, 0x01, 0x00


      Additional Descriptor

      bLength = 0x0b
      bDescriptorType = 0x24
      bDescriptorSubType = 0x02
       RAW dump:
       0x00 | 0x0b, 0x24, 0x02, 0x01, 0x02, 0x03, 0x18, 0x01,
       0x08 | 0x80, 0xbb, 0x00


     Endpoint 0
        bLength = 0x0009
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0082  <IN>
        bmAttributes = 0x0005  <ASYNC-ISOCHRONOUS>
        wMaxPacketSize = 0x0174
        bInterval = 0x0004
        bRefresh = 0x0000
        bSynchAddress = 0x0000

      Additional Descriptor

      bLength = 0x07
      bDescriptorType = 0x25
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x07, 0x25, 0x01, 0x01, 0x00, 0x00, 0x00



    Interface 1 Alt 5
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0001
      bAlternateSetting = 0x0005
      bNumEndpoints = 0x0001
      bInterfaceClass = 0x0001  <Audio device>
      bInterfaceSubClass = 0x0002
      bInterfaceProtocol = 0x0000
      iInterface = 0x0000  <no string>

      Additional Descriptor

      bLength = 0x07
      bDescriptorType = 0x24
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x07, 0x24, 0x01, 0x06, 0x01, 0x01, 0x00


      Additional Descriptor

      bLength = 0x0b
      bDescriptorType = 0x24
      bDescriptorSubType = 0x02
       RAW dump:
       0x00 | 0x0b, 0x24, 0x02, 0x01, 0x02, 0x02, 0x10, 0x01,
       0x08 | 0x00, 0x77, 0x01


     Endpoint 0
        bLength = 0x0009
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0082  <IN>
        bmAttributes = 0x0005  <ASYNC-ISOCHRONOUS>
        wMaxPacketSize = 0x01f0
        bInterval = 0x0004
        bRefresh = 0x0000
        bSynchAddress = 0x0000

      Additional Descriptor

      bLength = 0x07
      bDescriptorType = 0x25
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x07, 0x25, 0x01, 0x01, 0x00, 0x00, 0x00



    Interface 1 Alt 6
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0001
      bAlternateSetting = 0x0006
      bNumEndpoints = 0x0001
      bInterfaceClass = 0x0001  <Audio device>
      bInterfaceSubClass = 0x0002
      bInterfaceProtocol = 0x0000
      iInterface = 0x0000  <no string>

      Additional Descriptor

      bLength = 0x07
      bDescriptorType = 0x24
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x07, 0x24, 0x01, 0x06, 0x01, 0x01, 0x00


      Additional Descriptor

      bLength = 0x0b
      bDescriptorType = 0x24
      bDescriptorSubType = 0x02
       RAW dump:
       0x00 | 0x0b, 0x24, 0x02, 0x01, 0x02, 0x03, 0x18, 0x01,
       0x08 | 0x00, 0x77, 0x01


     Endpoint 0
        bLength = 0x0009
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0082  <IN>
        bmAttributes = 0x0005  <ASYNC-ISOCHRONOUS>
        wMaxPacketSize = 0x02e8
        bInterval = 0x0004
        bRefresh = 0x0000
        bSynchAddress = 0x0000

      Additional Descriptor

      bLength = 0x07
      bDescriptorType = 0x25
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x07, 0x25, 0x01, 0x01, 0x00, 0x00, 0x00



    Interface 2
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0002
      bAlternateSetting = 0x0000
      bNumEndpoints = 0x0000
      bInterfaceClass = 0x0001  <Audio device>
      bInterfaceSubClass = 0x0002
      bInterfaceProtocol = 0x0000
      iInterface = 0x0015  <Headphone>


    Interface 2 Alt 1
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0002
      bAlternateSetting = 0x0001
      bNumEndpoints = 0x0001
      bInterfaceClass = 0x0001  <Audio device>
      bInterfaceSubClass = 0x0002
      bInterfaceProtocol = 0x0000
      iInterface = 0x0000  <no string>

      Additional Descriptor

      bLength = 0x07
      bDescriptorType = 0x24
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x07, 0x24, 0x01, 0x0e, 0x01, 0x01, 0x00


      Additional Descriptor

      bLength = 0x0b
      bDescriptorType = 0x24
      bDescriptorSubType = 0x02
       RAW dump:
       0x00 | 0x0b, 0x24, 0x02, 0x01, 0x02, 0x02, 0x10, 0x01,
       0x08 | 0x44, 0xac, 0x00


     Endpoint 0
        bLength = 0x0009
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0004  <OUT>
        bmAttributes = 0x0009  <ADAPT-ISOCHRONOUS>
        wMaxPacketSize = 0x00e4
        bInterval = 0x0004
        bRefresh = 0x0000
        bSynchAddress = 0x0000

      Additional Descriptor

      bLength = 0x07
      bDescriptorType = 0x25
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x07, 0x25, 0x01, 0x01, 0x00, 0x00, 0x00



    Interface 2 Alt 2
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0002
      bAlternateSetting = 0x0002
      bNumEndpoints = 0x0001
      bInterfaceClass = 0x0001  <Audio device>
      bInterfaceSubClass = 0x0002
      bInterfaceProtocol = 0x0000
      iInterface = 0x0000  <no string>

      Additional Descriptor

      bLength = 0x07
      bDescriptorType = 0x24
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x07, 0x24, 0x01, 0x0e, 0x01, 0x01, 0x00


      Additional Descriptor

      bLength = 0x0b
      bDescriptorType = 0x24
      bDescriptorSubType = 0x02
       RAW dump:
       0x00 | 0x0b, 0x24, 0x02, 0x01, 0x02, 0x02, 0x10, 0x01,
       0x08 | 0x80, 0xbb, 0x00


     Endpoint 0
        bLength = 0x0009
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0004  <OUT>
        bmAttributes = 0x0009  <ADAPT-ISOCHRONOUS>
        wMaxPacketSize = 0x00f8
        bInterval = 0x0004
        bRefresh = 0x0000
        bSynchAddress = 0x0000

      Additional Descriptor

      bLength = 0x07
      bDescriptorType = 0x25
      bDescriptorSubType = 0x01
       RAW dump:
       0x00 | 0x07, 0x25, 0x01, 0x01, 0x00, 0x00, 0x00



    Interface 3
      bLength = 0x0009
      bDescriptorType = 0x0004
      bInterfaceNumber = 0x0003
      bAlternateSetting = 0x0000
      bNumEndpoints = 0x0001
      bInterfaceClass = 0x0003  <HID device>
      bInterfaceSubClass = 0x0000
      bInterfaceProtocol = 0x0000
      iInterface = 0x0000  <no string>

      Additional Descriptor

      bLength = 0x09
      bDescriptorType = 0x21
      bDescriptorSubType = 0x11
       RAW dump:
       0x00 | 0x09, 0x21, 0x11, 0x01, 0x00, 0x01, 0x22, 0x30,
       0x08 | 0x00

     Endpoint 0
        bLength = 0x0007
        bDescriptorType = 0x0005
        bEndpointAddress = 0x0088  <IN>
        bmAttributes = 0x0003  <INTERRUPT>
        wMaxPacketSize = 0x0010
        bInterval = 0x0004
        bRefresh = 0x0000
        bSynchAddress = 0x0000
>
> And can you capture with usbdump some traffic while doing playback?
>
> usbdump -i usbus0 -f 6 -s 65536 -vvv > ~/log.txt
>
# play westminster.wav

westminster.wav:

 File Size: 77.8k     Bit Rate: 353k
  Encoding: Signed PCM   
  Channels: 1 @ 16-bit  
Samplerate: 22050Hz     
Replaygain: off        
  Duration: 00:00:01.76 

In:100%  00:00:01.76 [00:00:00.00] Out:38.9k [      |      ]       
Clip:0   
Done.

https://www.dropbox.com/s/vbexegsu9ttuvdj/log.txt?dl=0
>
> And this device works fine using a regular PC with FreeBSD installed?
A little tricky at the moment but I will hopefully get something
organised within a few days. Server running FreeBSD lives in a laundry
cupboard under a ton of junk because I rarely need physical access to it.

Not quite the test you are after but I tried it on a Mac and it works
perfectly so at least the hardware works properly in some circumstances.
>
> --HPS

Thanks for looking at this. I didn't mean to steal the thread, just do a
me-too. I had consigned the adapter to the junk bin after I tried it on
a RPI-B a year ago and had it fail miserably so I'd written it off.

Cheers,


Brian



More information about the freebsd-arm mailing list