Beaglebone+USB speakers: choppy sound. Kernel update helps?

Hi,

I connected my Beaglebone to USB speakers and now I’m able to playback mp3s. Unfortunately the sound is very choppy.
I’m using Ubuntu 12.04 and Robert Nelson’s 3.2.0-psp1 kernel.

This might be a non-Beagle issue and I already asked for advice here. But reading through the commit logs I think a kernel update might be worth a try. What is the easiest way to get a newer kernel? Are there any pre-compiled kernels available, is there a repository or should I cross-compile them myself? And which version is currently recommended for the Beaglebone?

Thanks for any advice!
Armin

Hi,

I connected my Beaglebone to USB speakers and now I'm able to playback mp3s.
Unfortunately the sound is very choppy.
I'm using Ubuntu 12.04 and Robert Nelson's 3.2.0-psp1 kernel.

A few upgrades. :wink:

wget http://rcn-ee.net/deb/precise-armhf/v3.2.17-psp12/install-me.sh
/bin/bash install-me.sh

Will get you the latest image i'm pushing to beaglebone ubuntu/debian users.

This might be a non-Beagle issue and I already asked for advice here. But
reading through the commit logs I think a kernel update might be worth a
try. What is the easiest way to get a newer kernel? Are there any
pre-compiled kernels available, is there a repository or should I
cross-compile them myself? And which version is currently recommended for
the Beaglebone?

It's based on the unified tree:
https://github.com/beagleboard/kernel/tree/beaglebone-3.2

Regards,

Thanks for the fast reply! The script updated my kernel to 3.2.17-psp12.

Unfortunately it didn’t solve my problems with mp3 or wav replay.
“top” showed me mplayer/mpg123 demand about 15% CPU usage. During playback kworker suddenly wants 83% and more. So it may be a performance issue.

top - 14:11:59 up 23 min, 2 users, load average: 0.16, 0.06, 0.09

Tasks: 67 total, 2 running, 65 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.9%us, 96.1%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 251572k total, 62720k used, 188852k free, 9232k buffers
Swap: 0k total, 0k used, 0k free, 37040k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
929 root 20 0 0 0 0 R 94.7 0.0 0:08.24 kworker/0:1
928 armin 20 0 3212 1328 1024 S 3.3 0.5 0:00.34 mpg123
927 armin 20 0 2028 988 760 R 0.7 0.4 0:00.20 top
38 root 20 0 0 0 0 S 0.3 0.0 0:00.26 kworker/u:1
1 root 20 0 3108 1464 976 S 0.0 0.6 0:02.52 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:00.21 ksoftirqd/0
6 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 cpuset

I then found this discussion: https://github.com/RobertCNelson/linux-dev/issues/2

Did the CONFIG_MUSB_PIO_ONLY=Y option made it into the 3.2.17 kernel?

best,
Armin

what device are you using to output audio "plughw" or "hw" and what
rate are you using? you want to use "hw" versus "plughw" to avoid
having ALSA do any interpolation/decimation to meet the sampling rate
you want for your audio. Also there's is a bug in using 32kHz for
sampling rate, even though the codec supports it, I found 16kHz to be
an ideal sampling frequency when using the "hw" device.

al fayez

Yeah, BeagleBone support is only in the "am33x-v3.2" branch of the
"linux-dev" repo...

cd linux-dev
git checkout origin/am33x-v3.2 -b am33x-v3.2

Regards,

Hi

I did follow the same steps to rebuild my kernel in order to make my USB
sound card work without stuttering, and that seems to work perfectly now. I
did one thing differently, though: I set

CC=arm-linux-gnueabihf-

in system.h

The problem I have is that the CPU is running slower than before:

ubuntu@omap:~$ cpufreq-info
cpufrequtils 007: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
driver: omap
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: 300 us.
hardware limits: 500 MHz - 600 MHz
available frequency steps: 500 MHz, 600 MHz
available cpufreq governors: conservative, ondemand, powersave, userspace,
performance
current policy: frequency should be within 500 MHz and 600 MHz.
The governor "ondemand" may decide which speed to use
within this range.
current CPU frequency is 500 MHz.
cpufreq stats: 500 MHz:nan%, 600 MHz:nan%

The only available frequency steps are 500MHz and 600MHz (the board is NOT
usb-powered). Before I had many more available steps, ranging from 270MHz to
720MHz.

Yeap, 270MHz is broken for many users.. (Actually according to ti's
am335x manual, it's suppost to be disabled when ever using the
Ethernet port.. It works fine on my A2/3/5 BeagleBone) and disabling
720Mhz was the only way i could get one user's A5 to work correctly...
So for the time being till we figure more of these out, I'm playing it
safe with my kernel and disabling those two..

for the record, the kernel I'm running now is

ubuntu@omap:~$ uname -a
Linux omap 3.2.18-psp14 #1 Sat Jun 9 23:01:20 CEST 2012 armv7l armv7l armv7l
GNU/Linux

So, is there something I can do about that? I did look around randomly in
the configuration files on /boot/, but couldn't find anything. 600 MHz is
fast enough for me now, but it would still be nice to utilize the full power
of the CPU.

You can easly disable the patch and rebuild the kernel.. (i've taken
99% of the work out of rebuilding it.. :wink: )

https://github.com/RobertCNelson/linux-dev/tree/am33x-v3.2

For 720Mhz: disable this patch "#"
https://github.com/RobertCNelson/linux-dev/blob/am33x-v3.2/patch.sh#L1291

For 275Mhz: disable this patch "#"
https://github.com/RobertCNelson/linux-dev/blob/am33x-v3.2/patch.sh#L1285

Since it worked before on your board it should be fine, but if anyone
else reading this board no longer boots, that's why they are
disabled..

Regards,

I disabled the patches, and now I have the 270MHz and 720MHz options back :). One thing I noticed though is that the switching between cpu frequencies is too slow. When streaming webcam using mjpg-streamer and playing mp3 at the same time (just to test the performance) the music and webcam stream slow down for a few seconds, then the frequency goes to 500MHz and everything is fine for a few seconds… until it goes back to 270MHz for a few feconds and so on. Setting the frequency governor to performance makes everything work perfectly, but consumes a few milliamps extra (about 50mA difference on the 5V input when idle).

Is this a known problem? Maybe I should change board-am335xevm.c so that only the 500MHz option is enabled when usb-powered and only 720MHz otherwise.

/Benjamin

In the image we ship with the board, when under USB power we run at 500MHz. When under DC power, we run at 720MHZ. Running over 500MHz is risky when under USB power. It is too close for some PCs ti supply the full current and can cause unintened issues.

Gerald