Skip to content

Configuring Raspbian for DAC

Dilshan R Jayakody edited this page Jan 15, 2020 · 15 revisions

This section of the documentation describes how to configure the DAC module in the Raspbian operating system. The steps mentioned below are tested on Raspberry Pi 3 Model B+ with Raspbian Buster (2019-07-10) release.

Before continuing these steps make sure that the J1 port is connected to Raspberry Pi and the DAC module is powered on. The connection layout for Raspberry Pi is illustrated and described in the Connectivity page of this documentation.

  1. Clone or download all three files at max2-audio-dac/RPi3-driver/ directory.
  2. Copy both "max3-dac-overlay.dtbo" and "max3-dac-overlay.dts" into home directory of Raspberry Pi (/home/pi).
  3. To update the "max3-dac-overlay.dtbo" file, issue the following command:

dtc -@ -H epapr -O dtb -o max3-dac-overlay.dtbo -Wno-unit_address_vs_reg max3-dac-overlay.dts

  1. Copy updated "max3-dac-overlay.dtbo" file into "/boot/overlays/" directory with following command:

sudo cp ./max3-dac-overlay.dtbo /boot/overlays/

  1. Open "/boot/config.txt" file using preferred text file editor and add the following line to the bottom of the file:

dtoverlay=max3-dac-overlay

  1. To disable the Raspberry Pi's built-in audio devices create "alsa-blacklist.conf" file in "/etc/modprobe.d" directory with the following entry:

blacklist snd_bcm2835

  1. To control the output volume, create ALSA softvol device configuration in the home directory (/home/pi) with the filename ".asoundrc" and copy all the contents of "asound.conf" into that file.

softvol configuration file

  1. After the above changes restart the Raspberry Pi. In next boot, the DAC is listed at the audio section as below:

MAX2 entry in Raspbian desktop

  1. You can also check the device availability with the following command:

aplay -l

APLAY device list result

Now DAC board is identified by the system and ready to use. To test the output use speaker-test with following parameters:

speaker-test -c2

To test the specific frequency use following parameters with speaker-test:

speaker-test -c2 -t sine -X -f 500

In the above command specify the required frequency into -f option.

To play an audio stream or MP3 clip uses mpg123 or any ALSA driver compatible application.