RobertCNelson / linux-dev

MIT License
151 stars 96 forks source link

beaglebone usb audio noise #2

Open ferryzhou opened 12 years ago

ferryzhou commented 12 years ago

iMic is used for beaglebone audio

I installed ubuntu 11.10 r5 on the beaglebone, further installed alsa-utils and run alsamixer to adjust the volume.

line in and line out is connected to iMic.

Here is the problem: if I run the command

arecord | aplay

I can hear the noise (sometimes when system is a little bit busy, say if another ssh remote connected to beaglebone and run top command, anytime the statistics is updated, a noise is shown up).

This problem doesn't happen on beagleboard.

After check with top command. I found the difference is: in beaglebone, if I run aplay a.wav or arecord | alay, a busy kworker is shown up, this kworker consumes more than 90% CPU. In beagleboard, no busy kworker is shown up when aplay is running.

nzmichaelh commented 12 years ago

Same here with a XITEL MD-PORT AN1. mpg321 sits at around 5 % with kworker/0:1 at 95 %. Audio is choppy.

nzmichaelh commented 12 years ago

There's another report here: https://groups.google.com/group/beagleboard/browse_thread/thread/27de0f525a34c33b

nzmichaelh commented 12 years ago

Hacking and switching the config from DMA mode to PIO mode cuts the CPU usage to < 1 %. All good.

ferryzhou commented 12 years ago

hi nzmichaelh, how do you switched the mode? Thanks!

RobertCNelson commented 12 years ago

Just rebuild the kernel with this changed from:

CONFIG_MUSB_PIO_ONLY is not set

to

CONFIG_MUSB_PIO_ONLY=Y

Still a mess, as somethings work better, but then others don't..

I thought i also saw a command line bootarg a few week too, but can't find it at the moment..

Regards,

ferryzhou commented 12 years ago

Robert, thanks for your work! I will wait for a stable solution. Regards.

RobertCNelson commented 12 years ago

Guys, i just pushed out a new version, v3.2.0-psp4, it's a got a few musb fixes.. (both my rtwifi adapters now both work. Previous one would bring the bone down to it's knees.) Care to give it test? The builders are currently chewing on it(1), but it can be built from source..

Regards,

1: http://rcn-ee.homeip.net:81/dl/farm/deb/

edit: opps, spoke to o soon, the one adapter crapped out after a good 10minutes of working perfectly. ;)

ferryzhou commented 12 years ago

just got time back to this. I compiled the kernel 3.2.0-psp7 and set CONFIG_MUSB_PIO_ONLY=Y. tested and it solves the kworker issue. thanks, robert and nzmichaelh. another discussion of the same issue is here https://groups.google.com/forum/?fromgroups#!msg/beaglebone/WiOl_rA-RW8/aJ5BdzXUzy4J. I recorded my detailed instructions here http://ferryzhou.wordpress.com/2012/04/24/beaglebone-audio-kworker-noise-solution/

arminbw commented 12 years ago

I am using 3.2.17-psp12 and experience choppy sound as well as heavy cpu load caused by kworker. See: http://groups.google.com/forum/?fromgroups#!searchin/beagleboard/Re:$20[beagleboard]$20Beaglebone$2BUSB$20speakers:$20choppy$20sound.$20Kernel$20update$20helps?/beagleboard/lpjT9PWfh0E/AWZvyFQbK84J

Did the PIO_ONLY option make it into the current build?

RobertCNelson commented 12 years ago

Nope, PIO_ONLY mode is not currently on by default.. Your free to use the build script and rebuild the kernel with PIO_ONLY on... I have current use case where DMA/MUSB is needed and currently works, so i can't disable it..

Regards,

menulis commented 11 years ago

Robert,

Do you have any updates or a roadmap on USB DMA issue for AM335x? We are users of BeagleBone (Rev. A5 mostly) and we are also facing problems when we use more than 3 3G USB modems connected to D-Link USB hub. Symptoms that we are facing is unability to establish a PDP context, ~50% packet loss, "busy" messages in dmesg from musb driver and similar. I've also noticed that similar USB related issues are marked as known in the latest release notes (AM335x-PSP 04.06.00.08) by TI, so I'm wondering if some solution is about to come in the meantime and where the is the root cause of the problem (USBSS, CPPI, MUSB).

I've also tried to use CONFIG_MUSB_PIO_ONLY=Y and CONFIG_PREEMPT=Y and it does solve the problem for only some time after reboot.

Thanks, Džiugas

RobertCNelson commented 11 years ago

Sorry, i don't work for TI, so i don't know their internal roadmap on this device... But have you tried the "am33x-v3.6" branch to see, if this has been fixed in v3.6 (note no support for most capes yet).. Note your uEnv.txt is going to change as it's this device has been converted from board file based boot to device tree based boot in mainline.

I've documented the bootloader needed and the uEnv.txt changes here: http://eewiki.net/display/linuxonarm/BeagleBone

Regards,

menulis commented 11 years ago

We tried am33x-v3.6, but we got a lot of errors from the USB subsystem, so we were not able to test our modems. Yesterday I've also tried linux-am33x.git (v3.2-staging) from arago-project.org, but I was able to see the same symptoms. The reason I've pointed to TI is actually the same Arago project and their kernel tree that you are incorporating most of the patches from, right?

Džiugas

RobertCNelson commented 11 years ago

It really depends if the Arago project creates a useful v3.6 based branch... If they do, we will look into it...

menulis commented 11 years ago

I see. Do you know if there is a workaround to solve the issues with multiple USB devices and BeagleBone?

menulis commented 11 years ago

Today I've tried to compile and run a kernel from m33x-v3.6 branch (3.6.1-bone0). Let me share the summary (verified only couple of times, therefore it might be not consistent among different runs):

[    0.075799] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.075827] ------------[ cut here ]------------
[    0.075870] WARNING: at arch/arm/mach-omap2/gpmc.c:737 gpmc_init+0x208/0x290()
[    0.075883] Modules linked in:
[    0.075951] [<c0013b94>] (unwind_backtrace+0x0/0xe0) from [<c00376cc>] (warn_slowpath_common+0x4c/0x64)
[    0.075980] [<c00376cc>] (warn_slowpath_common+0x4c/0x64) from [<c00376fc>] (warn_slowpath_null+0x18/0x1c)
[    0.076007] [<c00376fc>] (warn_slowpath_null+0x18/0x1c) from [<c082d5e0>] (gpmc_init+0x208/0x290)
[    0.076037] [<c082d5e0>] (gpmc_init+0x208/0x290) from [<c0008894>] (do_one_initcall+0x90/0x160)
[    0.076074] [<c0008894>] (do_one_initcall+0x90/0x160) from [<c0823994>] (kernel_init+0x168/0x22c)
[    0.076110] [<c0823994>] (kernel_init+0x168/0x22c) from [<c000e340>] (kernel_thread_exit+0x0/0x8)
[    0.076181] ---[ end trace 1b75b31a2719ed1c ]---
[ 2223.506681] CAUTION: musb: Babble Interrupt Occured
[ 2228.674918] usb 1-1: reset high-speed USB device number 2 using musb-hdrc
[ 2243.799933] usb 1-1: device descriptor read/64, error -110
[ 2259.034492] usb 1-1: device descriptor read/64, error -110
[ 2259.268811] usb 1-1: reset high-speed USB device number 2 using musb-hdrc
[ 2274.394037] usb 1-1: device descriptor read/64, error -110
[ 2289.628593] usb 1-1: device descriptor read/64, error -110
[ 2289.862974] usb 1-1: reset high-speed USB device number 2 using musb-hdrc
[ 2382.608232] usb 1-1: device not accepting address 31, error -110
[ 2382.733282] usb 1-1: new high-speed USB device number 32 using musb-hdrc
[ 2393.155501] usb 1-1: device not accepting address 32, error -110
[ 2393.161940] hub 1-0:1.0: unable to enumerate USB device on port 1
[ 2395.163338] musb_bus_suspend 2308: trying to suspend as a_host while active
[ 2395.296130] usb 1-1: new high-speed USB device number 33 using musb-hdrc
[  26.348291] omap-dma-engine omap-dma-engine: allocating channel for 123
[   26.355205] dmaengine: dmaengine_get: failed to get dma1chan123: (-16)
[   26.362031] omap-dma-engine omap-dma-engine: allocating channel for 124
[   26.368945] dmaengine: dmaengine_get: failed to get dma1chan124: (-16)
[   26.375774] omap-dma-engine omap-dma-engine: allocating channel for 125
[   26.382688] dmaengine: dmaengine_get: failed to get dma1chan125: (-16)
[    5.021837] musb_bus_suspend 2308: trying to suspend as a_wait_bcon while active
[ 1944.093778] musb_bus_suspend 2308: trying to suspend as a_host while active

Otherwise, if you are lucky and USB devices work, they seem to work quite stable. That is, at least during short testing time I've not observed disconnections and number of devices does not seem to affect the overall stability. However, if I had 4 USB modems connected and then plugged in ethernet-over-usb dongle, I got SIOCSIFFLAGS: No space left on device while trying to make ethX interface up (as per http://e2e.ti.com/support/embedded/linux/f/354/t/41957.aspx). But having plugged it in first place followed by plugging the modems, no similar error occurred. What is also noticeable, I managed only to reach 4.6 MByte/s throughput on 100 Mbps network with my dongle no matter if it was connected directly to the board's USB port or through the hub.

Džiugas

menulis commented 11 years ago

Any news regarding musb issues?