Distorted audio on DAC+

I have a bit of a different setup, but hoping I might still be able to get some help here.  I bought a CarPiHAT recently that includes a PCM 5122 DAC chip on it.  The instructions for setting it up with the Pi call for using the HiFiBerry DAC+ dtoverlay, so I'm trying to treat it the same as I would if it was a standalone HiFiBerry unit.  My setup is intended to be something like an infotainment system in a modern car.  I've been struggling for a few days now trying to fix audio issues I've been having.  My config is using the latest Raspbian release (Bullseye) on a RPi 3B+.

When I first tried testing the sound output I was getting nothing, but then found out that the DAC was sharing some of the GPIO I was trying to use for a rotary encoder volume knob (documentation on the CarPiHAT didn't mention what GPIO pins the DAC used).  I disabled my script and managed to get sound out, but it was crackly, slow, and distorted.  I realized I forgot to unplug the rotary encoder as well, which would have been putting ground or 3.3v through a 10k resistor onto GPIO pins 16 and 20.  This seems to have fixed most of the crackle issue at least, but the sound is still very distorted.  I think it's playing at the correct speed now, but it seems like it has been pitch shifted down and in general just doesn't sound good.  Is there a chance I damaged the chip when I still had the rotary encoder attached?  I was originally using VLC for playback, but it was stuttering so I tried MPlayer instead.  It played smoothly, but still distorted.  I tried removing pulseaudio, but that doesn't seem to have helped.  I also found I could configure the VLC output to a specific device, which fixed the stuttering issue, but it has the same distortion going on.  Any idea what to try next?  I'm pretty well locked into running Raspbian because of all the other stuff my setup is doing, so I don't really think other OSes are in the cards.  I might be able to test with one at least to make sure the unit is okay, but ultimately I need a solution that will work with Raspbian.

1 comment

Please sign in to leave a comment.