charlietango_22
Posts: 28
Joined: Sun Feb 25, 2018 9:34 pm

[SOLVED] - Sound - unusual behaviour (PIFI DAC+ v 2.0)

Sun Feb 25, 2018 9:49 pm

Hello,
I'm looking for some help 'cause I'm getting a bit frustrated on this... :-(

I have a headless Raspberry PI 3 with a PiFi DAC+ audio card, basically an HiFiBerry clone. On the PI I installed mpd and mpc as a client. On top of those I wrote a python script that invokes some mpc commands to control the underlying mpd daemon (load a playlist, play a stream).

Now the issue.
The overall audio setup based on the hifiberry-dacplus overlay works well, the sound is good and I'm fine with it. Mpc & mpd work, I can control all the functionalities of mpd (at least the ones I need) through mpc without a flaw...but, if I try to run my python script suddenly I cannot hear anything anymore, even if no specific errors are traced.

The 'scary' thing is that, after aborting the script execution, I'm no more able to play any sound (I tried with several wav files using aplay), and again no specific errors show up in the log files...looks like someone just 'muted' the volume, but `alsamixer` shows all playback levels to 100%. I need to reboot the PI to get my sound back.

I checked for clues in the usual places:

- /var/log/messages
- /var/log/syslog
- dmesg
- boot.log
- /var/log/mpd/mpd.log

I also run aplay -vvv when audio was blocked and compared the output with a session where audio was running fine but I didn't notice any difference...

I know it would be very difficult to diagnose the problem without having access to my system, but do you have any ideas on where else to look to understand if something went wrong?

Just for info, here's my `aplay -l` output:

Code: Select all

**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dacplus], device 0: HiFiBerry DAC+ HiFi pcm512x-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
Thank you!
Michele
Last edited by charlietango_22 on Tue Feb 27, 2018 6:55 am, edited 1 time in total.

charlietango_22
Posts: 28
Joined: Sun Feb 25, 2018 9:34 pm

Re: Sound - unusual behaviour (PIFI DAC+ v 2.0)

Mon Feb 26, 2018 10:06 pm

UPDATE:

Seems like there is some incompatibility between the audio board and a 16x2 LCD display I'm using to show the name of the stream I'm playing. The display is a very common one, based on the HD44780 chip.

My code uses the AdaFruit python library available here to drive it and I still have to figure where the problem is: the audio board, as per HiFiberry docs is connected through GPIO 2,3,18,19,20,21 (plus ground & +5V for power), so it shouldn't cause any conflict with the LCD which uses different pins, but I wouldn't bet on it.

Anyway, removing the LCD management part from the python code (but leaving the display physically attached to the Raspberry pins) apparently solved the problem...

I'll keep this question updated, maybe could be useful for someone else, who knows!

charlietango_22
Posts: 28
Joined: Sun Feb 25, 2018 9:34 pm

Re: Sound - unusual behaviour (PIFI DAC+ v 2.0)

Tue Feb 27, 2018 6:55 am

SOLVED!

Ok, I got it. As usual, I just went too fast with CTRL-C & CTRL-V without properly reading the code...

I didn't notice I left this statement in my python code

Code: Select all

lcd_backlight = 2 #GPIO pin to control lcd backlight
Actually The GPIO 2 (which is one of the two I2C enabled pins on the Raspberry) is not connected to the LCD, but it is used by the audio board for configuration purposes: this way, whenever I tried to initialize the LCD, the audio board was somehow reconfigured, making it "mute". The only way to reset the faulty configuration was to reboot the PI itself.

Just leaving the default 'None' value for the backlight control pin (I do not need it) did the trick.

Return to “Graphics, sound and multimedia”