Raspbian上的USB DAC产生错误

时间:2014-11-07 19:38:03

标签: usb raspberry-pi raspbian alsa audio-player

我今天终于为我的Raspberry Pi(在Raspbian Wheezy上运行)获得了一个USB DAC(HiFimeDIY Saber DAC),但当然,只需插入它就行不通。我现在一直在使用ALSA配置搞乱了一段时间,但无济于事。通过3.5英寸耳机插孔的音频播放工作得很好,但我似乎无法通过USB播放音频.aplay -L给出了

pi@raspberrypi ~ $ aplay -L
...
pulse
  Playback/recording through the PulseAudio sound server
  sysdefault:CARD=DAC
  HiFimeDIY DAC, USB Audio
  Default Audio Device
front:CARD=DAC
  HiFimeDIY DAC, USB Audio
  Default Audio Device
...
sysdefault:CARD=ALSA
  bcm2835 ALSA, bcm2835 ALSA
  Default Audio Device
front:CARD=ALSA
  bcm2835 ALSA, bcm2835 ALSA
  Default Audio Device

我想知道两张卡都被标记为“默认音频设备”是件好事吗?

无论如何,通过

测试播放
 pi@raspberrypi ~ $ aplay /usr/share/sounds/alsa/Front_Center.wav -D sysdefault:CARD=ALSA
 Playback: WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian,  Rate: 48000 Hz, mono

工作正常,但

 pi@raspberrypi ~ $ aplay /usr/share/sounds/alsa/Front_Center.wav -D sysdefault:CARD=DAC
 ALSA lib pcm_direct.c:980:(snd1_pcm_direct_initialize_slave) unable to install hw params
 ALSA lib pcm_dmix.c:1030:(snd_pcm_dmix_open) unable to initialize slave
 aplay: main:682: Fehler beim Öffnen des Gerätes: Datenübergabe unterbrochen (broken pipe)

(对于德语,它在打开设备时会显示错误:数据流中断)

我的/etc/asound.conf看起来如下:

 pcm.!default {
 type hw
 card 0
 device 0
 }

和/etc/modprobe.d/alsa-base.conf包含以下条目:

# Keep snd-usb-audio from beeing loaded as first soundcard
options snd-usb-audio index=0
options snd_bcm2835 index=1

我做错了什么?非常感谢帮助!

修改

Systemlog说明如下:

Nov  7 18:30:29 raspberrypi kernel: [    2.534311] usb 1-1: new full-speed USB device number 2 using dwc_otg
Nov  7 18:30:29 raspberrypi kernel: [    2.546658] Indeed it is in host mode hprt0 = 00021501
Nov  7 18:30:29 raspberrypi kernel: [    2.752653] usb 1-1: not running at top speed; connect to a high speed hub
Nov  7 18:30:29 raspberrypi kernel: [    2.765131] usb 1-1: New USB device found, idVendor=0424, idProduct=9514
Nov  7 18:30:29 raspberrypi kernel: [    2.776874] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber$
Nov  7 18:30:29 raspberrypi kernel: [    2.790194] hub 1-1:1.0: USB hub found
Nov  7 18:30:29 raspberrypi kernel: [    2.799746] hub 1-1:1.0: 5 ports detected
Nov  7 18:30:29 raspberrypi kernel: [    3.082453] usb 1-1.1: new full-speed USB device number 3 using dwc_otg
Nov  7 18:30:29 raspberrypi kernel: [    3.192745] usb 1-1.1: not running at top speed; connect to a high speed hub
Nov  7 18:30:29 raspberrypi kernel: [    3.205857] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
Nov  7 18:30:29 raspberrypi kernel: [    3.218650] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumb$
Nov  7 18:30:29 raspberrypi kernel: [    3.239311] smsc95xx v1.0.4

...

Nov  7 18:30:29 raspberrypi kernel: [    3.308141] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-bcm2708_usb$
Nov  7 18:30:29 raspberrypi kernel: [    3.432526] usb 1-1.3: new full-speed USB device number 4 using dwc_otg
Nov  7 18:30:29 raspberrypi kernel: [    3.626813] usb 1-1.3: New USB device found, idVendor=1852, idProduct=7022
Nov  7 18:30:29 raspberrypi kernel: [    3.647601] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumb$
Nov  7 18:30:29 raspberrypi kernel: [    3.664695] usb 1-1.3: Product: HiFimeDIY DAC
Nov  7 18:30:29 raspberrypi kernel: [    3.676431] usb 1-1.3: Manufacturer: HiFimeDIY Audio
Nov  7 18:30:29 raspberrypi kernel: [    3.703597] input: HiFimeDIY Audio HiFimeDIY DAC as /devices/platform/bcm27$
Nov  7 18:30:29 raspberrypi kernel: [    3.721606] hid-generic 0003:1852:7022.0001: input,hidraw0: USB HID v1.00 D$
Nov  7 18:30:29 raspberrypi kernel: [    7.529882] usbcore: registered new interface driver snd-usb-audio

但是一旦启动过程完成,我就会连续几十次这样做:

Nov  7 18:30:38 raspberrypi kernel: [   41.221205] INFO:: schedule_periodic: Insufficient periodic bandwidth for p$
Nov  7 18:30:38 raspberrypi kernel: [   41.221205]
Nov  7 18:30:38 raspberrypi kernel: [   41.221261] ERROR::dwc_otg_hcd_urb_enqueue:544: DWC OTG HCD URB Enqueue fai$
Nov  7 18:30:38 raspberrypi kernel: [   41.221261]
Nov  7 18:30:38 raspberrypi kernel: [   41.221288] cannot submit urb 0, error -1: unknown error

此外:

Nov  7 18:45:21 raspberrypi kernel: [  861.969647] bcm2835_audio_set_ctls:558  Controls set for stream 0
Nov  7 18:47:58 raspberrypi pulseaudio[2390]: [pulseaudio] module-always-sink.c: Unable to load module-null-sink

Nov  7 18:48:46 raspberrypi pulseaudio[2494]: [pulseaudio] module-udev-detect.c: Tried to configure /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.1/sound/card0 (alsa_card.usb-HiFimeDIY_Audio_HiFimeDIY_DAC-01-DAC) more often than 5 times in 10 seconds

编辑2:

/ proc / asound / card0 / stream0的内容是

HiFimeDIY Audio HiFimeDIY DAC at usb-bcm2708_usb-1.3, full speed : USB Audio

Playback:
 Status: Stop
 Interface 3
  Altset 1
  Format: S16_LE
  Channels: 2
  Endpoint: 3 OUT (ADAPTIVE)
  Rates: 8000, 16000, 32000, 44100, 48000, 96000
 Interface 3
  Altset 2
  Format: S24_3LE
  Channels: 2
  Endpoint: 3 OUT (ADAPTIVE)
  Rates: 8000, 16000, 32000, 44100, 48000, 96000

Capture:
 Status: Stop
 Interface 2
  Altset 1
  Format: S16_LE
  Channels: 2
  Endpoint: 2 IN (ADAPTIVE)
  Rates: 8000, 16000, 32000, 44100, 48000, 96000
 Interface 2
  Altset 2
  Format: S24_3LE
  Channels: 2
  Endpoint: 2 IN (ADAPTIVE)
  Rates: 8000, 16000, 32000, 44100, 48000, 96000

每次我想通过USB卡强制声音(下面我将它设置为.asoundrc中的默认音频设备)我得到了

pi@raspberrypi ~ $ aplay piano2.wav Wiedergabe: WAVE 'piano2.wav' : Signed 16 bit Little Endian, Rate: 48000 Hz, stereo aplay: set_params:1145: Fehler beim Setzen der Hardware-Parameter: ACCESS: RW_INTERLEAVED FORMAT: S16_LE SUBFORMAT: STD SAMPLE_BITS: 16 FRAME_BITS: 32 CHANNELS: 2 RATE: 48000 PERIOD_TIME: 125000 PERIOD_SIZE: 6000 PERIOD_BYTES: 24000 PERIODS: 4 BUFFER_TIME: 500000 BUFFER_SIZE: 24000 BUFFER_BYTES: 96000 TICK_TIME: 0

(德语部分说“aplay:set_params:1145:无法安装hw params :)。 另外,aplay -L仍然给了我

Karte 0: DAC [HiFimeDIY DAC], Gerät 0: USB Audio [USB Audio]
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0
Karte 0: DAC [HiFimeDIY DAC], Gerät 1: USB Audio [USB Audio #1]
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0

当我使用aplay -D hw:0,1 sound.wav时,回放似乎有效(没有错误消息被抛出),但我根本听不到任何声音。卡0,1是录音设备吗?如果我使用板载声音,一切正常。我没有使用USB集线器(DAC直接插入pi)。这可能是一个权力问题吗?

lsusb已经

pi@raspberrypi ~ $ lsusb Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. Bus 001 Device 004: ID 1852:7022 GYROCOM C&C Co., LTD

目前,打印机已插入(虽然已关闭)并且拔掉它没有任何改变,lsusb仍显示相同的设备(我想知道为什么有4个和3个不同,而Pi只有2个端口,其中一个是DAC)。当pi启动并且扬声器插入DAC时,我会发出一些噼啪声,就像它们插入耳机插孔一样。

2 个答案:

答案 0 :(得分:0)

即使我遇到类似的问题。

可能的解决方案:

  

检查内核配置(zcat /proc/config.gz | grep' CONFIG_FW_LOADER')。如果未启用该配置,则尝试构建启用此配置的内核。    我在相同的ROOT文件系统中尝试了不同内核的类似方法,然后检查了我发现上述解决方案的配置。

谢谢和问候, Sandesh K A

如果此解决方案适合您,请告诉我。

答案 1 :(得分:0)

不久前,我遇到了同样的问题。我已经设法通过仔细检查配置文件来修复它。在我的情况下,我在配置<DataTemplate x:Key="pivotTemplate"> <ScrollViewer> <StackPanel Margin="-15 0 -15 0"> ... </StackPanel> </ScrollViewer> </DataTemplate> 后运行alsa混音器。通过运行alsa混音器/拔出usb,alsa会自动更新~/.asoundrc文件。因此,覆盖了我之前的配置。

在重试之前,请确保您对conf文件中的更改仍然存在。我希望这对你有用。

Set up Raspberry Pi 3 USB mic ( creative sound blaster )