Difference between revisions of "BBB Audio Cape RevB Getting Started"

From eLinux.org
Jump to: navigation, search
(play and record audio)
 
(12 intermediate revisions by 5 users not shown)
Line 1: Line 1:
This guide is intended to walk through the basic instructions on how to get your Audio Cape working. If you have any question, please email support@circuitco.com.
+
This guide is intended to walk through the basic instructions on how to get your Audio Cape working. If you have any question, please email [mailto:support@circuitco.com support@circuitco.com].
  
  
Line 7: Line 7:
  
  
The instructions below are performed with following kernel and may vary for different kernel versions.
+
The instructions below are performed under following kernel and may vary for different kernel versions.
<code>
+
<syntaxhighlight lang="bash">
 
     root@beaglebone:~# uname -a
 
     root@beaglebone:~# uname -a
 
     Linux beaglebone 3.8.13-bone47 #1 SMP Fri Apr 11 01:36:09 UTC 2014 armv7l GNU/Linux
 
     Linux beaglebone 3.8.13-bone47 #1 SMP Fri Apr 11 01:36:09 UTC 2014 armv7l GNU/Linux
</code>
+
</syntaxhighlight>
 
==Load the device tree file==
 
==Load the device tree file==
 
Ensure your BBB is connected to the internet. Download the provided device tree file and decompress it. You may end up doing something like this:
 
Ensure your BBB is connected to the internet. Download the provided device tree file and decompress it. You may end up doing something like this:
<code>
+
<syntaxhighlight lang="bash">
 
     root@beaglebone:~# wget http://elinux.org/images/1/10/BB-BONE-AUDI-02-00A0.zip
 
     root@beaglebone:~# wget http://elinux.org/images/1/10/BB-BONE-AUDI-02-00A0.zip
 
     root@beaglebone:~# unzip BB-BONE-AUDI-02-00A0.zip
 
     root@beaglebone:~# unzip BB-BONE-AUDI-02-00A0.zip
</code>
+
</syntaxhighlight>
 
If you don't have unzip installed. Run as root:
 
If you don't have unzip installed. Run as root:
<code>
+
<syntaxhighlight lang="bash">
 
     root@beaglebone:~# apt-get update
 
     root@beaglebone:~# apt-get update
 
     root@beaglebone:~# apt-get install unzip
 
     root@beaglebone:~# apt-get install unzip
</code>
+
</syntaxhighlight>
 
Compile the device tree file and move it to /lib/firmware:
 
Compile the device tree file and move it to /lib/firmware:
<code>
+
<syntaxhighlight lang="bash">
 
     root@beaglebone:~# dtc -O dtb -o BB-BONE-AUDI-02-00A0.dtbo -b 0 -@ BB-BONE-AUDI-02-00A0.dts
 
     root@beaglebone:~# dtc -O dtb -o BB-BONE-AUDI-02-00A0.dtbo -b 0 -@ BB-BONE-AUDI-02-00A0.dts
 
     root@beaglebone:~# mv BB-BONE-AUDI-02-00A0.dtbo /lib/firmware
 
     root@beaglebone:~# mv BB-BONE-AUDI-02-00A0.dtbo /lib/firmware
</code>
+
</syntaxhighlight>
 
Since this Audio Cape uses the same audio signal from the onboard HDMI interface, you need to disable the audio portion of the HDMI by edit the uEnv.txt at /boot/uboot. Add this line to the uEnv.txt file:
 
Since this Audio Cape uses the same audio signal from the onboard HDMI interface, you need to disable the audio portion of the HDMI by edit the uEnv.txt at /boot/uboot. Add this line to the uEnv.txt file:
<code>
+
<syntaxhighlight lang="bash">
 
     optargs=capemgr.disable_partno=BB-BONELT-HDMI
 
     optargs=capemgr.disable_partno=BB-BONELT-HDMI
</code>
+
</syntaxhighlight>
  
 
Reboot your BBB. Log in and check the capemgr:
 
Reboot your BBB. Log in and check the capemgr:
<code>
+
<syntaxhighlight lang="bash">
 
     root@beaglebone:~# cat /sys/devices/bone_capemgr*/slots
 
     root@beaglebone:~# cat /sys/devices/bone_capemgr*/slots
 
         0: 54:PF---  
 
         0: 54:PF---  
Line 43: Line 43:
 
         5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
 
         5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
 
         6: ff:P-O-L Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN
 
         6: ff:P-O-L Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN
</code>
+
</syntaxhighlight>
 
Note that the "virtual cape" BB-BONELT-HDMIN is loaded instead of the BB-BONELT-HDMI. The difference between the two "capes" is that the BB-BONELT-HDMIN does not include the audio portion. Now load the DT file for Audio Cape:
 
Note that the "virtual cape" BB-BONELT-HDMIN is loaded instead of the BB-BONELT-HDMI. The difference between the two "capes" is that the BB-BONELT-HDMIN does not include the audio portion. Now load the DT file for Audio Cape:
<code>
+
<syntaxhighlight lang="bash">
 
     root@beaglebone:~# echo BB-BONE-AUDI-02 > /sys/devices/bone_capemgr*/slots
 
     root@beaglebone:~# echo BB-BONE-AUDI-02 > /sys/devices/bone_capemgr*/slots
 
     root@beaglebone:~# cat /sys/devices/bone_capemgr*/slots
 
     root@beaglebone:~# cat /sys/devices/bone_capemgr*/slots
Line 56: Line 56:
 
         6: ff:P-O-L Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN
 
         6: ff:P-O-L Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN
 
         7: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-BONE-AUDI-02
 
         7: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-BONE-AUDI-02
</code>
+
</syntaxhighlight>
 
The Audio Cape is now loaded.
 
The Audio Cape is now loaded.
  
 +
To make the Beaglebone load the cape every time:
 +
 +
<syntaxhighlight lang="bash">
 +
  root@beaglebone:~# nano /etc/default/capemgr
 +
</syntaxhighlight>
 +
 +
and add the following line
 +
 +
CAPE=BB-BONE-AUDI-02
 +
 +
Save and reboot and the DTBO for the cape will load each time it is booted.
  
 
==Play Audio Files==
 
==Play Audio Files==
 
Before playing an audio file, you may need to set the volume and configuration of the codec. Download the [https://raw.githubusercontent.com/CircuitCo/BeagleBone-Audio/files/asound.state asound.state] file to /etc/var/alsa.
 
Before playing an audio file, you may need to set the volume and configuration of the codec. Download the [https://raw.githubusercontent.com/CircuitCo/BeagleBone-Audio/files/asound.state asound.state] file to /etc/var/alsa.
<code>
+
<syntaxhighlight lang="bash">
 
     root@beaglebone:~# cd /var/lib/alsa
 
     root@beaglebone:~# cd /var/lib/alsa
 
     root@beaglebone:~# wget https://raw.githubusercontent.com/CircuitCo/BeagleBone-Audio/files/asound.state
 
     root@beaglebone:~# wget https://raw.githubusercontent.com/CircuitCo/BeagleBone-Audio/files/asound.state
</code>
+
</syntaxhighlight>
 
You may need to reboot your BBB (and load the Audio Cape DT file again if required).
 
You may need to reboot your BBB (and load the Audio Cape DT file again if required).
 
===Play a WAVE file===
 
===Play a WAVE file===
 
To play a WAVE file (say sample.wav), run:
 
To play a WAVE file (say sample.wav), run:
<code>
+
<syntaxhighlight lang="bash">
 
     root@beaglebone:~# aplay sample.wav
 
     root@beaglebone:~# aplay sample.wav
</code>
+
</syntaxhighlight>
  
 
===Record an audio input===
 
===Record an audio input===
 
To record an audio input, you can use a male-to-male audio cable to connect from an audio source (phone, lapotp, etc) to the audio input connector on the Audio Cape. Run the command below
 
To record an audio input, you can use a male-to-male audio cable to connect from an audio source (phone, lapotp, etc) to the audio input connector on the Audio Cape. Run the command below
<code>
+
<syntaxhighlight lang="bash">
     root@beaglebone:~# arecord -r 441000 -f S16_LE input.wav
+
     root@beaglebone:~# arecord -r 44100 -f S16_LE -c 2 input.wav
</code>
+
</syntaxhighlight>
 
Play the recorded file:
 
Play the recorded file:
<code>
+
<syntaxhighlight lang="bash">
 
     root@beaglebone:~# aplay input.wav
 
     root@beaglebone:~# aplay input.wav
</code>
+
</syntaxhighlight>
 +
 
 +
=Alsamixer controls that are active and work=
 +
alsamixer provides controls for *most* of the chip.  There are, however, only somethat matter and work. for recording and playback.
 +
 
 +
==Playback==
 +
 
 +
PCM - Sets the level of playback from recorded audio.
 +
 
 +
Line - When this is Green with QQ in the display the LIne Mixer is enabled.
 +
Line DAC - Sets Global Line output level
 +
Left Line Mixer DACL1 - When this is Green and has QQ displayed Left Line Output is enabled
 +
Left Line Mixer DACR1 - Sets Left Line output level (leave up full)
 +
Right Line Mixer DACL1 - When this is Green and has QQ displayed Right Line Output is enabled
 +
Right Line Mixer DACR1 - Sets Right Line output level (leave up full)
 +
 
 +
HP - When this is Green with QQ in the display the Headphone output is enabled.
 +
HP DAC - Global Headphone output level. (use this to set level of Headphones)
 +
Left HP Mixer DACL1 - When this is Green and has QQ displayed Left Headphone is enabled
 +
Left HP Mixer DACR1 - Sets Left Headphone output level (leave up full)
 +
Right HP Mixer DACL1 - When this is Green and has QQ displayed Right Headphone Output is enabled
 +
Right HP Mixer DACR1 - Sets Right Headphone output level (leave up full)
 +
 
 +
Left PGA Mixer Mic3L - When Green and has QQ displayed MIc3L is enabled (This is the Input setting for this Cape)
 +
Right PGA Mixer Mic3R -  When Green and has QQ displayed MIc3R is enabled (This is the Input setting for this Cape)
 +
 
 +
Falsely in playback-view:
 +
ADC HPF Cut-off - Enable / disable a (digital) high pass filter for capture (e.g. to remove DC offset)
 +
 
 +
==Capture==
 +
 
 +
PGA - Set Capture level (stereo or Mono)
 +
(This is the only control that works on Capture.)
 +
 
 +
[[Category:BeagleBoard]]
 +
[[Category:BeagleBoard Expansion Boards]]

Latest revision as of 06:34, 14 March 2015

This guide is intended to walk through the basic instructions on how to get your Audio Cape working. If you have any question, please email support@circuitco.com.


To purchase the Audio Cape please visit BoardZoo.com

To purchase the BeagleBone Black please visit BeagleBoard.org


The instructions below are performed under following kernel and may vary for different kernel versions.

    root@beaglebone:~# uname -a
    Linux beaglebone 3.8.13-bone47 #1 SMP Fri Apr 11 01:36:09 UTC 2014 armv7l GNU/Linux

Load the device tree file

Ensure your BBB is connected to the internet. Download the provided device tree file and decompress it. You may end up doing something like this:

    root@beaglebone:~# wget http://elinux.org/images/1/10/BB-BONE-AUDI-02-00A0.zip
    root@beaglebone:~# unzip BB-BONE-AUDI-02-00A0.zip

If you don't have unzip installed. Run as root:

    root@beaglebone:~# apt-get update
    root@beaglebone:~# apt-get install unzip

Compile the device tree file and move it to /lib/firmware:

    root@beaglebone:~# dtc -O dtb -o BB-BONE-AUDI-02-00A0.dtbo -b 0 -@ BB-BONE-AUDI-02-00A0.dts
    root@beaglebone:~# mv BB-BONE-AUDI-02-00A0.dtbo /lib/firmware

Since this Audio Cape uses the same audio signal from the onboard HDMI interface, you need to disable the audio portion of the HDMI by edit the uEnv.txt at /boot/uboot. Add this line to the uEnv.txt file:

    optargs=capemgr.disable_partno=BB-BONELT-HDMI

Reboot your BBB. Log in and check the capemgr:

    root@beaglebone:~# cat /sys/devices/bone_capemgr*/slots
        0: 54:PF--- 
        1: 55:PF--- 
        2: 56:PF--- 
        3: 57:PF--- 
        4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
        5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
        6: ff:P-O-L Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN

Note that the "virtual cape" BB-BONELT-HDMIN is loaded instead of the BB-BONELT-HDMI. The difference between the two "capes" is that the BB-BONELT-HDMIN does not include the audio portion. Now load the DT file for Audio Cape:

    root@beaglebone:~# echo BB-BONE-AUDI-02 > /sys/devices/bone_capemgr*/slots
    root@beaglebone:~# cat /sys/devices/bone_capemgr*/slots
        0: 54:PF--- 
        1: 55:PF--- 
        2: 56:PF--- 
        3: 57:PF--- 
        4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
        5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
        6: ff:P-O-L Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN
        7: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-BONE-AUDI-02

The Audio Cape is now loaded.

To make the Beaglebone load the cape every time:

   root@beaglebone:~# nano /etc/default/capemgr

and add the following line

CAPE=BB-BONE-AUDI-02

Save and reboot and the DTBO for the cape will load each time it is booted.

Play Audio Files

Before playing an audio file, you may need to set the volume and configuration of the codec. Download the asound.state file to /etc/var/alsa.

    root@beaglebone:~# cd /var/lib/alsa
    root@beaglebone:~# wget https://raw.githubusercontent.com/CircuitCo/BeagleBone-Audio/files/asound.state

You may need to reboot your BBB (and load the Audio Cape DT file again if required).

Play a WAVE file

To play a WAVE file (say sample.wav), run:

    root@beaglebone:~# aplay sample.wav

Record an audio input

To record an audio input, you can use a male-to-male audio cable to connect from an audio source (phone, lapotp, etc) to the audio input connector on the Audio Cape. Run the command below

    root@beaglebone:~# arecord -r 44100 -f S16_LE -c 2 input.wav

Play the recorded file:

    root@beaglebone:~# aplay input.wav

Alsamixer controls that are active and work

alsamixer provides controls for *most* of the chip. There are, however, only somethat matter and work. for recording and playback.

Playback

PCM - Sets the level of playback from recorded audio.
Line - When this is Green with QQ in the display the LIne Mixer is enabled.
Line DAC - Sets Global Line output level
Left Line Mixer DACL1 - When this is Green and has QQ displayed Left Line Output is enabled
Left Line Mixer DACR1 - Sets Left Line output level (leave up full)
Right Line Mixer DACL1 - When this is Green and has QQ displayed Right Line Output is enabled
Right Line Mixer DACR1 - Sets Right Line output level (leave up full)
HP - When this is Green with QQ in the display the Headphone output is enabled. 
HP DAC - Global Headphone output level. (use this to set level of Headphones)
Left HP Mixer DACL1 - When this is Green and has QQ displayed Left Headphone is enabled
Left HP Mixer DACR1 - Sets Left Headphone output level (leave up full) 
Right HP Mixer DACL1 - When this is Green and has QQ displayed Right Headphone Output is enabled
Right HP Mixer DACR1 - Sets Right Headphone output level (leave up full)
Left PGA Mixer Mic3L - When Green and has QQ displayed MIc3L is enabled (This is the Input setting for this Cape)
Right PGA Mixer Mic3R -  When Green and has QQ displayed MIc3R is enabled (This is the Input setting for this Cape)
Falsely in playback-view:
ADC HPF Cut-off - Enable / disable a (digital) high pass filter for capture (e.g. to remove DC offset) 

Capture

PGA - Set Capture level (stereo or Mono)
(This is the only control that works on Capture.)