FPGA generated SPDIF output

[Mike Field] just finished implementing SPDIF generation on an FPGA. SPDIF is an industry standard for transmitting digital audio signals; the acronym stands for Sony/Philips Digital Interconnect Format. It’s been around for more than a decade and since it’s found on most home-audio equipment, building an SPDIF output into your projects may be quite a desirable feature. [Mike] mentions several ideas for this functionality like building high-end test equipment, or providing a high-quality output for electronic instruments.

He first jumped into analyzing the specification in order to determine the hardware requirements. Due to some issues with jitter, he found it necessary to use a 100 MHz clock signal. This pushes the jitter down to +/- 5ns of jitter, which he concedes may raise the hackles of audio purists, but does satisfy the published standard. Output requires just one pin of the FPGA and the five components seen above. A hex inverter (74HC04) voltage divider, capacitor, and RCA connector transmit the 0.5V signal to your audio-receiver of choice. Of course, since TOSLINK fiber optic connectors use the same protocol, you could redesign the output and make this an optical connection.

Comments

  1. Dax says:

    Why is jitter a problem with digital transmission? Can’t it simply be eliminated at the recieving end by buffering the signal?

    Or is this another hi-fi voodoo argument like putting the CD player on a slab of rock and lifting the speaker cables off the floor with wooden pegs?

  2. mike says:

    SPDIF uses the data clock (on the optical/rca line) to clock the digital samples out thru the DAC

    if your playing 48khz audio, it gets that 48khz by deviding down the raw data bit clock, and any jitter in the clock then causes the freq output to waver aswell

  3. chango says:

    @Dax: Yes SP/DIF can be reclocked with a higher precision clock before going to a DAC. If a DSP is involved in the signal processing chain, this is already implicit.

  4. CDKR says:

    Would be cool to possibly also expand it to generate AES3 as well.

    AES3 is the professional digital audio standard that SPDIF as based on and is very closely related tech wise. SPIDF has some copy protection b/s bolted on.

  5. Michael says:

    As hard as I’ve looked I’ve never seen someone build something like an SDI interface for television. It would be pretty cool to build an SDI test generator. :)

  6. macona says:

    Meh, true audio purists would never be using digital. Thats a nutty crowd.

  7. Mike says:

    @DAX The jitter is an issue as the shortest pulse is only about 170ns – so the spec requiring less then 20ns jitter seems reasonable. In a perfect world my project has 10ns jitter, leaving 10ns for jitter from outside my control.

    Also crystals are not perfect time sources – they have maybe 30ppm accuracy. This adds lots of complexities when dealing with realtime sources, including DSP – if you are being given samples at 44,101hz and are sending them out 44,099hz due to differences in crystals two samples to you throw away? If you just buffer them over an hour your output will have 7,200 samples buffered and your output will be 163ms behind. Likewise, if you sending at 44101Hz and receiving at 44099Hz where do you get the two missing samples from?

    One simple solution is to follow the input clock by storing samples in a FIFO and speeding up or slowing down transmission as the FIFO fills or empties. But this introduces a small amount of FM in the resulting signal.

    The other solution is to interpolate the input signal, but then you are lose accuracy and high frequency response.

    And if you try to mix two or more real-time digital audio sources you can have a whole lot of fun!

  8. Sleahey says:

    +/-5ns, thats 0.024% clock error at 48khz… Smashing. Could use for test instruments easily.

    In my experience consumer gear sees about a 10x increase on that.

  9. Dax says:

    The third solution is phase locked loops which average the jitter of the source to get an average operating frequency. Then you add a buffer to deal with temporary swings.

  10. Pixel says:

    I’d rather have an input to build a DIY 5/7.1 decoder on the cheap.

  11. psuedonymous says:

    You’d be hard pressed nowadays to find a piece of equipment with an S/PDIF input that DOESN’T have a phase-locked-loop to deal with minor clock drift. It’s pretty much a non-issue, but has been taken up by the same sector that tries to sell you $1000 power cables, as it allows them to take their existing marketing material and do a find-and-replace of ‘noise’ with ‘jitter’.

  12. Coda says:

    >It’s been around for more than a decade

    True, in fact more than 2 decades. The first piece of SPDIF equipment I had was an interface to connect the Atari Falcon’s DSP to the SPDIF of an audio recorder. That was about 1992 I believe.

  13. Howie says:

    TOSLINK has been around since 1983 according to the ever-reliable Wikipedia. Since Sony and Phillips (the S and P in S/PDIF) are the developers of the CD audio format, which was released in 1982, it seems like it’s nearer 3 decades…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 96,725 other followers