Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hifiberry Digi #100

Closed
mragg opened this issue May 15, 2014 · 15 comments

Comments

@mragg
Copy link

commented May 15, 2014

I just tried my new Hifiberry Digi with musicbox .. but it did not work. Perhaps at the moment there ist only the Hifiberry-Dac-Module (?)
Is there anyone else with the new digi-module with some hints?

best regards,
Martin

@kingosticks

This comment has been minimized.

Copy link
Member

commented Jun 4, 2014

The musicbox kernel may not include the snd_soc_hifiberry_digi module. Have you tried running:
cat /lib/modules/uname -r/modules.dep | grep hifiberry
sudo modprobe snd_soc_hifiberry_digi ?

EDIT: I just came across this which was only merged 1st May so it might not have made it into the beta1 musicbox release

@enusbaum

This comment has been minimized.

Copy link

commented Jun 7, 2014

I can also confirm that the Hifiberry Digi doesn't work in the latest 5.0b1 image that's posted May 15th. I verified my installation using Hifiberry's test tone IMG which works. I guess we'll wait for them to push out a new version to support this.

@herpaderpaldent

This comment has been minimized.

Copy link

commented Jun 7, 2014

Good Day Sir/Mam

Please note, that we moved to our new E-Mail Address: felix.huber@impacthub.ch

Your Mail is being forwarded to the correct Address.

Yours Impact Hub Zürich - Team

@woutervanwijk

This comment has been minimized.

Copy link
Member

commented Jun 19, 2014

Could you test with the new 0.5 beta2?

@enusbaum

This comment has been minimized.

Copy link

commented Jun 20, 2014

Still doesn't seem to be working.

I saw the -517 error when trying to init the device, and removing i2c-bcm2708 from /etc/modprobe.h/raspi-blacklist.conf seemed to get things a little further along, but still not getting any audio from the Hifiberry Digi with the latest beta2. I'll continue to tinker

@enusbaum

This comment has been minimized.

Copy link

commented Jun 21, 2014

I think I figured it out.

First step (as stated above) was removing i2c-bcm2708 from the /etc/modprobe.h/raspi-blacklist.conf

Second, it would appear that the Coax and SPDIF outputs on the Hifiberry Digi enumerate as separate cards in ALSA:

card 1: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: sndrpihifiber_1 [snd_rpi_hifiberry_digi], device 0: HifiBerry Digi HiFi wm8804-spdif-0 []
  Subdevices: 0/1
  Subdevice #0: subdevice #0

It would appear that setting the output device in PiMusicBox to "i2s" default /etc/asound.conf card to "1", which would work if I were using the coax output on the Hifiberry.

After booting PiMusicBox, I manually edit the /etc/asound.conf "card" value to "2" and force a reload of ALSA by executing "alsa force-reload" which then enables SPDIF output via the Hifiberry.

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

This solution will enable SPDIF output for PiMusicBox. I think we'll need to add a new configuration option to expand "i2s" to perhaps be "i2s-card1" and "i2s-card2" to support devices properly like the Hifiberry Digi, because for the time being, it will reset to "1" upon reboot.

Hope this helps! 👍

@augustus82

This comment has been minimized.

Copy link

commented Jun 22, 2014

Hi,

Thanks for providing help with Pi Musicbox using Hifiberry Digi. Unfortunately, I still can't get it to work though.

First of all, I did exactly as you said: I removed the i2c-bcm2708 from the /etc/modprobe.d/raspi-blacklist.conf and I get the same output when typing a play -l as you (2 different cards).

I am using the Coaxial output. Sound does not work however, when playing a song I get the following error on screen:

   [126.166435] bcm2708-i2s bcm2708-i2s.0: I2S SYNC error!

I have tried putting the commands EOS and SYNC in the /etc/modules file as advised by the Hifiberry Digi Software Installation guide found here: http://www.hifiberry.com/products/digi-connect-your-external-dac/hifiberry-digi-software-installation/ but to no avail.

Hope you can help find a solution.

@enusbaum

This comment has been minimized.

Copy link

commented Jun 22, 2014

Well, this appears to be an issue with how PiMusicBox scans for Hifiberry devices. In the file setsound.sh (https://github.com/woutervanwijk/Pi-MusicBox/blob/a5c0cddadbb9a73224088dff10edf9b5f9460f9c/filechanges/opt/musicbox/setsound.sh), it only looks for a device that identifies itself as a Hifiberry DAC and associates that with the "i2c" output option. The "i2c" option probably needs to be extended to be "i2c-dac" and "i2c-digi" to support both distinct devices.

Although I was only testing using a TOSLINK cable, I hooked up the hifiberry to my DAC using coax this morning and was able to get audio from it. In both cases, you'll need to set your card to the SPDIF card listed in aplay -l. Both the coax and TOSLINK output of the hifiberry are treated as a single output.

So, for my example above, for both output types from the Hifiberry Digi (Coax & TOSLINK) you'll need to manually set the card value to "2" in /etc/asound.conf after boot then do a "alsa force-reload".

I also found commenting out "snd_soc_hifiberry_dac" in the /etc/modules file removed a device from alsa that I would venture was being misidentified as a DAC, but then that breaks the PiMusicBox configs.

If the above isn't working for you, download the test image from hifiberry to verify that your Hifiberry Digi is installed correctly.

http://www.hifiberry.com/guides/sd-card-images/

This will help identify that your hardware is working properly in the first place 👍

Cheers!

@augustus82

This comment has been minimized.

Copy link

commented Jun 23, 2014

Hey,

Thanks for your excellent advice, I got it working now! yey

Now all we need is for Pi Musicbox to keep this setting even after rebooting. Simply set the SD-card to read-only after modifying the file does not work ;) Your optional solution sounds logical: two distinct devices and then one of them loaded with initial boot.

Cheers!

@woutervanwijk

This comment has been minimized.

Copy link
Member

commented Jun 25, 2014

I cannot test this, since I don't have a Digi. If someone would update the script I can integrate it in MusicBox.

@ulph

This comment has been minimized.

Copy link

commented Jun 25, 2014

I can confirm (again) that the above steps works.

Why is /etc/asound.conf changed on reboot?

Also, I'm happy to muck about and see if I can fix the enumeration. Where should I get started on that?

@woutervanwijk

This comment has been minimized.

Copy link
Member

commented Jun 29, 2014

The enumeration is done in /opt/musicbox/setsound.sh It could be as simple as changing the lines from 34 to this:
case ${dev[0]} in
platform)
if [[ ${dev[1]} == "bcm2835"* ]]; then
INT_CARD=$num
log_progress_msg "found internal device: card$INT_CARD" "$NAME"
if tvservice -s | grep -q HDMI; then
log_progress_msg "HDMI output connected" "$NAME"
HDMI_CARD=$num
fi
elif [[ ${dev[1]} == "snd-hifiberry-dac" ]]; then
I2S_CARD=$num
log_progress_msg "found i2s device: card$I2S_CARD" "$NAME"
fi
elif [[ ${dev[1]} == "snd-hifiberry-digi" ]]; then
I2S_CARD=$num
log_progress_msg "found i2s device: card$I2S_CARD" "$NAME"
fi

;;

Only the switch between TOS and coax is a bit more tricky I guess
But I cannot test it...

@Foxtur

This comment has been minimized.

Copy link

commented Jul 16, 2014

Just to confirm the changes in /opt/musicbox/setsound.sh worked perfectly for me.
Thx

@augustus82

This comment has been minimized.

Copy link

commented Jul 25, 2014

If I connect using Toslink, it does produce sound. Coax, however, still does not work.

@h0lger

This comment has been minimized.

Copy link

commented Aug 3, 2014

I did another approach, in my asound.conf the default card was 1. I didn't wan't to change this file because it will be overwtitten on every reboot. With aplay -l my hifiberry digi was card 2, so my solution was to get the digi at card 1 instead. At card 1 the hifiberry dac was loaded, so i simply removed the dac from /etc/modules. And now my digi is at card 1 and works fine.

But some improvement should be done to skip this "hack".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
9 participants
You can’t perform that action at this time.