## Fiber-Optic Encoding

Namita, of Bangalore, India, writes:

"I am a telecom design engineer, working on digital systems, curious about the transmission of digital signals using fiber-optic transceivers. What data coding should I use, and why? What is the preferred logic standard for the interface to the optics module?"

For high-speed optical links I recommend you select a code with good DC balance. A DC-balanced code has, averaged over every span of length N, near-equal numbers of ones and zeroes. The value of N and the degree of balance obtained vary with the coding. For example, Manchester coding provides beautiful DC balance by defining a logic one as the two-symbol code group [10] and logic zero as the code group [01]. This approach guarantees exact equality in the number of ones and zeroes, averaged over any number of bits, provided you start counting at an exact bit boundary (starting at a position offset by one half-bit could result in an imbalance of 1 symbol).

The advantage of DC balance is the lack of informational content in the DC level, meaning that you can strip it out (with a high-pass filter) and re-insert it later without affecting the integrity of the signal. DC balance makes possible AC-coupling of your optical amplifier, simplifying the design of its automatic gain control circuits.

The 4B5B code first popularized by FDDI and then 100BASE-FX Ethernet partially addresses the AC-coupling problem. Of the 32 possible 5-bit code groups, 4B5B coding selects 16 combinations (plus a few control codes) each having either two or three bits set to one. With random data, the long-term average number of ones and zeroes is the same, however in the short term you may receive an arbitrarily long string of code-groups having only two bits set to one. The DC content of such a signal is 2/5, not 1/2, leading to a DC-offset error in an AC-coupled receiver of ten percent. The ten-percent offset error subtracts from the theoretical fifty-percent eye opening resulting in a receiver noise margin penalty of –20×log((0.5–0.1)/0.5)=2 dB.

Codes that scramble the data post-coding cannot control either the DC balance or the maximum run-length of the scrambled output.

The 8B10B code used in 1000BASE-F Ethernet improves the DC balance by ensuring that the cumulative sum of ones and zeroes transmitted never differs by no more than three. 8B10B-coded signals AC-coupled with a time constant greater than a few 100 bits suffer essentially no receiver noise margin penalty. An expanded discussion of DC wander appears in the article "DC Blocking Capacitor Value", ../news/7_09.htm.

Other considerations that may influence your selection of a data code include the amount of overhead (extra symbols) transmitted, and the range of possible control codes. Both 4B5B and 8B10B transmit one additional symbol for every four bits of useful data, amounting to an overhead of 25 percent. More elaborate codes like 64B65B substantially reduce the required overhead, and thus the number of symbols to be transmitted, but at the expense of simplicity and low latency.

Any reasonable code should include at least a few uniquely recognizable control characters for indicating word sync, start-of-frame, end-of-frame, and so forth. Most modern codes use only a fraction of the available symbol patterns, making detection of out-of-sync conditions, which show up as meaningless symbol groups, almost trivial. Designation of one control character as a special escape character opens up many possibilities for sophisticated link control.

Your PLL designer will thank you for restricting the range of minimum to maximum transition density. Both 4B5B and 8B10B perform well in this regard. The SONET codes, on the other hand, have potentially so few transitions that your PLL must occasionally coast through solid runs of hundreds of ones (or hundreds of zeroes) without losing sync-a gruesomely difficult design requirement.

Scramble the data if your product plans include links made from electrical cabling. Scrambling spreads the spectrum of your transmitted data, reducing radiated emissions from cables. If you apply scrambling, always scramble your data first, then code it, not the other way around. Codes that scramble the data post-coding cannot control either the DC balance or the maximum run-length of the scrambled output.

Whatever code you choose, terminate your electrical-to-optical link at both the source and also the receiver. This configuration (known as a both-ends termination) resists many imperfections in the transmission path, such as vias and uncertain trace impedances.

ECL, 5-V PECL, 3.3-V PECL, LVDS, and some GaAs families all work with roughly 1V signal swings on 100-ohm differential traces. Although the DC-bias levels of these circuits differ, as long as you select a DC balanced code you may use DC-blocking capacitors to interconnect any of these logic families.