Raspberry Pi Zero W + Buildroot + Pimoroni Phat DAC

Hello. I have a Raspberry Pi Zero W with the Pimoroni Phat DAC.

It’s working fine on Debian Jessie, using the Pimoroni PhatDAC bash installer.
But, I’m moving on to a leaner Buildroot compiled Linux, and I just cannot get it to work there, it’s the exact same device, I’m simply swapping SD cards.

The problem is that Alsa won’t show me any sound cards in either /proc/asound or in /dev/snd.

I’m quite confused because the modules that are shown in the working Jessie linux don’t match with the Pimoroni Phat Dac guide. The working Jessie shows me that the following modules are loaded:

snd_soc_hifiberry_dac
snd_soc_bcm2835_i2s
regmap_mmio
snd_soc_pcm5102a
spi_bcm2835
bcm2835_wdt
bcm2835_gpiomem
snd_soc_core
snd_pcm_dmaengine
snd_pcm
snd_timer
snd

Not in this list are the i2c-bcm2708, snd-soc-pcm512x and snd-soc-wm8804 from the guide. I get no sound card devices when I load the same modules in the Buildroot linux or when I load the ones from the guide.

My config.txt file has:
dtparam=i2c_arm=on
dtparam=spi=on
dtoverlay=hifiberry-dac

I have not specified i2s (not in the guide, nor on the working Jessie) and dtparam=audio=on is removed.
I have not created any Alsa config files, but that shouldn’t make any difference in this case, right?
Do any of these modules need parameters? Could it be that I’m loading them to late in the boot process?

Any clues to the root cause of this problem, or any tips on things I could check?

Solution: Copy hifiberry-dac.dtbo to boot/overlays
This is not done by the installer. I guess most Raspberry Pi installations have this overlay folder here, but not all.
I copied the overlays from another Raspberry Pi boot folder; I have not yet figured out the official source yet…

If anyone from Pimoroni is watching, perhaps add this to the installer, or at least a check on the presence, so you can give out a warning/instructions.

I’ve been trying to replicate this but I haven’t had complete success so far.

I managed to build a buildroot image using the SnapOS project from the clever Snapcast folks, my rpi zero (not W, basic rpi zero) boots and gets wifi and I can SSH into it, but I can’t get any sound to come out of the Phat DAC.

One thing worth mentioning, as I wanted to test this before soldering the Phat DAC to the Raspberry Pi zero, the Phat DAC is not soldered onto the headers but sandwiched between a male header soldered to the Pi below and a female header above. (pi <–> male header <–> Phat Dac <–> female header (to male on the other side).
I’m pretty sure this is ensuring contact on the pads of the DAC, but I’m still wondering if that could be the issue :/

Software-wise, I have checked and the right overlay is defined in the config.txt and hifiberry-dac.dtbo exists in /boot/overlays.
I also have disabled the onboard audio by commenting #dtparam=audio=on in /boot/config.txt

I can see the overlay being loaded in the logs:
vcdbg log msg

001511.493: brfs: File read: /mfs/sd/overlays/hifiberry-dac.dtbo
001522.519: Loaded overlay 'hifiberry-dac'
001522.547: dtparam: i2c_arm=on
001533.100: dtparam: spi=on

The Phat DAC appears in alsa’s list of devices:

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

aplay -L:

null
    Discard all samples (playback) or generate zero samples (capture)
sysdefault:CARD=sndrpihifiberry
    snd_rpi_hifiberry_dac, 
    Default Audio Device

And I have a alsa conf:

/etc/asound.conf

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

But alsamixer tells me that This sound device does not have any controls. for snd_rpi_hifiberry_dac.

Also, i2cdetect -lthrows a i2cdetect: can't open '/sys/class/i2c-dev': No such file or directory but I don’t know if that really matters or not.

Any clues?

And @Stu, thanks for the info you provided here. If you have any pointers here, I would really appreciate them! (right now, you remind me a bit of this XKCD ;)).

If it isn’t soldered, then that will be the issue, almost certainly.

Thanks for the advice Sandy, will try that and report back.

Haha, yeah I remember that XKCD. These days I use my own Buildroot Linux instead of Debian. Looking at your output I’d say you’re almost there, software wise. The fact that you see card 0: sndrpihifiberry means that the kernel has picked up on the hardware. A few pointers:

(pi <–> male header <–> Phat Dac <–> female header (to male on the other side).

But you did solder the male and female headers, right? That’s a must.

But alsamixer tells me that This sound device does not have any controls. for snd_rpi_hifiberry_dac .

This is normal. The DAC doesn’t have any controls.

Also, i2cdetect -l throws a i2cdetect: can't open '/sys/class/i2c-dev': No such file or directory but I don’t know if that really matters or not.

This is probably not a problem, I’ll dust off my working Pi Zero to see what mine says.

What are you using to create the music/audio signal? It may not be using the audio output.

Thanks for coming to my rescue! ;)

What should be playing (and is, I can tell when I start it manually) is snapclient, Snacpast’s well… client. It picks up the stream from my snapserver and plays it. But no sound.
I’ve also copied a wave file to the rpi zero and tested it with play -vv file.wav but no sound, although I can see alsa decoding it fine.
Finally, I’ve tested with speaker-test -Dplug:sysdefault, and according to aplay -L, that’s the DAC.

Thanks a lot for this bit, I can stop franctically checking alsa-mixer from now on.

The male header is soldered to the rpi zero (I’m going to rework some of the connections, they could be better) and the female header sandwiching the Phat DAC is not. I wanted to check before soldering to the scroll phat (trying to go the less “permanent” way described by @sandyjmacdonald in his guide), but given Sandy’s advice and yours, I’m clearly starting to think this was a mistake. I’m getting the soldering iron out tonight.