ePanorama.net - Audio Documents


SPDIF

History

Since the early 80's, a step towards digital audio has been set by the introduction of the Compact Disc player. In the beginning, those signals stayed inside the set, and were converted to analog signals before leaving the cabinet. A new trend is to keep signals into the digital domain as long as possible, because this is the only way to keep the signal quality. To make this possible different devices must be able communicate with one another within the digital domain. Several interfaces exist to perform such tasks, from which one has grown to the audio standard worldwide: IEC958 1989-03 (consumer Part) from the EBU. In Japan an equivalent EIAJ CP-340 1987-9 is standard.

Characteristics

Standard IEC958 "Digital audio interface" from EBU (European Broadcasting Union) details:

Physical connection:

The interface

IEC958 is a newer standard which supersedes AES/EBU and also S-PDIF. The S/PDIF interface (IEC-958) is a 'consumer' version of the AES/EBU-interface. The two formats are quite compatible with each other, differing only in the subcode information and connector. The professional format subcode contains ASCII strings for source and destination identification, whereas the commercial format carries the SCMS.

Here is a short comparision table of AES/EBU and S/PDIF interfaces:

                          AES/EBU              S/PDIF (IEC-958)

Cabling                   110 ohm shileded TP  75 ohm coaxial or fiber
Connector                 3-pin XLR            RCA (or BNC)
Signal level              3..10V               0.5..1V
Modulation                biphase-mark-code    biphase-mark-code
Subcode information       ASCII ID text        SCMS copy protection info
Max. Resolution           24 bits              20 bits (24 bit optional)
NOTE: AES/EBU also exists in 75 ohm/BNC version (AES-3id-1995 standard). 75 ohm BNC version of AES/EBU is very electrically similar to 75 ohm coaxial S/PDIF shown above.

The electrical characteristics of AES/EBU are based on on RS-422, so basically any differential RS-422 chip will do as the receiver and transmitter chips. S/PDIF coaxial interface is not specificaly based on any other standard I know of (but is quite similar in signal levels and bandwidth requrements to some video signals).

Both S/PDIF and AES/EBU can, and do transfer 24 bit words. In AES/EBU, the last 4 bits have a defined usage, so if anyone puts audio in there, it has to go to something that doesn't expect the standard specifies. But in S/PDIF, there's nothing that says what you have to use the bits for, so filling them all up with audio is acceptable. Typical S/PDIF equipments only use 16 or 20 bit resolutions. While many equipments use more than 16 bits in internal processing, it's not unusual for the output to be limited to 16 bits.

Note on HDR-2 (2 pin header) interface used in some PC products:
Many modern PC CD-ROM drives and some soundcards (SB32, AWE32, etc.) have a two pin digital output connector in the back of the drive and they sometimes call that interface S/PDIF. Unfortunately the electrical signal which comes from it is not exactly what is described in S/PDIF specifications. The data format is exactly the same, but the signal is TTL level (5Vpp) signal instead of the normal 1Vpp signal. The output level might be selected to make the interfacing to other digital electronics easy when signal is travelling inside the computer (the normal output driver system and input amplifiers can be avoided). The downnside of this is that you need to build some electronics to make the signal from the CD-ROM drive to match what normal S/PDIF equipments expect.

Multi channel audio and S/PDIF

IEC958 was named IEC60958 at 1998. IEC60958 (The S/PDIF) can carry normal audio and IEC61937 datastreams. IEC61937 datastreams can contain multichannel sound like MPEG2, AC3 or DTS. When IEC61937 datastrams are transferred, the bits which normally carry audio samples are replaced with the databits from the datastream and the headers of the S/PDIF signal. Channel-status information contains one bit (but 1) which tells if the data in S/PDIF frame is digital audio or some other data (DTS, AC3, MPEG audio etc.). This bit will tell normal digital audio equipments that they don't try to play back this data as they were audio samples. (would sound really horrible if this happens for some reason).

The equipments which can handle both normal audio and IEC61937 just look at those header bits to determine what to do with the received data.

Cabling details

S/PDIF (IEC-958) uses 75 ohm coaxial cable and RCA connectors. 75 ohm coaxial cable is inexpensive, because it is the same cable as used in video transmission (you can buy a video cable with RCA connectors to connect you S/PDIF equipments together). Coaxial S/PDIF connections work typically at least to 10-15 meter distances with good 75 ohm coaxial cable.

AES/EBU-interface uses the well known symmetrical connections with transformer isolation and an output impedance of 110 ohm. The signal-level of this interface is reasonably higher than in the consumer version (3...10 volts). Because AES/EBU digital audio signals are transmitted at high, video-like frequencies (at around 6MHz) and should be handled very differently than standard analog audio lines. Commonly used XLR-3 microphone cables have various impedance ratings (30 ohm to 90 ohm typical) and exhibit poor digital transmission performance. The result is signal drop out and reduced cable lengths due to severe impedance mis-matching (VSWR) between AES/EBU 110 ohm equipment. AES/EBU signal transmission work for few tens of meters with a good cable.

There also an optical version of S/PDIF interface which is usually called Toslink, because uses Toslink optical components. The transmission media is 1 mm plastic fiber and the signals are trasmitted using visible light (red transmitting LED). The optical signals have exactly the same format as the electrical S/PDIF signals, they are just converted to light signals (light on/off). Because high light signal attenuation in the Toslink fiberoptic cable, the transmission distance available using this technique is less than 10 meters (with some equipments only few meters).

What can make difference in the sound of digital signal ?

There are two things which can cause differences between the sound of digital interfaces:

1. Jitter (clock phase noise)

This really only affects sound of the signal going directly to a DAC. If you're running into a computer, the computer is effectively going to be reclocking everything. Same applies also to CD-recoders, DAT tape decs and similar devices. Even modern DACs have typically a small buffer and reclocking circuitry, so the jitter is not so big problem nowadays that it used to be.

2. Errors

This usually causes very significant changes in the sound, often loud popping noises but occasionally less offensive effects. Any data loss or errors in either are a sign of a very broken link which is probably intermittently dropping out altogether.

S/PDIF signals

The signal on the digital output of a CD-player looks like almost perfect sine-wave, with an amplitude of 500 mVtt and a frequency of almost 3 MHz.

For each sample, two 32-bit words are transmitted, which results in a bit-rate of:

    2.8224 Mbit/s  (44.1 kHz samplingrate, CD, DAT)
    3.072  Mbit/s  (48 kHz sampling rate, DAT)
    2.048  Mbit/s  (32 kHz sampling rate, for satellite purposes)
The output impedance is standard 75 ohm, so ordinary coaxial cable designed for video applications can be used. The minimal input level of S/PDIF interface is 200 mVtt which allows some cable losses. There is no real need for special quality cable as long as the cable is made of 75 ohm coaxial cable (a good video accessory cable works also as good S/PDIF cable).

The Coding Format

The digital signal is coded using the 'biphase-mark-code' (BMC), which is a kind of phase-modulation. In this system, two zero-crossings of the signal mean a logical 1 and one zero-crossing means a logical 0.

                _   _   _   _   _   _   _   _   _   _   _   _
               | | | | | | | | | | | | | | | | | | | | | | | |
clock   0 ___ _| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_

                ___         _______     ___         ___
               |   |       |       |   |   |       |   |
data    0 ___ _|   |_______|       |___|   |_______|   |___
signal           1   0   0   1   1   0   1   0   0   1   0

                _   ___     _   _   ___   _     ___   _
Biphase        | | |   |   | | | | |   | | |   |   | | |
Mark    0 ___  | | |   |   | | | | |   | | |   |   | | |
signal         | | |   |   | | | | |   | | |   |   | | |
              _| |_|   |___| |_| |_|   |_| |___|   |_| |___

cells           1 0 1 1 0 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 0 0
The frequency of the clock if twice the bitrate. Every bit of the original data is represented as two logical states, which, together, form a cell. The length of a cel ('time-slot') is equal to the length of a databit. The logical level at the start of a bit is always inverted to the level at the end of the previous bit. The level at the end of a bit is equal (a 0 transmitted) or inverted (a 1 transmitted) to the start of that bit.

The first 4 bits of a 32-bit word (bits 0 through 3) form a preamble which takes care of synchronisation. This sync-pattern doesn't actually carry any data, but only equals four databits in length. It also doesn't use the BMC, so bit patterns which include more than two 0's or 1's in a row can occur (in fact, they always do).

There are 3 different sync-patterns, but they can appear in different forms, depending on the last cell of the previous 32-bit word (parity):

   Preamble    cell-order         cell-order
       (last cell "0")    (last cell "1")
   ----------------------------------------------
   "B"         11101000           00010111
   "M"         11100010           00011101
   "W"         11100100           00011011

Preamble B: Marks a word containing data for channel A (left)
    at the start of the data-block.

Preamble M: Marks a word with data for channel A that isn't
    at the start of the data-block.

Preamble W: Marks a word containing data for channel B.
    (right, for stereo). When using more than 2
    channels, this could also be any other channel
    (except for A).

Word and Block Formats

Every sample is transmitted as a 32-bit word (subframe). These bits are used as follows:

   bits           meaning
   ----------------------------------------------------------
   0-3            Preamble (see above; special structure)

   4-7            Auxillary-audio-databits

   8-27           Sample
  (A 24-bit sample can be used (using bits 4-27).
   A CD-player uses only 16 bits, so only bits
   13 (LSB) to 27 (MSB) are used. Bits 4-12 are
   set to 0).

   28             Validity
  (When this bit is set, the sample should not
   be used by the receiver. A CD-player uses
   the 'error-flag' to set this bit).

   29             Subcode-data

   30             Channel-status-information

   31             Parity (bit 0-3 are not included)
The number of subframes that are used depends on the number of channels that is transmitted. A CD-player uses Channels A and B (left/right) and so each frame contains two subframes. A block contains 192 frames and starts with a preamble "B":
"M" Ch.1 "W" Ch.2 "B" Ch.1 "W" Ch.2 "M" Ch.1 "W" Ch.2 "M" ...

|                ||_ sub __|_ sub _||                |
|                ||                ||                |
|__ Frame 191 ___||__ Frame   0 ___||__ Frame  1 ____|

  |
             block-start

Channelstatus and subcode information

In each block, 384 bits of channelstatus and subcode info are transmitted. The Channel-status bits are equal for both subframes, so actually only 192 useful bits are transmitted:

   bit            meaning
   -------------------------------------------------------------
   0-3            controlbits:

  bit 0: 0 (is set to 1 during 4 channel transmission)
  bit 1: 0=Digital audio, 1=Non-audio   (reserved to be 0 on old S/PDIF specs)
  bit 2: copy-protection. Copying is allowed
 when this bit is set.
                  bit 3: is set when pre-emphasis is used.

   4-7            0 (reserved)

   9-15           catagory-code:

  0 = common 2-channel format
  1 = 2-channel CD-format
      (set by a CD-player when a subcode is
       transmitted)
                  2 = 2-channel PCM-encoder-decoder format

                  others are not used

   19-191         0 (reserved)
The subcode-bits can be used by the manufacturer at will. They are used in blocks of 1176 bits before which a sync-word of 16 "0"-bits is transmitted

Electrical Interface

The electrical interface for S/PDIF signals can be either 75 ohm coaxial cable or optical fiber (usually called Toslink). Usually consumer models use that coaxial cable interface and semiprofessional/professional equipments use optical interface. The electrical signal in the coaxial cable is about 500mVtt.


Converting between AES/EBU and S/PDIF interfaces

There are differences in the electrical characteristics of AES/EBU and S/PDIF interfaces:

You can convert one electrical interface to another with a small amount of off-the-shelf hardware and a little time as you can see in the circuit below.

But the protocol used in AES/EBU and S/PDIF is not exactly the same and that can cause sometimes problems. The basic data format of AES and S/P-DIF are identical. There is a bit in the channel status frame that tells which is which. Depending upon the setting of that bit, some bits have different meanings. For example, the bits used to describe de-emphasis in the AES/EBU protocol overlap the bits used to implement the SCMS protocol in S/P-DIF land.

The big problem comes in the fact that MANY products out there are VERY picky about what they see in the bits, and even though a given signal may fall within the letter of the standard, some equipment will absolutely refuse to talk to it. Many equipments are reasonably flexible and tolerant of slight foos in the signal so the simple converters cna work on those. But a simple converter that works fine with one piece will as likely not work with another.

What are different types of IEC 958-interface

There are 2 implementations of IEC 958: consumer and professional. Those are referred in standard as IEC958 Types I and II. IEC958 professional format is same as AES/EBU but is carried over same type of coaxial or optical interface as consumer S/PDIF. IEC958 consumer format is the S/PDIF format used in CD-players. You can put an S-PDIF data stream on an AES/EBU physical balanced cable, or vice versa, and still have it be valid IEC958 data. Professional and consumer formats (Types I and II) differ only in the subcode information. In order to do track indexing, you must have a consumer format data stream (ie. an S/PDIF style data).

Jitter specifications of AES/EBU interface

The AES/EBU standard for serial digital audio uses typically 163 ns clock rate and allows up to +-20 ns of jitter in the signal. This peaks to peak value of 40 ns is aroun 1/4 of the unit interval. D/A conversion clock jitter requirements are considrably tighter. A draft AES/EBU standard specifies the D/A converter clock at 1 ns jitte; however, a theoretical value for 16-bit audio could be as small as 0.1 nsec. Small jitter D/A conversion is implemented by using separate PLL clocks for data recover and DAC and by using a buffering between data recovery and DAC.

Conversion circuits

Here are some AES/EBU and S/PDIF circuit collected from various sources. The following circuit will only convert the signal levels, not other protocol details.

Remeber that although the audio data is the same in both AES/EBU and S/PDIF interfaces, they are indeed different formats, at least in their subcode. AES converted to coax is NOT S/PDIF, and S/PDIF converted to XLR balanced is NOT AES. They are still their native format, just the transmission medium has changed. Whether they will work in your application depends on the equipment chosen.

Some DATs have a switch that selects one format or the other regardless of the physical interface, some just ignore what they don't understand (usually resulting in the generally positive benefit of ignoring SCMS encoding), and some indeed gag on the "other" format. But simply fixing the physical interface works far more often than it doesn't.

How to do different conversions using the circuit below

Here are some ideas how to make the most common conversions using the circits described below. Note: there is no guarantee that the information in this or the circuit are correct (they are believed to be correct but note tested by the author).

For every other conversion combination you can think of you can find circuits on the lis below. To build an dapter you need two parts connected after each other. After you have slected the suitable circuit parts, built them an attached them together you get the conversion circuit you want. If you need more than one output, you can connect few (1-4) output modules to one input circuitry to have more then one output.

AES/EBU to S/PDIF signal level converter

AES out:   2-------330 ohm-----+-------------   SPDIF in
                               |
           3--+              91 ohm
              |                |
           1--+------+---------+-------------
                     |
                     -
                ground

The idea for this circuit is taken from articles posted to Usenet News.

If you are looking for a professional components for 110 ohm to 75 ohm interconnection then check Canare web site where they have 110 OHM-75 OHM IMPEDANCE TRANSFORMERS.

S/PDIF to AES/EBU

                                           _
                  + 5 volt                | \
SPDIF out:          |                   +-|  O-+
                    _ +--4,7k-+         | |_/  |
              diode ^ |  _    |     _   |  _   |
       10 u (+)     | | | \   |    | \  | | \  |      100 n
O--+--+-||-+--------+-+-|  O--+--+-|  O-+-|  O-+-120 r-||-+----+-- 2
   |  |    |        |   |_/   |  | |_/    |_/             |    |
   |  +-||-+ 100n   _       2,2k |                       1 k   |
  75r               ^ diode   |  |     IC                 |    |   AES in
   |                |        --- |                       ---   |
  ---              ---           |       _                    220r
                                 |      | \           100 n    |
                                 +--+---|  O---+--120 r-||-+---+--- 3
 Diode = 1N914 or 1N4148            |   |_/    |           |
                                    |    _     |         1 k   +--- 1
                                    |   | \    |           |   |
    IC = 74HC04 or CMOS 4049        +---|  O---+          --- ---
                                        |_/
The idea for this circuit is taken from articles posted to Usenet News.


S/PDIF conversion circuit building blocks

This is a collection of S/PDIF circuits found from various sources. The circuits are presented as building blocks which have one end on S/PDIF standard signal and other end an TTL level signal. The TTL levle signal end of the circuits is designed to be the the interface which you can use to wire different modules together to make whatever S/PDIF converter circuit you want. The circuit are presented as building blocks because with this approacs you can most easily build a suitable circuit for all conversion needs.

Here are tips for building a conversision circuits for different uses:

For other conversion needs do a little thinking and you should find quite easily the answer what blocks to connect to each other.

S/PDIF output buffer circuits

Here is set of output circuit which take in TTL level S/PDIF signal in and output standard S/PDIF coax cable output signal. Those output circuit are very useful building blocks for all kinds of S/PDIF related electronics projects. All the circuits do basically the same thing. They just use different components, so use the one where uou can easily get components.

S/PDIF output buffer circuit

                                                          S/PDIF output
                                                          (RCA or BNC)
                            |\ 
TTL level signal -----+-----| O-----680R--+---------+    +------- center pin
                      |     |/            |         |    |
                      |                   |          )||(
                      |     |\            |          )||(
                      +-----| O-----680R--+          )||(
                            |/            |          )||(
                                        100R        |    |
                          74HC04          |         |    +------- ground
                                          +----+----+ T1
                                               |
                                              ---
Idea for this circuit is taken from "A digital Output for the CD720" web page (was at http://www.spiceisle.com/homepages/brian/audiodiy/mods/digi-out.htm). The transformer T1 is high quality 1:1 pulse transformer (can be salvaged from old broken network interface card or similar source).

Another S/PDIF output circuit


                            |\
                      +-----| O-----------+
                      |     |/            |               S/PDIF output
                      |                   |  100nF        (RCA or BNC)
                      |     |\            |   ||      T1  
TTL level signal -----+-----| O-----------+---||----+    +-------+--75R--- center pin
                      |     |/            |   ||    |    |       |
                      |                   |          )|| |       | 
                      |     |\            |     15   )||(  3    220R
                      +-----| O-----------+    turns )||( turns  |
                      |     |/            |          )|| |       |
                      |                   |         |    |       | 
                      |     |\04          |         |    +-------+-------- ground
                      +-----| 0-----------+         |   
                            |/                     ---
   
                          74HCU04                     

This circuit is part of circuit "Splitter for S/PDIF coax/optical output" by T. Giesberts from Elektor Electronics magazine July/August 1995 pages 78-79. The transformer T1 is made to G2.3-FT12 ferrite ring core. Primary coil is 15 turns of 0.5 mm diameter enamelled copper wire and secondary is 3 turns of 0.5 mm diameter enamelled copper wire. The chip 74HCU04 is manufactured by Philips

The circuit in the magazine had 3 outputs. The two extra output were made by adding two more output coils to T1 and the output resistors.

Output circuit with transformer used as impedance matcher

This circuit is taken from Digital One V. 1.1 documentation. Digital One is from NET-Labs and is designed by by Enland Unruh.

                                                               S/PDIF output

                            IC1              0.1 uF        0.1 uF     
                            |\                ||            ||
TTL level signal -----------| +-----750R--+---||----+    +--||--- center pin
                            |/            |   ||    |    |  ||
                                          |          )||(
                                          |          )||(
                                          |          )||(
                                          |          )||(
                                        499R        |    |
                                          |         |    +------- ground
                                          +----+----+ T1
                                               |
                                              ---

T1 is a HF-transformer which has 2:1 turns ratio. Transformer type used in example circuit is SC944-05. IC1 in this circuit consists of 8 parallel connected buffer ports from 74ACQ244 IC.

Output with 1:1 pulse transformer

This is the recommended S/PDIF output circuit from Crystal Semiconductor CD4237 single chip multimedia audio system IC datasheet page 71.

                                                               S/PDIF output
                            IC1                                       
                            |\                                
TTL level signal -----------| +-----374R--+---------+    +------- center pin
                            |/            |         |    |    
                                          |          )||(
                                          |          )||(
                                          |          )||(
                                          |          )||(
                                       90.9R        |    |
                                          |         |    +------- ground
                                          +----+----+ T1
                                               |
                                              ---
The transformer used in this circuit is 1:1 pulse transformer (the original application note suggested pulse transformer from Pulse Engineering or Schott Corporation). IC1 is a buffer IC which must be capablw to supply enough current to drive the 75 ohm S/PDIF interface to full votlage swing specified (capable of loading 415 ohm load or capable of supplying 12 mA current).

Simple S/PDIF output without galvanic isolation


                            |\
                      +-----| O-----------+
                      |     |/            |               S/PDIF output
                      |                   |  150nF        (RCA or BNC)
             |\       |     |\            |   ||        
TTL level ---| o------+-----| O-----------+---||-----374R---+----- center pin
signal       |/       |     |/            |   ||            |
                      |                   |                 |
                      |     |\            |                93R1
                      +-----| O-----------+                 |
                      |     |/            |                 +----- ground
                      |                   |                 |
                      |     |\            |                ---
                      +-----| 0-----------+   
                      |     |/            |
                      |                   |
                      |     |\            |   
                      +-----| 0-----------+   
                            |/

                          74HTU04                     
This circuit does not provide any isolation on the output. The TTL level signal form 74HCT04 buffer is attenuated to the levels specified in S/PDIF optical interface by using the voltage divider made of 374 ohm and 93.1 ohm resistors. This circuit is based on S/PDIF converter circuit diagram from Elektor Electronics magazine issue 4/1997 page 66.

Simplest TTL to S/PDIF coax interface

         100nF
  TTL ----||-----330ohm--+--------- coax S/PDIF signal out
  in                     |
                      100ohm
                         |
 Ground -----------------+--------- coax signal ground
This ricuit interfaces directly to the TTL level output provided by some sound equipment (CD-ROM or soundcard). This circuit works if the equipment which gives out TTL level has powerful enough TTL output to run this circuit (enough current output capability). If this simple circuit does not work reliably, then you need to build a circuit which includes the buffering electronics.

Isolation transformer for S/PDIF output

If your equipment (for example sound cards) has an S/PDIF output which does not have an isolation transformer at the output, you can easily add the transformer to it by putting a suitable transformer afther the original output.

Elector Electronics magazine issue 7-8/1999 recommend building the transformer for S/PDIF isolation in the following way:

The transformer must have good coupling factor, so the transformer core must be a toroidal core made of high permiability material. The prototype described in the magazine uses Philips Type TN13/7.5/5-3E25 core which has permiability rating (yt) of 4500. THe primary and secondary windongs consisted of 6 turns of 0.5 mm diameter enamelled copper wire laid on opposite sides of toroid. The transformer used in this prototype was described to have a bandwidth raged from 50 kHz to 17 MHz, which is more than adequate for an S/PDIF link.

The transformer should be fitted directly to the source and the receiving end must be protperly terminated for reliable operation. The reason for this is that the transformer input and output impedances are not exactly 75 ohm.

S/PDIF input circuits

The following circuits can be used to convert S/PDIF signals to TTL level signals which can be connected to any suitable output circuit or directly to digital electronics.

S/PDIF coax input circuit


                                   +----10K--+                       
                      10 nF        |         |
                       ||          |    |\   |        |\
S/PDIF input ------+---||----100R--+----| O--+---+----| O----- TTL out
                   |   ||               |/       |    |/
                  75R                           10K
                   |                 74HCU04     |
                  ---                           ---
This circuit is part of circuit "Splitter for S/PDIF coax/optical output" by T. Giesberts from Elektor Electronics magazine July/August 1995 pages 78-79. The chip 74HCU04 is manufactured by Philips

Another input circuit


                            +----10K----- +5V
                            |     /\ 
                           ---     |
                     4700 pF       |    
                       ||          |    |\            |\
S/PDIF input ----------||----------+----| O-----------| O----- TTL out
(+/-500mV)             ||               |/            |/
                                             
                                         7404    

The capacitor works as DC blocking capacitor. 10 kohm trimpot signal raises its ground potential to the point that Hex Inverter IC1 recognizes the difference between a digital 1 and 0 input. When you firt test the circuit then first addjust 10 kohm trimmer to the center and then adjust it so that the circuit receivers the S/PDIF signal well. If you have a voltmeter, you can adjust the trimpot to show around 2.6V at pin 1 of the IC. The inverter buffers the input and produces TTL 0-5V output signal. This circuit does not provivide the 75 ohm termination resistor, so you need to add it if you have problems because of cable signal reflections. This circuit is ppart of Coax Digital Out to MD circuit design.

Optical S/PDIF output circuit

Optical TOSLINK output

                        ________________
                      4|             ___|
 TTL signal -----------|            /
                       |           |
                      3|           |
 +5V--4R7--+-----------|           |
           |          2|   TOTX173 |
           +---8k2-----|           |
           |           |           | 
          === 100 nF   |           |
           |          1|            \___
           +-----------|________________|
           |          
          ---
The 4.7 ohm resistor and 100 nF capacitor make a filter against digital noise in +5V power source. The Toslink transmitting module used in this circuit is TOTX173 from Toshiba. This circuit is a part of circuit diagram from Elektor Electronics magazine issue 4/1997 page 65.

TORX173 and TOTX173 module pinouts

Toshiba optical receiver & transmitter modules used for S/P-DIF TORX173, TOTX173 top view:

    opto
   +----+
  6.    .5
   +....+
    1234         
Pin  TORX173     TOTX173
1    out         GND
2    GND         R
3    Vcc         Vcc
4    GND         in
5    case(GND)   case(GND)
6    case(GND)   case(GND)

Vcc  +5V (use 0.1 uF decoupling to GND)
         (use 47 uH choke to connect Pin 3 to Vcc for TORX)
R    8.2 kOhm to Vcc                       
TORX and TOTX are both high active and are CMOS/TLL logic compatible.

More information and datasheets is available at Toshiba optoelectronics components web page TOSLINK section.

Very cheap optical S/PDIF output

With TOSLINK modules available for as low as $10 it hardly seems worth it to bother with the trouble of making your own TOSLINK module due to the fact that the ones from Sharp have a built-in connector and are much easier to interface. But if you really want to make your own optical output interface, you can do it because S/PDIF optical (Toslink) transmitter is just basically a red LED coupled to the optical fiber. So to build a very basic output circuit you only need a red LED and a resistor, both available from any place where electronic components are sold.

The circuit is very simple:

                   _____
TTL signal -------|_____|---------+
                                  |
                                 ---
                                  V  LED
                                 ---
                                  |
    Ground -----------------------+

The idea of the circuit is that the digital data is fed through a series current limiting resistor to the LED (typically LEDs only require 5-30mA). A digital 0 is 0V and the LED is off. A digital 1 is +5V and the LED is on. That's it!

If for some reason the circuit does not work, try to change the LED and also try to connecting it better to the optical fiber. NOTE: Not all LEDs will work, so you may have to experiment a bit. Optimally, you want a high-brightness RED LED with a typical wavelength of 660nm.

If swapping the LED doesn't work, you might want to try using a hex inverter (7404 or similar IC) to buffer the signal. This might be good practice too, just in case the TTL SPDIF output of your source device isn't designed to handle a 20~30mA load this circuit generates.

Optical S/PDIF output circuit

Optical TOSLINK receiver

       _____________
      |___          |1
          \         |----------------- TTL output
           |        |
           |TORX173 |3
           |        |----+----coil47uH----- +5V
           |        |    |
           |        |   === 100 nF
           |        |2   |
           |        |----+
           |        |4   |
           |        |----+
           |        |5   |
           |        |----+
           |        |6   |
        __/         |----+
       |____________|    |
                        ---

The 47 microhenry coil and 100 nF capacitor make a filter against digital noise in +5V power source. The Toslink receiving module used in this circuit is TORX173 from Toshiba. This circuit is a part of circuit diagram from Elektor Electronics magazine issue 4/1997 page 66.

TORX173 and TOTX173 module pinouts

Toshiba optical receiver & transmitter modules used for S/P-DIF TORX173, TOTX173 top view:

    opto
   +----+
  6.    .5
   +....+
    1234         
Pin  TORX173     TOTX173
1    out         GND
2    GND         R
3    Vcc         Vcc
4    GND         in
5    case(GND)   case(GND)
6    case(GND)   case(GND)

Vcc  +5V (use 0.1 uF decoupling to GND)
         (use 47 uH choke to connect Pin 3 to Vcc for TORX)
R    8.2 kOhm to Vcc                       
TORX and TOTX are both high active and are CMOS/TLL logic compatible.

More information and datasheets is available at Toshiba optoelectronics components web page TOSLINK section.


Other related information

Who makes AES/EBU digital audio transceiver chips ?

DSP FAQ mentions that Sony, Crystal Semiconductor, Motorola and Yamaha have all AES/EBU tranceiver chips available. DSP FAQ contain more information about AES/EBU chips at http://tjev.tel.etf.hr/josip/DSP/FAQ/42.html. Same companies which have AES/EBU chips have also SPDIF chips and some chips can handle both formats.

Information sources