CircuitCo talk:Audio Cape RevB
|Thread title||Replies||Last modified|
|Eagle Design Files - error with schematic||0||22:28, 27 February 2015|
|aplay .wav file synchronization issues||0||18:58, 11 September 2014|
|Audio Cape instructions||5||01:50, 28 May 2014|
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.
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: http://www.troubleshooters.com/linux/sound/sound_troubleshooting.htm 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
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
These instructions got the audio cape working for me using the latest 4-23-2014 Debian Image from Beagleboard.org. (Audio levels are still low so need to add instructions for fixing that. TBD)
Instructions are from this thread: https://groups.google.com/forum/#!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 https://learn.adafruit.com/introduction-to-the-beaglebone-black-device-tree?view=all#compiling-an-overlay 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
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.
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
Hopefully CircuitCo gets the wiki updated, your notes are essential to getting line input working.
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:
Useful tests for audio:
speaker-test -t sin 400
arecord -r 48000 -c 2 -f S16_LE -t wav -vv -d 25 example.wav