Fixes for common USB DAC problems with RPi

Get help for Volumio here!

Ads helps Volumio remain Free and Open Source. Please consider donating to help us continue to serve you.

Fixes for common USB DAC problems with RPi

Postby petli » Tue Jan 07 2014 21:50

I've done a fair bit of digging to get smooth sound out of my USB-driven Cambridge Audio DacMagic, so here's the info for your benefit. It also seems to apply to other USB DACs too.

Pops and crackle in the sound can often be fixed by adding dwc_otg.fiq_split_enable=0 to /boot/cmdline.txt. Just add it to the line that doesn't start with a # and reboot. Verify that the parameter took effect by looking for "dwc_otg: FIQ split fix disabled" in the kernel boot log.

If /var/log/syslog is spammed by messages like "estimated delay: X actual Y" this can be solved in two ways. The first is to set the nrpacks=1 option on the snd-usb-audio driver. I did it by creating the file /etc/modprobe.d/usb-dac.conf and putting the line "options snd-usb-audio nrpacks=1" in it. When you reboot (or force the kernel module to reload) those log lines should disappear. The current setting can be seen by "cat /sys/module/snd_usb_audio/parameters/nrpacks" (It can't be changed through that file, since it is only applied on module load.)

However, that will put a higher load on the USB stack, and I found a patch for the upcoming Linux 3.13 where the offending code has been completely rewritten. I patched that into a 3.10.25 kernel here: https://github.com/petli/linux/tree/rpi ... d-backport (kernel compilation instructions: http://elinux.org/RPi_Kernel_Compilation)

With that patch, the nrpacks=1 is not needed and the sound seems to work fine (I've been running this for a week now).
Random avatar
petli
Sunday DIYer
Sunday DIYer
 
Posts: 21
Joined: Fri Dec 20 2013 22:20
Location: Sweden

Ads helps Volumio remain Free and Open Source. Please consider donating to help us continue to serve you.


Re: Fixes for common USB DAC problems with RPi

Postby michelangelo » Tue Jan 07 2014 23:08

Wow, wow wow ! The kernel is a very nice news!
I knew the other 2 fixes (and nrpacks is already applied in last version, the dwg not because it forces 1.0 USB so lots of DACs may not work)... But this is a great news, now I just have to compile a custom kernel (with i2s drivers) and here we go.

Huge thanks for that!
User avatar
michelangelo
Founder
 
Posts: 4179
Joined: Sun Dec 15 2013 23:18


Re: Fixes for common USB DAC problems with RPi

Postby JDifool » Wed Jan 08 2014 17:46

Hi,

thanks a lot for sharing !

I've been scratching my head in vain for the past few weeks to get my teac amp + dac to work flawlessly, to no avail.

The cmdline.txt option most likely will break my DAC (since forcing USB 1.1 with another option, dwc_otg.speed=1, broke the audio device), but I'll try it now.

The usb backport, though, is great !

I'll try it and let you know (I kwno have a few SD cards I can test this thing on).

Cheers
Jdif
Random avatar
JDifool
Fresh off the boat
Fresh off the boat
 
Posts: 8
Joined: Sun Dec 29 2013 17:40


Re: Fixes for common USB DAC problems with RPi

Postby petli » Wed Jan 08 2014 21:18

Are you sure about dwc_otg.fiq_split_enable=0 forcing the USB hub into 1.1 mode? I never saw that mentioned in other forums.

The driver also happily reports about 2.0 devices on my USB bus, and the hub itself seems to be running at 2.0 speeds:

$ cat /sys/bus/usb/devices/1-1/bcdDevice
0200
$ cat /sys/bus/usb/devices/1-1/speed
480
Random avatar
petli
Sunday DIYer
Sunday DIYer
 
Posts: 21
Joined: Fri Dec 20 2013 22:20
Location: Sweden


Re: Fixes for common USB DAC problems with RPi

Postby michelangelo » Wed Jan 08 2014 22:02

Sorry, got confused with otg...

Invite people to try that and report! Until I find the time to recompile the kernel (quite busy days, work has restarted once again...) :D
User avatar
michelangelo
Founder
 
Posts: 4179
Joined: Sun Dec 15 2013 23:18


Re: Fixes for common USB DAC problems with RPi

Postby petli » Wed Jan 08 2014 22:55

Hopefully Jdif will tell us soon. :)
Random avatar
petli
Sunday DIYer
Sunday DIYer
 
Posts: 21
Joined: Fri Dec 20 2013 22:20
Location: Sweden


Re: Fixes for common USB DAC problems with RPi

Postby JDifool » Fri Jan 10 2014 08:54

Hi guys,

I'll be busy until the end of the week but I'll definitely try the backport this week-end and let you know.

Regards,
jdif
Random avatar
JDifool
Fresh off the boat
Fresh off the boat
 
Posts: 8
Joined: Sun Dec 29 2013 17:40


Re: Fixes for common USB DAC problems with RPi

Postby legodude » Fri Jan 10 2014 14:59

petli wrote:...
Pops and crackle in the sound can often be fixed by adding dwc_otg.fiq_split_enable=0 to /boot/cmdline.txt. Just add it to the line that doesn't start with a # and reboot. Verify that the parameter took effect by looking for "dwc_otg: FIQ split fix disabled" in the kernel boot log.
...


The above worked to fix sounds issues on my setup. USB audio is:
C-Media Electronics, Inc. CM108 Audio Controller
http://www.amazon.com/Channel-External- ... B003MN1LTQ

*mike
Random avatar
legodude
Fresh off the boat
Fresh off the boat
 
Posts: 1
Joined: Fri Jan 10 2014 14:54


Re: Fixes for common USB DAC problems with RPi

Postby MPL » Sat Jan 11 2014 15:47

I've been running RaspyFi for some time, and installed volumio recently. I am mostly using the Shairport feature, and my impression is that the pop and crack issue with USB dacs seems to depend on the amount of data transfer to the RPI. Wav works worse than compressed et.c. for me.

Mainly by coincidence I found that my setup works flawlessly if I connect both a wired ethernet connection AND a wifi adapter to the RPI. With only one of them connected, I have problems with a "raw installation" of volumio (mainly pop-sounds). I have no idea how or why this works... I would normally expect that the RPI would use only one of the connected network ports, but it doesn't seem to be that way. The only other changes I have done is to increase the MPD buffers (30%, 8092), but haven't checked if gets worse if I change it back.

DAC: Topping TP30 built-in DAC. I will try some more DAC later to see if the fix works there as well.
Wifi adapter: Edimax

Would be interesting if someone else can get the same result and if it can be used to create a fix in volumio (how the network connection is handled)
Random avatar
MPL
Fresh off the boat
Fresh off the boat
 
Posts: 4
Joined: Sat Jan 11 2014 12:12


Re: Fixes for common USB DAC problems with RPi

Postby the_bear » Mon Jan 13 2014 07:42

Dear all,

first of all, thanks to Mr. Admin for this fabulous distribution and, secondly, to Mr. MPL for this fix which worked like a charm for me!
Before I had pops / cracks both for LAN and WLAN, now I have crystal clear sound.

The fix was applied to an otherwise unchanged Volumio 1.1 (i.e. only the necessary setup (NAS/WLAN) was done, all other values were left asdefault).

Now that this is working so nicely, I'll dig around a bit in the forum to find a similarly effective solution to the 'I have to restart the mpd daemon after each boot or the webui will not work' issue. I was under the impression that this was working in Volumio 1.0 but I may be mistaken.

For reference, this is my current config:

Hardware: Raspberry Pi
OS: Volumio 1.1
WLAN Stick: EDIMAX EW-7811UN (directly plugged in)
NAS: Western Digital MyBook Live
DAC: generic 2704-based (directly plugged in)
Music: FLAC 16 bit / 44.1

Regards,
Thomas
Random avatar
the_bear
Fresh off the boat
Fresh off the boat
 
Posts: 2
Joined: Mon Jan 13 2014 07:16

Next

Return to Help

Who is online

Users browsing this forum: Google Adsense [Bot] and 5 guests