Raspberry PI 2B/3 and USB audio

Brian Scott bscott at bunyatech.com.au
Wed Nov 28 10:28:49 UTC 2018


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
>>>>
>>>> But I notice that it handles both 48000 and 8000 according to the
>>>> sound
>>>> driver.
>>>>
>>>>       cat /dev/sndstat
>>>>       FreeBSD Audio Driver (64bit 2009061500/aarch64)
>>>>       Installed devices:
>>>>       pcm0: <USB audio> at ? kld snd_uaudio (1p:1v/1r:1v) default
>>>>           snddev flags=0x2e2<AUTOVCHAN,BUSY,MPSAFE,REGISTERED,VPC>
>>>>           [pcm0:play:dsp0.p0]: spd 48000, fmt 0x00200010, flags
>>>>       0x00002100, 0x00000004
>>>>           interrupts 0, underruns 0, feed 0, ready 0
>>>>       [b:3072/1536/2|bs:4096/2048/2]
>>>>           channel flags=0x2100<BUSY,HAS_VCHAN>
>>>>           {userland} -> feeder_mixer(0x00200010) -> {hardware}
>>>>           pcm0:play:dsp0.p0[pcm0:virtual:dsp0.vp0]: spd 8000, fmt
>>>>       0x00100008, flags 0x10000000, 0x00000000
>>>>           interrupts 0, underruns 0, feed 0, ready 0
>>>> [b:0/0/0|bs:0/0/0]
>>>>           channel flags=0x10000000<VIRTUAL>
>>>>           {userland} -> feeder_root(0x00000000) -> {hardware}
>>>>           [pcm0:record:dsp0.r0]: spd 48000,fmt 0x00200010/0x00210000,
>>>>       flags 0x00002100, 0x00000007
>>>>           interrupts 0, overruns 0, feed 0, hfree 4608, sfree 4096
>>>>       [b:4608/2304/2|bs:4096/2048/2]
>>>>           channel flags=0x2100<BUSY,HAS_VCHAN>
>>>>           {hardware} -> feeder_root(0x00210000) ->
>>>>       feeder_format(0x00210000 -> 0x00200010) ->
>>>> feeder_mixer(0x00200010)
>>>>       -> {userland}
>>>>           pcm0:record:dsp0.r0[pcm0:virtual:dsp0.vr0]: spd 8000, fmt
>>>>       0x00100008, flags 0x10000000, 0x00000000
>>>>           interrupts 0, overruns 0, feed 0, hfree 0, sfree 0
>>>>       [b:0/0/0|bs:0/0/0]
>>>>           channel flags=0x10000000<VIRTUAL>
>>>>           {hardware} -> feeder_root(0x00000000) -> {userland}
>>>>       No devices installed from userspace.
>>>>
>>>> Output sounds like rubbish with both 8000 speed stuff sent directly to
>>>> /dev/dsp using cat and higher quality stuff sent via sox play.
>>>>
>>>> It could also just be a junk piece of hardware from my local
>>>> electronics
>>>> shop.
>>>
>>> Which version of FreeBSD is this?
>>>
>>> Can you show dmesg?
>>>
>>> --HPS
>>>
>> 12.0 RC2 with /boot and /boot/msdos on sdcard and everything else on USB
>> connected hard drive (causing interference with the bus?). Otherwise
>> everything directly off the RC2 image + packages and a bit of
>> configuration.
>>
>> On repeating my tests (probably last done a few months ago with the
>> current snapshot) the sound was much better than I remember (almost
>> recognisable!). Maybe having the non-debug kernel is helping. Hope this
>> isn't a red herring.
>>
>
> Can you set the:
>
> sysctl dev.pcm.0.play.vchanrate=48000
> sysctl dev.pcm.0.rec.vchanrate=48000
>
> And try again?
>
> --HPS

Already set:

#sysctl dev.pcm.0
dev.pcm.0.feedback_rate: 0
dev.pcm.0.mixer.mute_4.desc: 201405280001
dev.pcm.0.mixer.mute_4.max: 1
dev.pcm.0.mixer.mute_4.min: 0
dev.pcm.0.mixer.mute_4.val: 1
dev.pcm.0.mixer.vol_3_1.desc: 201405280001
dev.pcm.0.mixer.vol_3_1.max: 0
dev.pcm.0.mixer.vol_3_1.min: -16800
dev.pcm.0.mixer.vol_3_1.val: -2153
dev.pcm.0.mixer.vol_3_0.desc: 201405280001
dev.pcm.0.mixer.vol_3_0.max: 0
dev.pcm.0.mixer.vol_3_0.min: -16800
dev.pcm.0.mixer.vol_3_0.val: -2153
dev.pcm.0.mixer.mute_2.desc: 201405280001
dev.pcm.0.mixer.mute_2.max: 1
dev.pcm.0.mixer.mute_2.min: 0
dev.pcm.0.mixer.mute_2.val: 1
dev.pcm.0.mixer.vol_1_1.desc: 201405280001
dev.pcm.0.mixer.vol_1_1.max: 0
dev.pcm.0.mixer.vol_1_1.min: -8576
dev.pcm.0.mixer.vol_1_1.val: -2153
dev.pcm.0.mixer.vol_1_0.desc: 201405280001
dev.pcm.0.mixer.vol_1_0.max: 0
dev.pcm.0.mixer.vol_1_0.min: -8576
dev.pcm.0.mixer.vol_1_0.val: -2153
dev.pcm.0.mixer.(null)_0.desc:
dev.pcm.0.mixer.(null)_0.max: 1
dev.pcm.0.mixer.(null)_0.min: 0
dev.pcm.0.mixer.(null)_0.val: 1
dev.pcm.0.bitperfect: 0
dev.pcm.0.buffersize: 0
dev.pcm.0.rec.vchanformat: s16le:2.0
dev.pcm.0.rec.vchanrate: 48000
dev.pcm.0.rec.vchanmode: fixed
dev.pcm.0.rec.vchans: 1
dev.pcm.0.play.vchanformat: s16le:2.0
dev.pcm.0.play.vchanrate: 48000
dev.pcm.0.play.vchanmode: fixed
dev.pcm.0.play.vchans: 1
dev.pcm.0.hwvol_mixer: vol
dev.pcm.0.hwvol_step: 5
dev.pcm.0.%parent: uaudio0
dev.pcm.0.%pnpinfo:
dev.pcm.0.%location:
dev.pcm.0.%driver: pcm
dev.pcm.0.%desc: USB audio




More information about the freebsd-arm mailing list