What happens when the opposing end of a serial link disconnects, powers down, or becomes disabled? The results may surprise you.
For example, when a link disconnects, your receiver may be so sensitive that it picks up crosstalk from your own local transmitter. That "self-reception" can trick your system into thinking it is in communication with the far end of the link when actually it's just sending packets to itself!
Circuits that detect the disconnected, powered-down, or disabled conditions are called carrier-detection circuits. The simplest forms of these circuits rely on separate interface pins that run parallel to the data path. These pins inform the receiver about whether the far end is disconnected, powered down, or intentionally disabled in a simple, although pin-wasteful, manner.
If your circuit is dc-coupled with logic 0 and 1 defined as 0V and VCC, respectively, then carrier detection is as simple as looking to see whether you have lately received any ones. The dc-coupled approach is useful only on short links within a single chassis in which you expect little or no signal attenuation. On a link that incorporates any sort of automatic gain control (AGC), you will find the dc-coupled approach quite useless. Once a link disconnects, AGC just turns up the gain until your receiver hears nothing but white noise, at which point the recovered data stream includes a copious mixture of ones and zeros.
Long serial links built with AGC usually rely on one of four approaches for carrier detection.
- You code the data stream to ensure dc balance (see "Fiber-optic encoding," EDN, Jan 10, 2002). The resulting coded data stream is a purely ac signal with no average dc content. A separate dc bias is then superimposed on the transmitted signal. The receiver uses complementary lowpass and highpass filters to separate the dc bias from the ac data signal. Averaging the bias over many bits before making a decision makes the bias-detection circuit adequately reliable.
- The receiver incorporates an envelope detector that responds only to the peak-to-peak amplitude of the received signal. The envelope detector responds to three states: 1, 0, or off. To accomplish this trilevel discrimination, the envelope detector must use thresholds spaced more tightly than those of a simple binary data discriminator. In the presence of any appreciable noise, the tightly spaced thresholds render the envelope detector inherently less reliable than a simple binary data discriminator. Averaging the detected envelope over many bits before making a decision makes the envelope detector adequately reliable.
- The receiver looks at control voltages within the AGC circuit and infers from these voltages the amplitude of the received signal. This approach uses the envelope detector already built into the AGC. It suffers the same loss of reliability and the same need for averaging as the second approach.
- You add extra overhead bits to the data stream. The coding on the overhead bits is such that random errors in the data stream tend to produce violations of the overhead coding rules. The receiver detects those errors and uses the frequency of occurrence of code violations to determine whether the link is working. This method, like the other three, requires observation of large numbers of bits before you can make a reliable determination. For example, on start-up, if you observe a long string of valid data bits, it is impossible to reliably determine whether the string is the result of a valid received signal or merely random white noise until you have observed a large number of bits (perhaps several thousand). Conversely, during live operation, a single bit error might hardly constitute sufficient cause to drop the carrier-detection signal, especially if the link incorporates error-correcting codes. Given one error, you must wait to see whether more follow before declaring the link nonfunctional.
The fourth approach does a good job of directly measuring the bit-error rate of the link. This direct measurement protects you from a lot of possible faults in cabling, connector, and transceiver circuitry. For that reason, on a long serial link, I advocate some combination of approach four with approaches one, two, or three.