USB noise or ground loop? - Page 1
Forum section: electronics / projects

author: drummerdimitri
author_rank: Frequent Contributor
timestamp: March 23, 2019, 10:57:48 am
content: I have a USB DAC/Headhpone AMP that also supports TOSLINK connection and with very sensitive IEMs on USB I can hear a lot of nasty noise when no music is playing at any volume level.When I switch over to the TOSLINK connection, all that noise goes away. I have found two devices that eliminates USB noise by filtering or by disconnecting the 5V rail since my DAC is mains powered.The only issue is I'm not sure how to differentiate a noisy USB connection vs a ground loop. If I can identify the problem then there are products that do both.

author: jonroger
author_rank: Regular Contributor
timestamp: March 23, 2019, 01:54:21 pm
content: I would just go on ebay and pay $17 for a USB isolator that isolates everything.

author: Nominal Animal
author_rank: Super Contributor
timestamp: March 23, 2019, 02:55:49 pm
content: Quote from: drummerdimitri on March 23, 2019, 10:57:48 amUSB is a digital protocol, with data encapsulated in packets with error checking. If the data is garbled, the audio will cut off and click; it won't just have some background noise or hiss. (Jitter might occur with USB audio, but not as background noise/hiss.)Quote from: drummerdimitri on March 23, 2019, 10:57:48 amThat is what you have. The cheap USB isolators operate only on USB 1.1 Full Speed, or 12 Mbit/s, so you need to use an isolator on the audio USB link only. (Some isolators have a switch to choose between 1.2 Mbit/s and 12 Mbit/s data rate.)They are based on Analog Devices' dedicated ADuM4160 or ADuM3160 chips, and their reference design. The only thing that varies is the DC-DC converter used; it must be isolated for the device to work correctly. When you get one, just check the largest component on the board; that will be the DC-DC converter. Mornsun B0505S series is commonly used (they vary by the amount of power they pass), and work fine for ground loop isolation. Find its data sheet, and verify that it is an isolated one (minimum 1 kV isolation), and passes sufficient current for your device. (For powered USB devices, 100mA is usually enough.)1 kV isolation means that if the two sides are powered by different 240 VAC mains circuits, there can be about 300 volts potential difference between the zero potentials and the isolator will still work, even if the two circuits are not synchronized in any way. So, I personally use one when I ground loops are a possibility between two devices powered from the same building or "fuse box", but possibly from different circuits. If the two sides are powered by e.g. different buildings, I use Ethernet (which is magnetically isolated) or an optical connection.Any proper elechicken can explain this better, I'm sure.

author: GeoffreyF
author_rank: Regular Contributor
timestamp: March 23, 2019, 04:05:19 pm
content: Did you probe the differential between the devices and other grounds with a DVM or an oscilloscope? That would answer your question completely. Getting a choke (ferite core) around the USB cable would possibly be a remedy as well. If all that reveals nothing, then it's not what you speculate.

author: drummerdimitri
author_rank: Frequent Contributor
timestamp: March 23, 2019, 05:49:33 pm
content: Quote from: GeoffreyF on March 23, 2019, 04:05:19 pmWhat do you mean by differential? What exacly should I be probing with my scope?Will try your suggestion of a choke even though I'm almost sure it won't solve my problem.

author: drummerdimitri
author_rank: Frequent Contributor
timestamp: March 24, 2019, 10:19:52 am
content: I tried using the choke but that didn't work unsurprisingly.I cut a USB extension in half and soldering all the wires back except the ground and Vcc wires and although it solved the ground loop I could still a slight buzzing sound.How is that possible since as mentioned above USB should have no noise as it is a digital signal?I'm thinking of switching back to TOSLINK as that connection is electrically isolated.

author: Nominal Animal
author_rank: Super Contributor
timestamp: March 24, 2019, 11:47:47 am
content: Quote from: drummerdimitri on March 24, 2019, 10:19:52 amIt can still be similar to a ground loop, except the noise being conducted through the D+ and D- lines to the DAC.The only way you can be sure is to get an USB isolator and see, for examplethis onefor under $10 USD.Quote from: drummerdimitri on March 24, 2019, 10:19:52 amThe D+ and D- lines are still electrical, and may have common-mode noise. Depending on how the USB receiver is implemented, that common mode noise may affect the DAC, essentially the same way a low-voltage noisy ground loop would.That is, I do not believe the noise is inherent in the data itself. USB is a reliable protocol (except on faulty devices like Raspberry Pi's), with each data packet having checksums; there is even a facility for resending missing/broken packets, but that depends on the devices and available bandwidth. The only difference between the USB and TOSLINK connections, as far as I understand, is that USB passes electrical noise (such as common-mode noise in the data lines, or ground loop due to voltage potential differences in the circuits), whereas TOSLINK does not, as it is purely optical.Quote from: drummerdimitri on March 24, 2019, 10:19:52 amWell, in many ways TOSLINK is superior to USB. For one, the cables are just plastic, and not that expensive, so they're easier/more user-friendly; you only need to avoid too tight bends.

author: drummerdimitri
author_rank: Frequent Contributor
timestamp: March 24, 2019, 12:11:57 pm
content: Quote from: Nominal Animal on March 24, 2019, 11:47:47 amOk so I found this company that sells items that may solve my issue:https://ifi-audio.com/home/digital/Would you recommend any of these products or should i not bother and just get that USB isolator you mentioned?Thanks!

author: Nominal Animal
author_rank: Super Contributor
timestamp: March 24, 2019, 12:55:40 pm
content: Quote from: drummerdimitri on March 24, 2019, 12:11:57 pmOf those, only iGalvanic is an isolator, with a 3 kV isolation barrier. However, because it is specified for USB 3.0 Super Speed, you'll have to pay upwards of $350 USD for it.If we ignore the data rate difference and the isolation barrier (because they do not matter for you, assuming you use e.g. 96kHz 32-bit 2-channel audio, or less -- that would take about half the 12 Mbit/s Full Speed USB bandwidth the cheapie isolators support), it does the same thing as the cheapie.(The rest are basically +5V and ground filters and powered hubs, based on their specifications; or equivalent audiophole mumbo-jumbo.)For you, I actually recommend using TOSLINK instead. But, if you want, get the cheapie. Personally, I'd only buy an iGalvanic or similar with other peoples money, not for myself. I do have that cheapie (or a clone; I got it a few years ago, but it looks exactly like many of the cheapies now on fleabay).If the iGalvanic would get rid of the noise, so would the cheapie as well.I just realized that it is possible the hum/noise is generated in the DAC box itself, as a byproduct of the USB transfers. Essentially, the USB receiver side, when transferring data, may generate noise that gets coupled to the DAC itself. Perhaps the USB receiver side has insufficient Vcc/GND filtering, compared to the TOSLINK receiver circuitry? If so, even an isolator will not help you; only using TOSLINK will.If you can tell me the make and model of your DAC box, I could try and find out?

author: drummerdimitri
author_rank: Frequent Contributor
timestamp: March 24, 2019, 02:27:55 pm
content: Quote from: Nominal Animal on March 24, 2019, 12:55:40 pmI have a Questyle CMA400i.Will stick to optical for now since the galvanic isolator is ridiculously overpriced.The only reason I slightly prefer to use USB is for its supposedly lower jitter specifications and asynchronous clock.Will order that cheapie isolator to give it a try.

author: Nominal Animal
author_rank: Super Contributor
timestamp: March 24, 2019, 03:34:58 pm
content: Quote from: drummerdimitri on March 24, 2019, 02:27:55 pmThe core DAC chip in that one is an AKM Semiconductor Inc. (AkashiKasei)AK4490EQchip. It has separate analog and digital supplies and grounds. It is quite possible that the board in the CMA400i combines them, and the noise is indeed generated by the USB receiver circuitry.(One of my pet peeves is a similar design "stupidity" in stepper motor controller boards. All the good driver chips, from Allegro A4988 to Trinamic TMC series, have separate digital and motor grounds. Very few (none of the cheaper hobbyist ones) keep the motor side completely isolated, however. It makes me very disappointed, because digital isolators are cheap (especially at the frequencies of DIR/STEP control signals -- even optocouplers can be used if you want to keep it real cheap), and using them at right spots would make the boards so much more robust, and easy to use in cases where the motors have their own separate supply. It is basically the same situation as with audio, except that it's the motors that cause problems to the digital side. Both suffer from ground loops, and bad design.)Quote from: drummerdimitri on March 24, 2019, 02:27:55 pmRight. I suspect you'd get best results if the male side is to the computer, and you use a cable where the GND and VCC lines are cut near the DAC connector for the isolator-dac section. That way you should avoid any noise from the switch-mode DC-DC supply in the isolator. The reason for cutting the VCC/GND off from near the DAC USB connector is to ensure it won't act like an antenna, introducing noise to the DAC USB circuitry. Verify the switch is in the 12 Mbit/s position.For those who do not understand the difference, SPDIF/TOSLINK is one-directional. The computer will send a digital audio signal at a fixed frequency, and the DAC simply has to try to keep in sync. For say 48000 kHz audio sample rate, if the computer and DAC clock differ by just 1 Hz or 0.002%, each second there is either an extra sample, or a sample is missing. That is what jitter is; timing error. The DAC cannot just buffer the data, because there is no way for it to signal back to the computer that it needs more data (DAC clock is fast compared to computer) or that the computer should wait for it to play it back first (DAC clock is slow compared to computer).With USB data, the audio signal is transferred in short blocks (up to 1023 data bytes for full-speed USB, 12 Mbit/s), with header and checksum data (typically the overhead is less than 25%). Each successfully sent data block is acknowledged. Essentially, the computer does not need to have an internal clock, and provides the data asynchronously to the DAC; it simply sends audio data whenever the DAC is ready for it.

author: ogden
author_rank: Super Contributor
timestamp: March 26, 2019, 09:12:08 am
content: It is easy to test source of the noise - you need just laptop running on batteries, disconnected from mains, no other connections besides DAC. If no noise in this case - then it is groundloop. I bet it is BTW. Do you use XLR or RCA for amp connection? Using XLR may help minimize conducted noise problems.Quote from: Nominal Animal on March 24, 2019, 03:34:58 pmJitter is cycle-to-cycle clock irregularities. Clock frequency difference is just frequency difference or clock wander.https://statics.cirrus.com/pubs/whitePaper/WP_Specifying_Jitter_Performance.pdfDigital audio receivers recover clock from incoming stream and DAC usually is made as clock slave to the receiver. Particular DAC have professional digital audio AES/EBU input - I doubt that it's digital audio receiver may be inferior to USB receiver by any stretch of imagination. Not in this grade of hardware. I would just use TOSLINK optical to isolate PC from audio equipment and forget about the problem. PC is noisy piece of  and you better isolate it from your analog audio no matter what.

author: pwlps
author_rank: Frequent Contributor
timestamp: March 28, 2019, 08:43:28 am
content: Quote from: Nominal Animal on March 24, 2019, 03:34:58 pmData acknowledgement and error correction is used in bulk mode but not in isochronous mode.The Audio Device Class uses isochronous transfers, see e.g.https://www.edn.com/design/consumer/4376143/Fundamentals-of-USB-Audio,https://www.silabs.com/documents/public/application-notes/AN295.pdf.Even at the highest audio sampling rates USB would be fast enough for buffering and error correction but as I understand they do it this way because for musicians minimizing latency is more important than correcting errors.Quoted fromhttps://www.silabs.com/documents/public/application-notes/AN295.pdfQuoteWould that mean that any corrupted data byte will appear as noise? Unless the DAC software employs some intelligent algorithm to detect corrupted bytes and replace them with some interpolated values (but maybe not in a cheap headphone DAC).High-quality equipment often use some proprietary protocols like ASIO instead of the standard USB audio class, but I don't know what type of error checking they use.

author: Nominal Animal
author_rank: Super Contributor
timestamp: March 28, 2019, 02:54:53 pm
content: Quote from: ogden on March 26, 2019, 09:12:08 amI stand corrected. I did intend to refer to wander and not jitter. As that paper defines,"Jitter is the dynamic deviation of event instants in a stream or signal from their ideal positions in time, excluding modulation components below 10 Hz."(Some others define it as excluding components below 1 Hz.)Quote from: ogden on March 26, 2019, 09:12:08 amThat particular chip is pretty funky, and requires a 8 to 37 MHz master clock. I imagine it is very nontrivial to try and sync that frequency master clock from a 44.1 kHz to 192 kHz signal, with minimal jitter and wander.Quote from: pwlps on March 28, 2019, 08:43:28 amEven isochronous transfer packets have a checksum, so errors can definitely be detected; but as you correctly pointed out, there is no ack/resend mechanism.Quote from: pwlps on March 28, 2019, 08:43:28 amYou cannot detectwhichsamples are corrupted in a corrupted isochronous packet, so such an algorithm would have to rely on examining the data; and detecting "out-of-place" samples in PCM is hard.I would expect the errors are typically random single-bit flips, which sound more like crackle than a background hiss, depending on how often the errors occur.

author: Bassman59
author_rank: Super Contributor
timestamp: March 28, 2019, 05:17:49 pm
content: Quote from: pwlps on March 28, 2019, 08:43:28 amIt's up to the device how it handles corrupt or missing data. It's best to mute the output, I think.QuoteASIO still relies on isochronous transfers. There is no way to resend data if those data are live samples coming from microphones! I suppose you could have a buffer and attempt retries from it, but the latency might be intolerable, and how big should that buffer be, and anyway that would be a custom device class and your digital-audio workstations and all probably won't be able to talk to that hardware.A better question is: how often does one see errors in USB transmission? In my experience, it either works perfectly or it fails miserably, and the problem is usually solved by replacing the cable.

author: ogden
author_rank: Super Contributor
timestamp: March 28, 2019, 05:27:19 pm
content: Quote from: Nominal Animal on March 28, 2019, 02:54:53 pmIt is not like that. Fact that you can't understand how they do it, does not mean that they don'tReceiver does not sync to sample rate but SPDIF/TOSLINK/AES3 biphase clock which is much faster. Using VCO with PLL one can recover original clock of digital interface pretty damn well. Further reading:http://www.ti.com/product/DIR9001.

author: Nominal Animal
author_rank: Super Contributor
timestamp: March 28, 2019, 06:07:20 pm
content: Quote from: ogden on March 28, 2019, 05:27:19 pmYou completely missed my point. You might wish to disengage strutting mode, too.If you sync to the SPDIF clock like that, you regenerate the source clock wander. Essentially, your DAC will have the same timing characteristics as whatever the cheap PC SPDIF hardware has.The hard part is how to adjust the high-frequency clock, balancing between the sample buffer depth and latency, without audible effects.This is exactly the same problem as clock synchronization across domains, for example when NTP is used.Simple algorithms and implementations are suspect to oscillation (around the proper clock rate), especially when the SPDIF clock is not very stable. UARTs avoid the problem by using stop bit(s) for resynchronization. In audio, that would lead to audible issues; changes in pitch are noticeable.Quote from: ogden on March 28, 2019, 05:27:19 pmRight. Unfortunately, it does not make the hard problem any easier, since there is no quarantee that the SPDIF clock is at all stable. The same problem applies to isochronous USB transfers.

author: ogden
author_rank: Super Contributor
timestamp: March 28, 2019, 07:02:43 pm
content: Quote from: Nominal Animal on March 28, 2019, 06:07:20 pmWhat?You said it straight w/o any hint of hidden meaning: "it is very nontrivial to try and sync that frequency master clock from a 44.1 kHz to 192 kHz signal, with minimal jitter and wander".QuoteSure. So what? We do not talk about jitter/wander cleaning. Origial question was: is it so that TOSLINK jittrer/wander specs are as good as USB interface. Answer: it is.QuoteAgain: so what? Unstable source clock is not a subject of discussion. Anyway even cheapest crystal oscillator solutions used in PC and it's audio devices are good enough for audio.

author: Bassman59
author_rank: Super Contributor
timestamp: March 28, 2019, 08:02:13 pm
content: Quote from: Nominal Animal on March 28, 2019, 06:07:20 pmFor USB transfers, the usual solution is to do asynchronous mode transfers. This completely decouples the USB clock domain from the DAC domain. This works because the design knows the sample rate and knows how many samples are consumed by the sink in a USB frame and how many are sent in the frame, and it can control the latter using the feedback endpoint. The USB transfer rate is much greater than the sample rate, so this works and the FIFO to the DAC is never starved nor overrun. On the DAC side, a low-jitter clock is used to clock the DAC and deal with reading the data from the FIFO.For S/PDIF where the recovered clock might have more jitter than one might wish, the usual solution is to use asynchronous sample-rate conversion with the DAC side clocked by a low-jitter oscillator.It should be noted that strictly speaking, the S/PDIF receiver generates a sample-rate clock. The DAC needs a modulator clock, at 128, 256, 512 times the sample rate, and that clock is generated by a PLL that uses the recovered sample-rate clock as a reference. That PLL is included in the usual S/PDIF receiver chips from TI, AKM and Cirrus. That PLL output can be very good, but whether it's "good enough" depends on the application.

author: bloguetronica
author_rank: Frequent Contributor
timestamp: March 29, 2019, 04:24:08 pm
content: As others have said, most probably it is a ground loop. USB is immune to noise, since it consists of digital data transmitted through a shielded differential pair. Plus, the USB protocol allows for CRC verification of bulk transfers and subsequent correction. What happens is that you are breaking the ground loop when you switch to TOSLINK. You can achieve the same effect by disconnecting the 5V rail, presumably because you are also disconnecting the ground there and therefore you also break the loop, albeit on a different point.You can break the loop on the USB side if you break and then reconnect the ground using two diodes in anti-parallel and a small 10nF capacitor in parallel with the diodes. This is to remedy the fact that probably, on your end device (headphones) the USB shield is probably tied to the USB ground (it should be tied only on the host side). However, there might be other factor at play here: the power supply injecting noise and facilitating a ground loop via the protective earth (your DAC is mains powered, right?).You can see some attached schematics, to see how it is possible to break ground loops on end devices. Notice the capacitor and the resistor coupling the shield to the ground on the USB function generator. Also, on the pre-amplifier, you can see another approach that allows current going to the protective earth in case there is an isolation failure on the transformer.Kind regards, Samuel Lourenço

author: Nominal Animal
author_rank: Super Contributor
timestamp: March 29, 2019, 06:41:35 pm
content: Quote from: ogden on March 28, 2019, 07:02:43 pmReading difficulties, eh?Quote from: drummerdimitri on March 24, 2019, 02:27:55 pmNevermind; one more to the ignore list.

author: ogden
author_rank: Super Contributor
timestamp: March 29, 2019, 06:58:04 pm
content: Quote from: Nominal Animal on March 29, 2019, 06:41:35 pmDid I miss where OP asked for jitter/wander cleaning? Please be so kind and remind me.Oh, this?Quote from: Nominal Animal on March 29, 2019, 06:41:35 pmLOLIt isQuote from: ogden on March 28, 2019, 07:02:43 pmAnd not jitter cleaning, you

author: Nominal Animal
author_rank: Super Contributor
timestamp: March 29, 2019, 07:08:43 pm
content: Quote from: Bassman59 on March 28, 2019, 08:02:13 pmI know; I didn't even realize USB Audio uses isochronous transfers.Similar issues do occur elsewhere, too. One is when you have more than one DAQ (because you are measuring many things at once), at high sample rates, and you want to synchronize the data. I am not at all familiar with USB audio, but I do have experience on the software side on similar issues. OP mentioned jitter, and that made me think about how I would solve the clock discrepancies, based on my experience in the software side with sensor data.Quote from: Bassman59 on March 28, 2019, 08:02:13 pmVLC (the video player) has a feature that allows one to resample audio to the achieved display frame rate. It is surprising how small changes in the actual pitch are perceptible -- in that case, because the video frame rate was not stable, so the resampling ended up changing the audio pitch by accident. It is a surprisingly easy to notice very small changes, if the display frame rate is not rock solid stable.Quote from: Bassman59 on March 28, 2019, 08:02:13 pmI would assume a separately controlled high-frequency clock, compared to the SPDIF clock, would yield a much better result from not-very-good-quality SPDIF sources.Algorithmically, the idea is todecouplethe generated clock from the original clock source, but control it to run stably at theaveragerate of the original source. This kind of synchronization issue is surprisingly common in high data rate networked computation. Mathematically, you can describe the follower as a damped oscillator -- which is a pretty good description of a PLL based on the SPDIF clock --, but unless you deliberately add some latency, maybe just a few dozen samples worth, there always will be patterns that lead the follower to oscillate. In the algorithmic sense, it is very interesting and surprisingly difficult problem; and from the benefits of that latency (or "temporal slop"), I know that a PLL cannot be the best option here.Adjusting properties according to human perception, or psychoacoustic modeling in this case, is very interesting. Many people do not realize that even MP3 compression involves psychoacoustic modeling: the quantization noise is shaped to follow theequal-loudness contour.

author: ogden
author_rank: Super Contributor
timestamp: March 29, 2019, 07:35:35 pm
content: Quote from: Nominal Animal on March 29, 2019, 07:08:43 pmApparently you do not know. Next time before explaining how stuff works, make sure you understand subject well. Especially embarrassing is to start "for those who do not understand..." and provide BS (about USB audio) in explanation:Quote from: Nominal Animal on March 24, 2019, 03:34:58 pm

author: bloguetronica
author_rank: Frequent Contributor
timestamp: March 30, 2019, 02:48:24 am
content: I'm noticing some confusion here between asynchronous USB transfers, that don't exist, and isochronous transfers. As far USB is concerned, there are two types of transfers for massive data: bulk and isochonous. Both have CRC verification, but only bulk guarantees correction (i.e.: data is delivered, if not, rinse and repeat until it is). Other types of transfer exist for control and signaling: control and interrupt transfers. Hope this little bit of information is useful.Just a tidbit regarding my previous post. It didn't occurred to me that audio uses isochronous transfers, and I should have known better. Still, what I've said is pretty much right. In a nutshell, USB noise will not translate to noise in audio, but in lost packets, and that is the absolute worst case. USB communication is very stable and you would need something like an EMP generator to corrupt it. The OP is experimenting the symptom of a ground loop.Having said that, there is no need to perpetuate the snake oil myth that USB needs "filtering" or needs to be "improved" in a audiophilic (say more audiophobic) way, or in any other way. The engineers that developed the USB protocol know better, much better when asleep, than the audiophiles that came up with the idea of "improving" the USB by creating "audio-grade filters".Kind regards, Samuel Lourenço

author: Bassman59
author_rank: Super Contributor
timestamp: March 30, 2019, 04:39:12 am
content: Quote from: bloguetronica on March 30, 2019, 02:48:24 amI apologize — when I wrote above that USB audio uses asynchronous transfers, I should have been clearer and said that it uses isochronous transfers that in turn use one of three synchronization modes, which are asynchronous, synchronous and adaptive.

author: bloguetronica
author_rank: Frequent Contributor
timestamp: March 30, 2019, 12:18:43 pm
content: Quote from: Bassman59 on March 30, 2019, 04:39:12 amThanks for clearing that up. The asynchronous/synchronous/adaptive business seem to be a specificity of the audio class devices. Yes, the transfers would still be isochronous.Anyway, I still bet that this has not to do with jitter. What the OP is experiencing is a ground loop.Kind regards, Samuel Lourenço

author: NiHaoMike
author_rank: Super Contributor
timestamp: March 30, 2019, 12:40:19 pm
content: Quote from: Nominal Animal on March 29, 2019, 07:08:43 pmYou can use HDMI audio so that both the audio and video are sourced from the same master clock. The disadvantage is that HDMI is really hard to isolate.

author: drummerdimitri
author_rank: Frequent Contributor
timestamp: June 27, 2019, 04:38:34 pm
content: I've switched to toslink connection but I still get crappy noise from the amp using my sensitive IEM's while my studio monitor's balanced XLR cables are connected to the preamp section.This issue is becoming a nuissance as I've not yet found a solution. Would an isolation transformer do the trick? Will I need three? One for the preamp an one for each speaker?

author: magic
author_rank: Super Contributor
timestamp: June 28, 2019, 10:29:57 pm
content: Any balanced HP output there?Does it make a difference if the monitors are connected to mains or not?