Install hifiberry amp+ on HypriotOS - datenwalze.de

, categorized under: piratio hifiberry hypriot

Installing hifiberry boards on HypriotOS currently isn’t that easy.

HifiBerry

If you ever used the 3.5mm jack of the Raspberry, you might have noticed that sound quality is somewhere between unuseable and worse. This is because the Raspi hasn’t got anything you would call a “Soundcard”, in reality it’s just a PWM’ed digital out.

Hifiberry is a Company that makes some fine piggyback soundcards for the Raspberry PI. I bougth a Hifiberyy AMP+ some time ago wich includes a well-designed Class-D amp with about 25W Output.

Installing HypriotOS

If you haven’t got Hypriot running yet, simply flash your SD Card with a recent version.

Should look something like this (on OS X, replace disk, ssid and password…) :

flash -d disk4  -n radio \
  -s my_ssid \
  -p my_password \
  https://github.com/hypriot/image-builder-rpi/releases/download/v1.1.1/hypriotos-rpi-v1.1.1.img.zip

Adding Hifiberry support

First we have to follow Hifiberry’s original instructions:

Open /boot/config.txt with your favorite Editor and add the following lines:

#hifiberry
#dtoverlay=hifiberry-dac
#dtoverlay=hifiberry-dacplus
#dtoverlay=hifiberry-digi
#dtoverlay=hifiberry-amp
dtdebug=1

uncomment the line matching your Hifiberry ( only one, please.). dtdebug is optional and can be removed when everything is working well.

apt-get update && apt-get install alsa-utils alsa-tools \
  rpi-update libasound2-plugin-equal
pcm.!default {
 type plug
 slave.pcm plugequal;
}
ctl.!default {
 type hw card 0
}
ctl.equal {
 type equal;
}
pcm.plugequal {
 type equal;
 slave.pcm "plughw:0,0";
}
pcm.equal {
 type plug;
 slave.pcm plugequal;
 }

This is already the luxury version, as it incooperates an equalizer.

Following the original Instructions, we should be ready now. But there’s an issue left:

After reboot, you won’t see or hear anything. Hifiberry’s troubleshooting guide tells you to check the logs:

vcdbg log msg

..which will throw some lines complaning about missing Overlay files. Reason is simple: Overlay structure has recently been changed, and so-called Device tree overlays changed their naming scheme. Device tree utilities already search for the new name ( thing-overlay.dt ) but kernel comes with the old names ( thing.dto ). Or vice versa, I’m not exactly sure. Content of the files seems to be the same.

Let’s fix that. Go to /boot/overlays and change their names:

mv hifiberry-dac.dtbo hifiberry-dac-overlay.dtb
mv hifiberry-dacplus.dtbo hifiberry-dacplus-overlay.dtb
mv hifiberry-digi.dtbo hifiberry-digi-overlay.dtb
mv hifiberry-digi-pro.dtbo hifiberry-digi-pro-overlay.dtb

Btw.: this also affects all other hardware components like the GPIOs wich also use DTO’s.

Now it’s time to update Raspi’s firmware:

raspi-update

Afterwards you can reboot.

Check if the card is visible:

root@radio:/boot/overlays# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_amp], device 0: HifiBerry AMP HiFi tas5713-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Make some sound…

Usually, the mixer volume is set to a very low value, so you can’t hear anything. check alsa-mixer and set it to about 80%.

Now you could test everything with aplay some_music.wav. Keep in mind that the hifiberry can only cope with a small number of sample rates (44.1, 48, 96 and 192khz for the digi+). Some 8kz-mono wav-files won’t play.

Another idea would be to install mplayer ( apt-get install mplayer). Be warned: Mplayer needs quite a lot of deps.

One last thing: The equalizer. Simple: alsamixer -D equal.

Have Fun.