Asynchronous USB DAC clock source - diyAudio
Go Back   Home > Forums > Source & Line > Digital Line Level

Digital Line Level DACs, Digital Crossovers, Equalizers, etc.

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 1st March 2013, 08:52 PM   #1
Hitec is offline Hitec  Finland
diyAudio Member
 
Join Date: Jan 2010
Default Asynchronous USB DAC clock source

I would like to discuss about USB DAC clock sources. I have somewhat clear vision of the DAC I am about to design but the clocking is unclear.

So I have a µcontroller equipped with USB and I2S and I have a DAC chip that has an I2S connection. Where do I get the sample clock reference? Take for instance the PCM1792 DAC. It has three clock inputs: LRCK, BCK and SCK. LRCK is the clock that tells which channel to output the current sample to, BCK is the clock that clocks single bits on the data line and then there is SCK that is the system clock.

The question is: where do I put my 100€ 0.0001ppm oscillator to? As far as I know, the µcontroller "orders" samples from the host computer and outputs them to I2S IF but does it work as a master or slave? That is, does it deliver the clock to the DAC or not?

It sounds rather "not hifi" if the DAC does not work with its own well defined clock source. Or do I just have to take care of that the µcontroller I2S buffer never gets empty and it will clock the data to I2S with low jitter? PCM1792 DS: "The PCM1792A requires the synchronization of LRCK and system clock, but does not need a specific phase relation between LRCK and system clock" --> how do I achieve this?

I have been thinking of a USB DAC for a while but I just got into details and I am in a hurry as I have to have gerbers ready on Monday and nothing is on the paper right now

And sorry if there is already a thread for this. Did not find with quick search (I have read the threads about WaveIO etc.).
  Reply With Quote
Old 2nd March 2013, 07:09 PM   #2
Hitec is offline Hitec  Finland
diyAudio Member
 
Join Date: Jan 2010
Well anyway, there is my protoboard schematic in case someone wants to review it: PCM1794A-DAC.

There is not much to see anyway. It's almost a direct copy of the PCM1794A DS "typical application circuit". I just added an oscillator to SCK. I don't yet know if I need it though. The complete prototype includes an MBED board that has USB, I2S and nice libraries so even an electronics engineer may be able to write some functional code

I will draw the layout now so lets see what pops out

Oh and I didn't draw diff2single converters as my speakers like differential inputs.
  Reply With Quote
Old 2nd March 2013, 09:49 PM   #3
Hitec is offline Hitec  Finland
diyAudio Member
 
Join Date: Jan 2010
...and here is the board.

The board is done and I still don't know how to feed the clock Well at least it has all the IOs for any clocking options I think.
  Reply With Quote
Old 3rd March 2013, 02:16 AM   #4
diyAudio Member
 
Join Date: Jun 2011
A typical USB DAC employs isochronous mode for transfer. Data is sent in bursts every millisecond. There is no error-checking and no re-transmit.

A TI DAC chip, such as the PCM2706/7 is often employed as the USB receiver. This will have a 12MHz crystal external to it providing the clock reference. The actual (audio) clock frequency is negotiated between the DAC and the USB host on the basis of the host's clock, but TI provide no details of exactly how this is achieved.

These chips have built-in audio (analog) processing, but can also be used to supply S/PDIF or I2S digital outputs.

The PCM2706 has I2S outputs which will be routed to a second DAC chip such as the PCM1792A if the design calls for a higher quality chip to be used. The PCM2706, with its external clock, will be responsible for providing the timing information implicit in the I2S outputs.

This arrangement means that no driver requires to be written for the DAC, both Windows and Linux provide a built-in audio drivers which are compatible with the PCM270x series chips. When plugged into the USB port on the computer the chip wakes up and provides information to the computer which enables the set-up of USB end-points sufficient for the normal operation of the DAC

If it is desired to employ a second clock to re-clock the data at the DAC, it would be necessary to intercept the I2S output from the chip, buffer it, and re-send it to the second DAC, in order to account for any possible differences in speed between the 2 clocks.

It is, of course, possible to implement a DAC using a uProcessor as you describe.

Here is an application note describing the setup of an (isochronous) Audio Class device using a uProc http://www.silabs.com/Support%20Docu...Docs/AN295.pdf

Later standards for USB audio exist which provide for genuine asynchronous communications, but only 3rd-party drivers exist under Windows, although an open-source driver is available under Linux. The 3rd-party drivers are not available free under Windows.

The task becomes much more difficult in this case, since a custom USB driver is required, and, since the introduction of Windows 7, Microsoft requires an expensive validation certification to create custom USB drivers. It may be possible to circumvent this using the available HID interface, but you would have to investigate this for yourself. See:- Building a PIC18F USB device - WFFwiki
  Reply With Quote
Old 3rd March 2013, 07:58 AM   #5
Hitec is offline Hitec  Finland
diyAudio Member
 
Join Date: Jan 2010
Ok thank you for good explanation. I was about to do this board using PCM2706/7 but then found out the MBEDs USB-audio libraries and thought it would be nice to try higher sampling rate than that of the PCM2706/7 (limited to 44.1k I think). And I don't touch the MS crap at home At work I am limited to it but there it doesn't matter which sound output I have.

I am not a programmer and try to avoid that kind of stuff and that's why the PCM2707 sounded tempting. But with MBED it goes like this (a bit like Arduino but with more professional goals I think):

Code:
// Hello World example for the USBAudio library
 
#include "mbed.h"
#include "USBAudio.h"
 
Serial pc(USBTX, USBRX);
 
// frequency: 48 kHz
#define FREQ 48000
 
// 1 channel: mono
#define NB_CHA 1
 
// length of an audio packet: each ms, we receive 48 * 16bits ->48 * 2 bytes. as there is one channel, the length will be 48 * 2 * 1
#define AUDIO_LENGTH_PACKET 48 * 2 * 1
 
// USBAudio
USBAudio audio(FREQ, NB_CHA);
 
int main() {
    int16_t buf[AUDIO_LENGTH_PACKET/2];
    
    while (1) {
        // read an audio packet
        audio.read((uint8_t *)buf);
 
        // print packet received
        pc.printf("recv: ");
        for(int i = 0; i < AUDIO_LENGTH_PACKET/2; i++) {
            pc.printf("%d ", buf[i]);
        }
        pc.printf("\r\n");
    }
}
I just don't know what USB audio mode it is using but I have to get into it later when I get my hands on the prototype.

But so far I don't understand why the complicated reclocking and buffering is needed (like the I2S FIFO project introduced here). I always like simple and elegant solutions. Is it really so that there exist no DACs that work as I2S masters and clock the data from the µcontroller by its own clock and the µcontroller would just take care of the audio buffering in asynchronous base.

Well I have also drawn a board that includes SRAM and an FPGA so maybe this will be my "the ultimate audio project"


EDIT: the MBED USB audio library is using isochronous mode. But there are also references that the I2S can be used in slave mode so I think it should be possible to clock the PCM1704 with its own oscillator and then to use a low jitter PLL to clock out the bits from the MBED as an I2S slave. It would buffer the samples. But is it so that the isochronous transfer mode keeps sending packets at its own pace and this will eventually lead to lost packets as the two clocks differ slightly? So I think what I want here is really the asynchronous mode.

Last edited by Hitec; 3rd March 2013 at 08:08 AM.
  Reply With Quote
Old 3rd March 2013, 06:52 PM   #6
diyAudio Member
 
Join Date: Jun 2011
It is really so that very few USB DACs have independent low-jitter clocking. USB Audio Class 2 asynchronous DACs do offer clocking from the DAC's own clock and data download from the PC on demand.

You might like to look at this thread which details a scheme for reclocking (S/PDIF data) using an FPGA and shows some VHDL: wakibaki’s Huff & Puff (FLL) asynchronous reclocking SPDIF receiver

You can see some other discussions of USB audio here:- What am I missing (async reclocking)?
  Reply With Quote
Old 24th June 2013, 09:33 PM   #7
JoelM81 is offline JoelM81  United States
diyAudio Member
 
Join Date: Jul 2007
Quote:
Originally Posted by counter culture View Post
USB Audio Class 2 asynchronous DACs do offer clocking from the DAC's own clock and data download from the PC on demand.
Strangely, TI's PCMxxxx series seems to do both. They say "USB Asynchronous Mode for Record", but also "SpAct architecture, TI's unique system that recovers the audio clock from USB packet data." I don't understand.
  Reply With Quote
Old 12th April 2014, 08:41 PM   #8
diyAudio Member
 
Join Date: Mar 2014
So if I use a USB to S/PDIF converter I'll still slave the source to the DAC?
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ES9023 DAC + USB Asynchronous Input (TAS1020B) JarekC Digital Line Level 0 28th February 2013 06:30 PM
LPC3130 for asynchronous USB to I2S jonsmirl Digital Line Level 16 11th November 2012 01:12 AM
Clock generator for 192KHz USB DAC mahen.jnk Digital Line Level 0 29th September 2010 01:07 PM
Cheap Asynchronous USB jkeny Digital Line Level 5 26th September 2009 11:24 AM
Maybe have a CD transport source USB to drive a USB DAC? wa2ise Digital Source 0 6th February 2007 12:22 AM


New To Site? Need Help?

All times are GMT. The time now is 10:03 AM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright ©1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2