davidmonro
Posts: 7
Joined: Sat Aug 04, 2012 4:12 am

usb audio glitches when writing to SD card

Sat Aug 04, 2012 4:34 am

I've got a USB audio device (Behringer UCA202, based on a Burr Brown/TI PCM2902). I'm using shairport with it. It works pretty well, but there's the odd audio glitch. I noticed that there's a correlation between the glitches and _write_ traffic to the SD card. If I write a large file to the sd card and then use 'sync' to flush the data, I get loads of audio glitches as long as the green light is on.

Oddly, read traffic doesn't affect it; I can run dd if=/dev/mmcblk0 of=/dev/null and I get no glitches even through the green light is on solid.

The SD card I'm using is a Patriot LX series 16G class 10 (PSF16GSDHC10-PC). It seems to be miserably slow at small writes.

Is writing to the SD card locking up a bus somewhere so data can't be fed to the USB device when it needs it?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5162
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: usb audio glitches when writing to SD card

Sat Aug 04, 2012 10:19 am

davidmonro wrote: Is writing to the SD card locking up a bus somewhere so data can't be fed to the USB device when it needs it?
Pretty much. See:
https://github.com/raspberrypi/linux/pu ... nt-7437129

Try adding to cmdline.txt
sdhci-bcm2708.missing_status=0 sdhci-bcm2708.sync_after_dma=0

Which significantly improves the situation.

(unfortunately this doesn't work with all sdcards, so might be worth backing up before trying)

davidmonro
Posts: 7
Joined: Sat Aug 04, 2012 4:12 am

Re: usb audio glitches when writing to SD card

Sun Aug 05, 2012 2:17 am

That doesn't seem to fix it; may have improved it slightly but the issue is still definitely there. For this particular application I could probably just move everything except /boot to a USB stick which I think will solve the issue (nothing should be writing there!) but that is rather an ugly solution.

davidmonro
Posts: 7
Joined: Sat Aug 04, 2012 4:12 am

Re: usb audio glitches when writing to SD card

Sun Aug 05, 2012 2:20 am

Ahh! hang on - do those variables exist in the stock raspbian kernel? Since they don't appear in /sys/module/sdhci_bcm2708/parameters/ I'm guessing maybe not. Where do I get a kernel and modules I can retrofit into raspbian?

Cheers

David

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5162
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: usb audio glitches when writing to SD card

Sun Aug 05, 2012 11:07 am

davidmonro wrote:Ahh! hang on - do those variables exist in the stock raspbian kernel? Since they don't appear in /sys/module/sdhci_bcm2708/parameters/ I'm guessing maybe not. Where do I get a kernel and modules I can retrofit into raspbian?
Not in stock raspbian, but they are available after a rpi-update, or bleeding-edge repoository udpate.
https://github.com/Hexxeh/rpi-update
or
http://www.raspberrypi.org/phpBB3/viewt ... 66&t=12170

davidmonro
Posts: 7
Joined: Sat Aug 04, 2012 4:12 am

Re: usb audio glitches when writing to SD card

Mon Aug 06, 2012 11:48 am

If I set both of the parameters I get I/O errors. However, setting just sdhci-bcm2708.missing_status=0 doesn't appear to produce errors and seems to massively reduce the audio glitches (still get a _very_ occasional one when writing a lot of data), so I'll run with that for now. I still have to use the OSS emulation on top of alsa to get decent sound out of mpd (see my other post about that).

lintweaker
Posts: 33
Joined: Mon Jul 09, 2012 6:26 pm

Re: usb audio glitches when writing to SD card

Mon Aug 06, 2012 3:10 pm

davidmonro wrote:If I set both of the parameters I get I/O errors. However, setting just sdhci-bcm2708.missing_status=0 doesn't appear to produce errors and seems to massively reduce the audio glitches (still get a _very_ occasional one when writing a lot of data), so I'll run with that for now. I still have to use the OSS emulation on top of alsa to get decent sound out of mpd (see my other post about that).
I have just tried booting with only 'sdhci-bcm2708.missing_status=0' enabled but I still get repeated:

mmc0: Timeout waiting for hardware interrupt - cmd13.
mmc0: Timeout waiting for hardware interrupt - cmd13.

messages.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5162
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: usb audio glitches when writing to SD card

Mon Aug 06, 2012 4:08 pm

lintweaker wrote: I have just tried booting with only 'sdhci-bcm2708.missing_status=0' enabled but I still get repeated:

mmc0: Timeout waiting for hardware interrupt - cmd13.
mmc0: Timeout waiting for hardware interrupt - cmd13.

messages.
Yes, not all sdcards like that change. You could try a different sdcard, or disable that option until an alternative fix is found.

Narf03
Posts: 243
Joined: Mon Jun 11, 2012 3:44 pm
Location: Malaysia

Re: usb audio glitches when writing to SD card

Mon Aug 06, 2012 6:29 pm

I think there is some problems with the audio grounding issue, whenever there are activity reading/writing from/to pi, i can hear noise from the 3.5mm jack. perhaps its not something that can be fixed by firmware, driver or software.

davidmonro
Posts: 7
Joined: Sat Aug 04, 2012 4:12 am

Re: usb audio glitches when writing to SD card

Tue Aug 07, 2012 12:08 pm

@Narf03: this particular thread was about issues with USB audio widgets where that wouldn't apply. Analog audio ports on computers are often pretty noisy and affected by I/O activity of any sort (my Lenovo laptop does it quite badly). Which is one of the reasons for using a (good quality) USB widget in the first place!

Return to “Troubleshooting”