CircuitCo talk:Audio Cape RevB

Jump to: navigation, search


Thread titleRepliesLast modified
TLV320aic3104 Programming116:59, 1 September 2015
Eagle Design Files - error with schematic111:58, 5 March 2015
aplay .wav file synchronization issues011:58, 11 September 2014
Audio Cape instructions518:50, 27 May 2014

TLV320aic3104 Programming

Sorry if this is an improper place to ask this but as you've done it successfully hopefully you can answer it. What did you do to program the TLV320, I've tried the following:

var i2c = require('i2c-bus');
var async = require('async');

var DSP_ADDR = 0x18;

var bus = i2c.openSync(1);

function writeAndRespond(port, address, value, done) {
  bus.writeByte(port, address, value, function(error){
      return done(error);
    bus.readByte(port, address, function(error, result){
        return done(error);
      console.dir("0x" + (address).toString(16) + " is 0x" + result.toString(16));


  // Select Page 0
    writeAndRespond(DSP_ADDR, 0x00, 0x00, cb);
  // Software Reset
    writeAndRespond(DSP_ADDR, 0x01, 0x01, cb);
  // Route Line1LP to the Left ADC, Power up the left ADC
    writeAndRespond(DSP_ADDR, 0x13, 0x04, cb);
  // Route Line1RP to the Right ADC, Power up the Right ADC
    writeAndRespond(DSP_ADDR, 0x16, 0x04, cb);
  // Unmute the left PGA, set gain to 0 dB
    writeAndRespond(DSP_ADDR, 0x0F, 0x00, cb);
  // Unmute the right PGA, set gain to 0 dB
    writeAndRespond(DSP_ADDR, 0x10, 0x00, cb);

    writeAndRespond(DSP_ADDR, 0x20, 0x02, cb);
], function(error){
    console.log('Got error ' + error.message);

This doesn't seem to enable the Mic's correctly even when I enable Mic3R and Mic3L and I have a valid audio signal in lin2L on my board. Everything else on the dsp appears functional as dout (pin 5) appears to have a valid singal when recording. Oh and note the clock is set to 12Mhz and is reading that out when recording with arecord using a fast logic analyzer. Thanks for any help.

Note: I have no audio output on this board just input.

Paullryan (talk)15:15, 1 September 2015

This is an appropriate place to ask. However, you'll get faster support by posting this question to the beagle mailing list with appropriate links back to this page.

Wmat (talk)16:59, 1 September 2015

Eagle Design Files - error with schematic

I'm currently involved in a project that requires me to record multiple channels of audio. I was going to jump the unused pins out the TLV320AIC3104 to another board and attempt to map them in my device tree overlay.

In an attempt to check which audio inputs the cape is using I consulted the schematic to find that pins 14 and 16 of the TLV320AIC3104 are being used which are LINE2L and LINE2R respectively. However when I compare that to the board design file I can clearly see that PINS 10 and 14 are actually being used which are LINE1LP and LINE2L. It would appear that PIN 16 (LINE2R) dead ends. Now I am really confused as I would expect LINE1 L&R to be together and LINE2 L&R to be together.

If anyone could explain what I am missing or if there really is an error that would be appreciated.

Bglazierjr (talk)15:28, 27 February 2015

Sorry, I was mistaken. The datasheet shows the pin orientation from the bottom of the package and I am coming from the top so now it all makes sense!

Bglazierjr (talk)11:58, 5 March 2015

aplay .wav file synchronization issues


Basically the audio cape is working. Except for one strange phenomena that mistifies me. I will try to explain.

When I play a .wav file for example speaker-test -t vaw -> if lucky I hear Front Left - Front right as one expects. But 9 out of 10, I hear white noise with the audio front left front right very faint in the background or at another time the sound is simply distorted. The same happens when I play a file with aplay or mplayer.

So when I am lucky, or timing with respect to system clock is in sync I hear the audio clearly, if out of sync it might me white noise or distorted playback.

I have google extensively and have not found any solution. So I hope one of you guys knows whats happening here. It has to be something low level.

I'm quite a newby in this matter but acording to this: all seams to work ok.

These are my system parameters and settings: root@beaglebone:~# lsb_release -a Distributor ID: Angstrom Description: Angstrom GNU/Linux v2012.12 (Core edition) Release: v2012.12 Codename: Core edition

root@beaglebone:~# cat /sys/devices/bone_capemgr*/slots 0: 54:PF---

1: 55:PF--- 
2: 56:P---L CBB-Relay,00A0,Logic_Supply,CBB-Relay
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

root@beaglebone:~# speaker-test -t wav

speaker-test 1.0.25

Playback device is default Stream parameters are 48000Hz, S16_LE, 1 channels WAV file(s) Rate set to 48000Hz (requested 48000Hz) Buffer size range from 128 to 32768 Period size range from 8 to 2048 Using max buffer size 32768 Periods = 4 was set period_size = 2048 was set buffer_size = 32768

0 - Front Left

Time per period = 0.641097

0 - Front Left

root@beaglebone:~# mplayer AxelF.wav MPlayer2 2.0-379-ge3f5043 (C) 2000-2011 MPlayer Team 162 audio & 361 video codecs

Playing AxelF.wav. Detected file format: WAV format (libavformat) [wav @ 0xb6082780]max_analyze_duration reached [lavf] stream 0: audio (pcm_s16le), -aid 0 Load subtitles in .


Forced audio codec: mad Opening audio decoder: [pcm] Uncompressed PCM audio decoder AUDIO: 44100 Hz, 2 ch, s16le, 1411.2 kbit/100.00% (ratio: 176400->176400) Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)


AO: [alsa] 44100Hz 2ch s16le (2 bytes per sample) Video: no video Starting playback... A: 1.6 (01.6) of 15.9 (15.8) 0.3%

MPlayer interrupted by signal 2 in module: unknown

Exiting... (Quit)

Rtuin (talk)11:56, 11 September 2014

Audio Cape instructions

These instructions got the audio cape working for me using the latest 4-23-2014 Debian Image from (Audio levels are still low so need to add instructions for fixing that. TBD)

Instructions are from this thread:!topic/beagleboard/81TsiNp4Bok

Step 1 copy the audio device tree overlay (source) to /lib/firmware

Step 2 compile the device tree overlay - good instructions here dtc -O dtb -o BB-BONE-AUDI-02-00A0.dtbo -b 0 -@ BB-BONE-AUDI-02-00A0.dts

Step 3 nano /boot/uboot/uEnv.txt

Remove the # from in front of this line Note: you only need to disable BB-BONELT-HDMI. BB-BONELT-HDMIN will not conflict with your audio cape.


Step 4 export SLOTS=/sys/devices/bone_capemgr.*/slots echo BB-BONE-AUDI-02 > $SLOTS

Audio now works

Tests for audio (need to add mixer volume changes, levels are defaulted LOW): speaker-test arecord -r 44100 -c 1 -f S16_LE -t wav -vv -d 25 example.wav aplay example.wav

JesseForgues (talk)09:44, 16 May 2014

Instead of Step 4 above you can add the following line - CAPE=BB-BONE-AUDI-02 to file /etc/defaults/capemgr and it will then get automatically loaded, not exactly at bootup but very very soon after boot. If you want to add further capes (I also have a GPIO add-on) then these can be included on the same CAPE line with commas separating each one.

There is an error (or at least an inconsistency) on the pdf ciruit diagram. The audio inputs are labeled as LINE1LP and LINE1RP which would lead one to turn on the LINE1 L/R inputs in alsamixer but you get either nothing or very low level breakthrough (depends on PGA gain setting). In fact these inputs actually connect to the LINE2L and LINE2R (pins 14,16) on the chip. One might thus expect to turn on LINE2 inputs in alsamixer but unfortunately another problem arises. Alsamixer see this chip as a DA830 and though many things on this cape's chip (3104) are the same; the register (17) within the 3104 for LINE2 is accessed on the DA830 by alsamixer's MIC3-LINE3L and MIC3-LINE3R. This means that you need to turn on "Left PGA Mixer Mic3L" and "Right PGA Mixer Mic3R" in alsamixer to get the correct inputs connected. Line level inputs will then record and playback. If you were using lower level input signals you could increase the "PGA [dB Gain ...] which I leave set at 0dB.

Alsamixer shows many functions that are not useable on this cape and does mix up the Capture and Playback items so I suggest pressing F5 to show "ALL". These are the settings I have turned ON (everything else OFF or set to 0) to get line level inputs and line level outputs.

PCM (max level); HP; HP DAC (max level); Left HP Mixer DACL1; Left PGA Mixer Mic3L; PGA [db Gain ...] (set to 0dB); Right HP Mixer DACR1; Right PGA Mixer Mic3R.

Note that you can also sent Mic3L to the Right mixer and vice-versa so you could create mono mixes.

Hope the above helps someone save a few days of pulling out their hair.

Robert Leacroft (talk)04:01, 20 May 2014


we are collecting the community instructions and feedback now. we will combine the info into a new wiki page with instructions.

thanks for the info


Prpplague (talk)11:45, 22 May 2014

Thanks Robert!

Hopefully CircuitCo gets the wiki updated, your notes are essential to getting line input working.

JesseForgues (talk)17:54, 27 May 2014

Here is the rest of my notes using Roberts notes:

Audio now works, but levels are low so lets fix that:

amixer set PCM 0dB

amixer set 'Right PGA Mixer Mic3R' on

amixer set 'Left PGA Mixer Mic3L' on

Also to make this persistent across reboots add:


nano /etc/default/capemgr

Useful tests for audio:

speaker-test -t sin 400

arecord -r 48000 -c 2 -f S16_LE -t wav -vv -d 25 example.wav

aplay example.wav

JesseForgues (talk)18:16, 27 May 2014


If you want to restore alsa mixer defaults:

alsactl restore

Pass audio from In to Out (needs gain level fixes):

amixer set 'Right HP Mixer PGAR Bypass' on

amixer set 'Left HP Mixer PGAL Bypass' on

JesseForgues (talk)18:50, 27 May 2014