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.

13 thoughts on “FPGA Generated SPDIF Output

  1. 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. 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. 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.

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

  5. @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!

  6. 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.

  7. 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’.

  8. >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.

  9. 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

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.