CircuitCo talk:Audio Cape RevB

From eLinux.org
Jump to: navigation, search

Contents

Thread titleRepliesLast modified
aplay .wav file synchronization issues018:58, 11 September 2014
Audio Cape instructions501:50, 28 May 2014

aplay .wav file synchronization issues

Hi,

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

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 .

==============================================================[edit]

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)

==============================================================[edit]

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)18: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 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.

optargs=capemgr.disable_partno=BB-BONELT-HDMI

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)16: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)11:01, 20 May 2014

Robert,

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

Dave

Prpplague (talk)18:45, 22 May 2014
 

Thanks Robert!

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

JesseForgues (talk)00:54, 28 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:

CAPE=BB-BONE-AUDI-02 to:

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)01:16, 28 May 2014

Also:

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)01:50, 28 May 2014