Fixes for common USB DAC problems with RPi

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

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!

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

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

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…) :smiley:

Hopefully Jdif will tell us soon. :slight_smile:

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

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

*mike

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)

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

Hi all,

so, after recompiling the 3.10.25 kernel with usb backport, I am more and more at loss !

1/ Pops and crackles are still here, though much less than before. Around 1~ 2 or 3 minutes, which is very acceptable in my opinion.
This is when playing 320kbps mp3.

2/ Lossless audio is still playable but immensely distorted (FLAC of WAV doesn’t make a difference), whether I read it from the network or from a local USB drive.

3/ I still get tons of “delay: estimated 0, actual 95” messages although I am using the new kernel and that my alsabase.conf file has the nrpacks option enabled.

I guess this is my particular setup then…

I didn’t try the fix mentionned earlier with the WIFI dongle plugged, since I don’t have one available. I’m thinking about getting one to test it though.

Hope we’ll find a way soon !

Cheers,
jdif

Did you try setting dwc_otg.fiq_split_enable=0 /boot/cmdline.txt? I think that is the key one, and it doesn’t seem to preclude using USB 2.

Hi,

[    1.930928] dwc_otg: FIQ split fix disabled

yeah, unfortunately, I did that too…

Don’t know what else I could try for now.

Thanks for your time though.

jdif

Hi,
Edited the file and get this:

"force_turbo=1 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p3 elevator=noop rootfstype=ext4 rootwait smsc95xx.turbo_mode=N dwc_otg.fiq_split_enable=0

A LOT of crackles is the result ! ???

Karsten

CORRECTION !!!

Sorry for the last reply.
The patch works for me. I’ve forgotten the “,” in front of the "dwc_otg.fiq_split_enable=0 "

Karsten

So you report good performance with dwc_otg.fiq_split_enable=0 ?

If yes tell me so include it!

Dear all,

sorry, my post was misleading. I performed the fix (dwc_otg.fiq_split_enable=0) as proposed by the threadstarter (petll) and it works perfectly. So dear Mr Admin, yes either please include the fix or (it may not be necessary for all people / DAC) put it in a special section of the installation instructions. Maybe it would be a good idea to collect some ‘fixes for common issues’ like this:

Issue: Pops and cracks during playback (1)
Fix: add ‘dwc_otg.fiq_split_enable=0’ to the line with the parameters in file /boot/cmdline.txt of the ‘visible’ partition of the SD card
Thread: for more infos see thread …

Issue: Pops and cracks during playback (2)
Fix: change values rwin …

On a related note, I had a look into the ‘webui not coming up’ issue.
As Mr. Admin wrote in a different thread it works perfectly if the mpc client is stopped manually (as it is done in the web ui). I checked the /etc/rc.* directories and the stopscripts which should take care of automatically stopping the daemon are where I would expect them. So why is mpd not stopped automatically but it works if I call the same script manually?

Regards,
Thomas

Hi all,

I performed some tests, hope will be interesting for you.
I own 2 USB DACs (NuForce HDCP, NuForce DAC-80 with Asynchronous USB)

Using HDCP, I’ve no pops and crackle till 24b-48k. No tested at 24/96
Using DAC-80, very few pops or crackle at 16/44.1k. The usb runs in async mode.
With high resolution files (from 24/96), I got a lot of pops or crackle. Context is default cmdline.txt.

Using dwc_otg.fiq_split_enable=0 in cmdline.txt, the Rpi doesn’t boot with an exception stack at 0xddb4ffb0, usb stack I think

With dwc_otg.speed=1 (dwc_otg.fiq_split_enable=0), Rpi boots but the DAC-80 -which is in adaptavive mode- doesn’t work.

Thanks,
Vincent

Hi all.

I am also confirming that “dwc_otg.fiq_split_enable=0” is preventing Volumio boot when one of my DACs is connected (Audio-GD NFB-11.32; USB32 interface based on Via VT1731 chipset).

Other than that I have been playing around with various “nrpacks” values and deducted the following:

  • I can go up to “nrpacks=4” on all my DACs without experiencing pops/crackles even on 192/24 flacs/wavpacks, but with dmesg full of “delay” messages.
  • “nrpacks=2” is the highest nrpack value that stops creating any “delay” message in my dmesg output on all of my DACs
    So, for the time being it is no “dwc_otg.fiq_split_enable=0” and “nrpacks=2” in my setup (my config: “headless” Volumio r-pi setup; 16 Gb Class 10 SD card; wired LAN (no WiFi dongle); no usb storage (LAN based music library); USB DAC output).

BTW… what is the proper procedure for reloading “snd-usb-audio” module on Volumio (without restart)? This procedure:

etc/init.d/mpd stop modprobe -r snd-usb-audio modprobe snd-usb-audio nrpacks=2 /etc/init.d/mpd startgoes through, but I have no sound output after it (have to restart to get it).

I get the same result as Karsten - adding dwc_otg.fiq_split_enable=0 to the boot commandline gives me continuous crackles in the output - without it, I just get the occasional pop, maybe every minute if there’s not much network traffic. And if I disconnect the ethernet cable, I get virtually no pops at all.

Configuration: Headless RPi, wired ethernet (no Wifi dongle), USB hard disk, Audioquest Dragonfly async DAC. Mostly playing 24/44.1k.

Other than unplugging the network cable, are there any other tricks to try to get rid of the remaining pops?

Cheers … JD