USB ADC/DACs as high resolution, low distortion test gear? - Page 1
Forum section: electronics / testgear

author: splin
author_rank: Frequent Contributor
timestamp: October 31, 2014, 11:42:44 pm
content: I'm looking for high resolution, >= 24bits, data capture and signal generation for frequencies up to 12kHz, preferably from DC but 20Hz up would do. A nice flat frequency response with ripple of the order of 0.1dB or less and linear phase in the passband and very low distortion would be good. Absolute accuracy is not essential as I could use a HP 34401A to 'calibrate' signal levels. (A flat response would be very helpful here so that 'calibration' would only be required at one or two frequencies). It would be mainly used for frequency response and distortion measurements so one-shot capture and sophisticated triggering is not too important.High performance audio ADCs (eg. PCM4220, CS5381) and DACs would seem to be ideal for this purpose and relatively cheap compared to precsion ADCs and DACS. As a bonus, the high end parts also sample at >= 192kHz so can be used for signals above the audio range if required. So I wondered if anyone here is using USB audio ADC/DACs for this purpose? A USB isolator would be essential to prevent damage to the PC in the event of careless usage and to avoid grounding poblems.There are plenty of cheap USB soundcards which should provide lower performance at less cost. I'm sure there are many who use their PC/laptops sound input and outputs directly for data capture and signal generation but I don't think I want to take that risk.I'm guessing there are alternative or better solutions in the form of purpose made test equipment based on audio converters but with proper switchable attenuation rather than simple potentiometers for setting levels, and input protection etc. Whether the cost is acceptable is another matter.Any suggestions? I don't particularly want to spend more than say $150 so the highest performance converters may be out of reach. One problem with USB audio DACs and ADCs is that those with the highest performance converters seem to be in the Audiophool category with attendant outlandish prices etc. Anti-alias filtering might also be a problem with sharp filtering messing up the phase and amplitude of the middle to top end of the passband.Apologies if this has already been covered extensively, but I haven't spotted it yet.Thanks,Tony H

author: Howardlong
author_rank: Super Contributor
timestamp: November 01, 2014, 04:12:54 am
content: I use a TLV320AIC3204 extensiveley, about $3 in qty 1k.I run it at 192kHz. Note that the ADC anti aliasing filter is at 20kHz rather than Fs/2 even at 192kHz unless you do some jiggery pokery in the digital domain (ie lossless). There is also some noise floating around at about 85kHz +/- which I've always presumed is an on chip LDO. You can use your own LDO if you wanted to. Neither of these would be a problem for you if you are only interested in 12kHz or less. Of course the noise is not there if you use the prescribed 20kHz filter.A point to note is that no audio ADCs approach the full dynamic range theoretically afforded to 24 bits, and I am sure a lot of the time it's merely marketing mantra. Bearing in mind you'd also often be buffering your ADC inputs with LPFs anyway, the noise considerations of those needs very careful design to support the dynamic range and SNR of the ADC.If you want stereo 24 bits at 192kHz even half duplex you will have to use high speed USB. If you use the USB audio standard, you are restricted to isochronous frames and for a full speed (12Mbps) USB interface: isochronous frames in USB fulll speed are limited to 1023 bytes every 1ms. 24 bit stereo 192kHz exceeds this.The main benefit of using the USB audio standard is that you won't need to supply or write any drivers for most operating systems, with Android being about the only one I'm aware of that doesn't support the USB audio standard out of the box.

author: commongrounder
author_rank: Frequent Contributor
timestamp: November 01, 2014, 12:58:50 pm
content: Have you checked out the QA400 audio analyzer. At $199.00, it is pretty close to your price point and seems to have the features you are looking for:https://www.quantasylum.com/content/Products/QA400.aspx

author: splin
author_rank: Frequent Contributor
timestamp: November 01, 2014, 03:34:57 pm
content: That's interesting but I really don't have the time to build my own.QuoteTrue - the dynamic range of the best audio ADCs top out at around 124dB or just over 20 bits and providing an input buffer which doesn't significantly degrade the noise and distortion performance isn't trivial. The question is whether a suitable product is available in my price range, given that a USB isolator is around $50.QuoteThe TLV320AIC3204 does have some useful features, especially the PGAs and the o/p amplifiers , but its performance appears to be somewhat mediocre looking at the datasheet with its ADC THD and SNR performance being similar to the 12 bit ADCs in an STM32F303 microcontroller using oversampling. That's comparing typical figures - the worst case spec is -70dB THD+N (mostly THD given the minimum A-weighted SNR is specified at -80dB, probably equivalent to around -77dB unweighted); to put that into perspective, tahts worse than many 10 bit ADCs! Eg. the 10 bit ADC101S101 max THD is 3dB better at -73dB - though the SNR is of course much worse.If I did have the time to build my own I wouldn't be looking to save < $20 using a TLV320AIC3204 rather than a PCM42222 (108db < THD+N < 121dB typical) and PCM1794 DAC.The USB audio limits are interesting but only a problem for 192kHz stereo so not a big problem for my intended usage. USB 2.0 goes much higher than 12Mb/s so I guess that commercial USB ADCs/DACs will provide suitable USB drivers.

author: splin
author_rank: Frequent Contributor
timestamp: November 01, 2014, 03:49:09 pm
content: Quote from: commongrounder on November 01, 2014, 12:58:50 pmThat looks interesting, but I can't see any specifications or the user manual. Is the USB isolated? Are the inputs and outputs protected?Also as I'm in the UK, no doubt the cost to me would be much greater than $199 when you include the exhorbitant shipping charges from the US (especially when you factor in the extra 20% VAT charged on the shipping cost).

author: Howardlong
author_rank: Super Contributor
timestamp: November 02, 2014, 06:14:32 am
content: True, the '3204 won't win against some of the dedicated ADCs out there. In my application, SNR and dynamic range is the most important facet, and in practice in my application it's in excess of 100dB across most of the spectrum on the 3204. As I mentioned, there are some nasties wondering around at 85kHz though. THD isn't such a big deal in my application.I mentioned the USB high speed/full speed thing because depending on how you're going to do your interface it will have a significant impact of your choice of microcontroller, if you go that way. Be careful not to confuse USB 2.0 with USB high speed, they are not the same! Microchip, for example has plenty of USB 2.0 compliant microcontrollers but only the latest PIC32MZ series support high speed.

author: tszaboo
author_rank: Super Contributor
timestamp: November 02, 2014, 09:43:18 am
content: The problem you are facing has to do more with the brown noise. You want to generate signals in the pink noise region, and that makes everything really complicated. If you dont have a very stable reference voltage, if you dont use chopper amplifiers, you will end up with a system, which only has very small resolution. The noise will dominate everything.Audio ADCs are not particularity suitable for this. A lot of them only has internal current reference and they need a resistor for the stability. That will not take you too far.

author: splin
author_rank: Frequent Contributor
timestamp: November 02, 2014, 04:59:21 pm
content: Quote from: Howardlong on November 02, 2014, 06:14:32 amCan't argue with that; horses for courses etc.QuoteAh, that's worth knowing. Investigating USB capability on microntrollers is something I had on my todo list to so that's very interesting - thanks. I see the STM32F4 devices for example have high speed USB peripherals but only a full-speed PHY, whereas the LPC4370 does include a high speed PHY.

author: AlessandroAU
author_rank: Regular Contributor
timestamp: November 03, 2014, 04:30:18 pm
content: Thishttp://www.analog.com/static/imported-files/eval_boards/EVAL-AD7760_7762EDZ.pdfPlus thishttp://www.analog.com/static/imported-files/eval_boards/EVAL_CED1Z.pdfWith oversampling you can get really great performance throughout the audio range, or just pretty good up to 1.2mhz or so.

author: Howardlong
author_rank: Super Contributor
timestamp: November 04, 2014, 12:28:32 am
content: Quote from: splin on November 02, 2014, 04:59:21 pmCoincidentally, the LPC4370 is the device I am working with at the moment. It's a very complex beast, it's almost like NXP decided to make every facet of the device as complicated as thet could. Just the clocking scheme alone takes some time to master. It does offer two high speed USB interfaces, one with integrated high speed PHY, and it works, I did a speed test and managed in excess of 300Mbps of real data throughput without any attempt at optimising. The BGA package is a PITA though. I managed to reflow the 100 pin 0.8mm pitch BGA device onto a breakout board in the toaster oven myself on the second attempt. The first attempt left a couple of balls not making contact, I tried reflowing it again and that fixed the two non-working balls but broke abouth three new ones, so I trashed that one and did a new reflow that worked perfectly. On that second attempt, I tested every pin was connected by measuring the presence of protection diodes on each pin with a multimeter.It's a seriously well featured device, it's now mature enough for production, but it's just a hell of a bitch to learn particularly if you're new to NXP devices.

author: Bassman59
author_rank: Super Contributor
timestamp: November 04, 2014, 03:50:38 am
content: Quote from: 3roomlab on November 02, 2014, 05:12:09 pmDiscussion about that thinghere.

author: Bassman59
author_rank: Super Contributor
timestamp: November 04, 2014, 03:57:28 am
content: Quote from: splin on November 01, 2014, 03:34:57 pmIf you want to use High Speed USB because you need to support sampling at greater than 48 kHz/24-bit/stereo/full-duplex then you must use USB Audio Class 2.0. The older Audio Class 1.0 works only with Full Speed USB (it does work with USB 2.0, only at Full Speed).That in and of itself is not really a problem. But ... Microsoft has never supported Audio Class 2.0 with a native Windows driver, even in Windows 8. It's actually kind of absurd. So if you're designing an Audio Class 2.0 device you need to write the driver or buy it from Jungo or whomever. Mac OS X has supported Audio Class 2.0 natively since 10.5.So, yes, if you are buying a USB audio DAC/ADC that supports AC 2.0 the vendor will provide drivers.

author: Howardlong
author_rank: Super Contributor
timestamp: November 04, 2014, 06:29:47 am
content: +1 to Bassman. But at least Windows has USB Audio 1.0, unlike Android that supports no USB Audio at all, although I believe that might change soon. Another problem is the latency aspect which may or may not be a problem for your application, and that needs to be dealt with from the ground up in whatever platform you target. That's pretty much why OS X and IOS rule the roost in most professional and live audio applications.

author: splin
author_rank: Frequent Contributor
timestamp: November 05, 2014, 02:48:06 pm
content: Quote from: 3roomlab on November 02, 2014, 05:12:09 pmIf you read the discussion linked to by Bassman59 you might have second thoughts - its seems to have some 'issues' especially with USB.

author: splin
author_rank: Frequent Contributor
timestamp: November 05, 2014, 07:38:39 pm
content: Quote from: AlessandroAU on November 03, 2014, 04:30:18 pmThat's a very good point - I've looked at various ADCs in the past but had gotten it into my head that the top audio ADCs such as the PCM4222 were quite a bit better. Looking again and it's not so clear: the AD7760's dynamic range is spec'd at 120.5dB (typ, input shorted @ 78kSPS) compared to 121dB (typ, -60dB 997Hz input @ 48kSPS) for the PCM4222. So probably a wash - or even a win for the AD7760 if you can achieve the theoretical 2dB gain due to the 78k/48k oversampling rate.And whilst THD is a bit better for the PCM4222 for a high level input (-108dB THD+N @ -1dB 997Hz compared to -105dB THD @ -0.5dB 1kHz) the AD7760 is much better at lower levels (PCM4222 -61dB THD+N @ -60dB compared to -75dB for the AD7760). Operating the AD7760 in low power mode improves THD by approx 4dB at the expense of approx 2dB loss of SNR. So lots of flexibility in sampling rates and SNR/THD trade-offs depending on what measurements are important. In addition, the non-audio ADCs are spec'd down to DC and have significantly better gain and offset drift specs.The TI ADS1675 is also a contender with similar specs to the AD7760, but an even higher maximum sampling rate of 4MSPS.Interestingly 20-bit SAR ADCs such as the 1MSPS LT2378-20 and the 1.6MSPS MAX11905 can also give give the above a run for their money; the SNRs are roughly 3 or 4dB worse but have rather better THD specs. The former claims -125dB @ 2kHz, but this rises rapidly with frequency to -96dB @ 200kHz, unlike the sigma-delta ADCs which have relatively flat distortion levels versus frequency, but I'm not sure why that is. The MAX11905 has even better specs for THD of -125dB @ 10kHz rising to -107dB at 250kHz.Since I don't have time to layout, build and debug a PCB with my choice of ADC, the AD7760 wins hands down - the eval board is available from rs-online for approx $58 - less than a third the cost of the rest (where even available).The EVAL_CED1Z is much more expensive though so I'm considering interfacing the 7760 eval board to something like an STM32F4 discovery board to send the samples to the PC over the (Full speed only!) USB. Main problem is that the 7760 I/O is 2.5V so will need to do some level translation. If I lowered the STM32F4 voltage from 3V to 2.5V then I guess the USB I/F is going to be a problem? Not looked into it yet.Of course all the above is based on datasheets and I note that Tggzzz has the tagline "There are lies, damned lies, statistics - and ADC/DAC specs" so reality may be very different!Tony H

author: splin
author_rank: Frequent Contributor
timestamp: November 05, 2014, 08:27:59 pm
content: Quote from: Bassman59 on November 04, 2014, 03:57:28 amReading that thread on the QA400 you linked to it seems that USB audio in Windows is a complete mess which is why the QA400 developers chose to use a proprietry USB protocol, but screwed things up by only providing 2k bytes of buffering, approx 5ms, in the device. I know very little about Windows USB handling but that looks like a sure recipe for buffer overruns...If I bought a USB ADC/DAC with a vendor provided AC 2.0 driver would I be able to write an application that has access to the raw datastream from the ADC which hasn't been mangled by the Window's mixer/WDM black magic?

author: AlessandroAU
author_rank: Regular Contributor
timestamp: November 06, 2014, 02:52:55 pm
content: Quote from: splin on November 05, 2014, 07:38:39 pmIf you find a solution without having to the the CED1Z let me know!I would not think the STM32F4 would be sufficient for the data rates? I've seen a Xilinx Spartan-3 FPGA used before.This could be a good reference (http://wwwhome.cs.utwente.nl/~ptdeboer/ham/sdr/Ctrl+F for AD7760)

author: Marco
author_rank: Super Contributor
timestamp: April 29, 2015, 11:18:28 am
content: Quote from: splin on November 05, 2014, 07:38:39 pmSorry for the necro, but I'm just wondering if anything ever came of this? Was tempted by the low price on the AD7760 evaluation board too before seeing the CED1Z's price.To me the STM32F4 looks poorly suited by the need for an external PHY for high speed though, UC3-A3 Xplained board might be able to do it (they have example code for their other board using the same chip pushing 12 MB/s over USB), Beaglebone black with PRU (pretty well documented nowadays) or an i.MXxx board with SDMA are also options.

author: splin
author_rank: Frequent Contributor
timestamp: April 29, 2015, 06:34:28 pm
content: Quote from: Marco on April 29, 2015, 11:18:28 amNot yet - too many other diversions and demands have put this on the back-burner for now though I'd still like to do it. Your right about the STM32F4 not being ideal, its just that I have an F407 discovery board and wondered if I could use that, possibly operating the AD7760 at reduced sampling rates.Given the desirabilty for USB isolation to avoid the risk of blowing the PC up by coming into contact with the wrong voltage, I'm beginning to think that Ethernet might be a better option. USB isolators are quite expensive and I don't know of any that support high speed mode. It would also avoid the difficulties of writing a USB driver for the PC.That begs the question of what cheap development boards exist with 100Mbit+ Ethernet and a processor fast enough to keep it supplied with data and read the 24-bit, 2.5MSPS ADC data from the 16-bit data bus. Any suggestions?

author: Marco
author_rank: Super Contributor
timestamp: April 29, 2015, 07:09:17 pm
content: The Beaglebone Black has it and i.MXx boards generally have fast ethernet, for microcontrollers thisLPCXpresso boardlooks attractive.

author: splin
author_rank: Frequent Contributor
timestamp: April 29, 2015, 09:41:05 pm
content: Quote from: Marco on April 29, 2015, 07:09:17 pmThat does look good for the price. Are there out of the box TCP/IP stacks available that can be included without having to spend weeks working out how to integrate it and getting it working reliably? What sort of UDP throughput might it achieve on that 180MHz M3? The read timing of the AD7760 is a bit awkward so it might not support the maximum 2.5MSPS AD7760 rate using interrupt driven I/O, though it may be possible to use timers to generate the CS and RD/WR_ signals and to trigger a DMA read of a GPIO port. Tricky though; I know various people have not been able to get timer triggered DMA GPIO reads working on STM32F4s. Don't know about the LPC18S37.The Beaglebone Black also looks interesting but I'm sure I read a thread where somebody (who sounded like they were competent) couldn't get it to work reliably with later releases of Linux so I'd be a bit wary without more research. However your suggestion did make me think about the cheaper Raspberry pi 2; I had previously rejected the original because of the very limited I/O - 17 GPIO isn't enough to interface to the AD7760 directly. Having just looked at the new version it has 21 GPIOs.The question remaining is how fast it can read from the AD7760; a bit of research suggests that at 2.5MSPS, doing two 16 bit reads every 400ns within an interrupt might just be possible but lower rates shouldn't be a problem.

author: Marco
author_rank: Super Contributor
timestamp: April 29, 2015, 09:52:22 pm
content: When running from internal flash the LPC's seem to be able to get close tothe limits of fast ethernet. I have read some bad things about the DMA on their Cortex M4's too, butthis appnote with codeseems to be pretty close to what's needed for event driven DMA transfers.Even with preempt_rt interrupts are not going to cut it on a Pi running Linux, latencies are counted in 100s of uS even for real time linux ... you really need either a programmable DMA engine (PRU, SDMA, or even simply a dedicated core doing nothing but bitbanging in a multicore micro which is how Red Pitaya solved it in the end I'm told) or the ability to trigger DMA on a pin transition like with the example I posted (for some obscure reason this functionality even though you would assume it would be standard is very very rare).PS. actually that LPC board I picked is far from the most appropriate, there arecheaper/betterones with fast ethernet support ...

author: Marco
author_rank: Super Contributor
timestamp: May 02, 2015, 09:08:07 pm
content: Here'ssomeone who did something similar with the Pi ... if you take a look at the scope picture he took you can see why it's impossible, he needed nearly 10 uS worst case for the read. Now that's 8 channels, but even if we cut that by 10 it's still way too slow.The FIQ takes care of Linux being terrible at real time, but the instructions to read Pi's GPIOs are very slow (and since the GPIOs are not sequential in memory you need a lot of reads).Beaglebone Black with PRU or the LPCXpresso4337 (with the Cortex M0 simply bit banging, easier than trying to use DMA ... you'd need some external circuitry for that to generate pulses) seem the most realistic options.