Follow

Driver configuration without device tree overlays

Important: The following guide works for a Linux kernel without device-tree-overlays. Most modern distributions use device tree overlays. 

Upgrade your Linux kernel

Often the Linux distribution does not include the latest kernel drivers. Therefore one of our drivers might be missing. The easiest way is using the standard Raspbian distribution (or other distributions, that are based on it). You only have to update your system to the newest kernel. Login at your raspberry and use the following commands:

sudo rpi-update
sync
sudo reboot

On other distributions you might have to install rpi-update first. Have a look at our Linux kernel update guide.

Configure the drivers

Remove drivers from the blacklist

Remove the following lines from /etc/modprobe.d/raspi-blacklist.conf on Raspbian. If you’re using another distribution, check where it configures module blacklists.

blacklist i2c-bcm2708
blacklist snd-soc-pcm512x
blacklist snd-soc-wm8804

Remove the driver for the onboard sound

Remove the line

snd_bcm2835

from /etc/modules

Configure correct modules

Most likely, the modules are not enabled yet on your system. Add the following lines to the file /etc/modules:

DAC/DAC+ light

snd_soc_bcm2708
bcm2708_dmaengine
snd_soc_pcm5102a
snd_soc_hifiberry_dac

DAC+ standard/pro

snd_soc_bcm2708
bcm2708_dmaengine
snd_soc_pcm512x
snd_soc_hifiberry_dacplus

Digi and Digi+

snd_soc_bcm2708
bcm2708_dmaengine
snd_soc_hifiberry_digi

Amp and Amp+

snd_soc_bcm2708
bcm2708_dmaengine
snd_soc_hifiberry_amp

Configure ALSA

Create /etc/asound.conf with the following content:

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

Reboot again now

Test it

Check, if the sound card is enabled with “aplay”:

pi@raspberrypi ~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0

You can use aplay, to playback a WAV file. Note that aplayer won’t convert files that are in a format that is not natively supported from our drivers. (e.g. mono files or different sample rates). For other file formats (MP3, FLAC, …) We recommend to use mplayer.

sudo apt-get install mplayer

Some users have reported problems with MP3 playback of mplayer. It seems, that the MP3 codec is not installed by default on all systems. We found the FLAC format to be best supported by mplayer.

Depending of the board you’re using it will show another HiFiBerry sound card (DAC, DAC+, Digi or Amp)

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

  • Avatar
    pander

    Please, contribute to https://github.com/RPi-Distro/raspi-config/issues/14 for ease of installation.

  • Avatar
    David Archer

    Unfortunately I cannot get a DAC+ Pro to work despite much troubleshooting. I have added the required two lines to the bottom of /flash/config.txt under hdmi_drive=2

    dtoverlay=hifiberry-dacplus
    dtdebug=1

    When I run "aplay -l" I get:

    **** List of PLAYBACK Hardware Devices ****
    card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
    Subdevices: 8/8
    Subdevice #0: subdevice #0
    Subdevice #1: subdevice #1
    Subdevice #2: subdevice #2
    Subdevice #3: subdevice #3
    Subdevice #4: subdevice #4
    Subdevice #5: subdevice #5
    Subdevice #6: subdevice #6
    Subdevice #7: subdevice #7
    card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    card 1: sndrpihifiberry [snd_rpi_hifiberry_dacplus], device 0: HiFiBerry DAC+ Pro HiFi pcm512x-hifi-0 []
    Subdevices: 1/1
    Subdevice #0: subdevice #0

    When I configure Plex Media Player's sound output I only see "Alsa"

    When I fling media to the PMP instance on the Pi3/DAC+ Pro nothing outputs from the HifiBerry board.

    If I connect HDMI to the Pi3 and fling media....sound outputs properly from the HDMI hardware.