Cable Connected, Signal Lost
Transmission lines terminate your signal if not terminatedOver at Dangerous Prototypes I got involved in a forum post about problems with an SPI bus, where the signals would not function anymore after some distance. There were two things that my experience told me: 1) check the power supply, 2) check the cabling for reflection. Then I realized, this must be a common problem for all hobby hackers. Cabling is a difficult topic and it is time to demystify some magic.
IntroductionIt is one thing to put together LEDs, a few logic chips and a CPU to make something interesting. But, it is a completely different story to connect cables to your creation and try to run various low- and high-frequency signals through them. I'm saying this not to denigrate, but the laws of physics are relentless and good cabling is an area of expertise all for and by itself.
My first encounter with the practicalities of cabling came some 20 years ago when I tried to run a 8MHz digital CGA video signal through 15..25m cables. As you can imagine, my first try did not succeed. I had learned about transmission lines almost 10 years earlier, but never had used it in practice. So, I had to read up on it and understand the problem.
The theory behind transmission lines is well understood, but can be daunting if not versed in the world of analogue electronics. Just know, there is no way you can wiggle your way out of a transmission line's path. You will encounter them at some stage in your hacking and then you need to solve your problem.
Luckily, there are a few relatively simple things you can do to save yourself from defeat. The problems that transmission lines introduce can be visualized reasonably easy, and, with a lot of pictures, I will try to show you what happens to signals of various frequency and with different transmission line connections.
So, here is an image of a signal exiting a cable:
Figure 1: A signal exiting a transmission line without precautions.This is not a nice signal anymore.
What is a Transmission Line?Any connection can be seen as a transmission line. However, the effects of are not always apparent. That is why there are several definitions of what a transmission line is. It depends on the area you work in. The thing you need to realize is that it takes time for a signal to go from one end to the other end of a cable. That is the crux of the story.
Signals in copper have a velocity of about 2/3 the speed of light (about 200000000m/s). That means: every 20cm of cable results in about 1ns (one nano second) delay. This is important to understand because it indicates how much cable it takes before you get into serious problems.
When you put an alternating signal into a cable then you can calculate that, at some frequency, your input changed state but your output still has not seen any signal. That is when things get complicated. It should be noted that you get into problems long before a whole period of your alternating signal fits into the cable.
Some of the definitions you commonly see with transmission lines are:
Measurement SetupThe local hackerspace OSAA supplied the tools necessary to make a setup. What I gathered from the shelfs:
Figure 2: Transmission line driving circuit at Low-Drive (ld) levelThe circuit is a simple 74HC04 inverter driving the cable. The power supply is set at 5V. Oscilloscope #1 probe is placed at IN_SIG/IN_GND and oscilloscope #2 probe is at the OUT_SIG/OUT_GND connections. It is important to note that the oscilloscopes do not share a common ground and both are floating. If the grounds were connected locally, then it would short-circuit the transmission line.
The Rterm resistor, which stands for termination resistor, can be mounted/unmounted. The unmounted situation is referred to as open or unterminated.
A second circuit was created to simulate a higher drive level on the cable (denoted as High-Drive or 'hd'). The remaining inverters of the 74HC04 are paralleled with 10Ω equalizing resistors. This should provide a current drive in excess of several hundred milli-Amperes. The higher drive level simulates driving cables with specialized bus- or line-driver chips.
Figure 3: Transmission line driving circuit at High-Drive (hd) levelNote for experts: The circuits are not designed for correctness, but for illustration. Real life would make some demands on the setup which are described longer down in the article.
Everything put together looks like this:
Figure 4: Measurement setup on the table
Figure 5: Breadboard and Connectors
The RJ45 connectors, as seen in figure 5 right side, were rigged in a special way. A CAT5e cable has four twisted pairs of wire and thus can provide the test with a longer cable if using the pairs connected in series. The connectors loop the pairs from end-to-end in such way that the cable's effective length is quadrupled. This makes the 20m cable into a 80m long transmission line.
The hackerspace has a lot of donated equipment. The challenge is to find two items of same brand, make and version. The probes used in the measurements are different and one is about 30cm longer than the other. As noted above, it takes time for a signal to travel through a cable. So, both probes were connected to one oscilloscope to the same signal and you get a small difference in the result:
Figure 6: Propagation delay due to 30cm of probe cable difference; click to enlargeA measured difference of 1.6ns. This may not seem much, but when trying to correlate two signals that are timing-wise not far apart, you must take cable length into account. Further below, it makes a remarkable difference in the measurement.
Note: The oscilloscope indicates a Y-axis setting of 2V/div and 0.2V/div for the channels. However, both probes are 1:10 types. One probe has a special connector-tag that lets the oscilloscope detect what type of probe is connected and adjusts the display accordingly. They are measuring the same signal in the same way.
The first measurement looks at the delay introduced by 80m of cable. In this case, both input and output were put on the same oscilloscope. This is the only measurement where input and output of the cable are on the same oscilloscope because it creates a short-circuit of the ground as mentioned before. However, this allows for showing the signal delay in a simple fashion:
Figure 7: Propagation delay on 80m cable (upper trace: input, lower trace: output); click to enlargeThe detailed view of the delay, figure 7 on the right, shows about 402ns delay, which translates into which is just about 80.4m. Really close to what is expected and therefore an acceptable result.
Measuring the Cable as a Transmission LineThe real measurements can now be performed with the setup established. What happens when a 100kHz digital signal is put onto 80m of cable?
Answer: It depends on how well you terminate your cable.
Figure 8: 100kHz low drive signal on 80m of cable (upper left: input unterminated, upper right: output unterminated, lower left: input terminated, lower right: output terminated); click to enlargeWhat happened here? The unterminated cable shows a lot of noise on both output and input. When the cable is terminated with 100Ω all seems to be well.
The answer lies in the properties of a transmission line. When you put a signal into a cable, you basically put energy into the cable. This energy will propagate through the cable until it reaches the end, which takes time, and then must exit the cable. However, if there is a very high resistance, such as an open connection or high impedance gate-input at the end of the cable, then the energy cannot exit the cable and reflects back to the input.
Some of you may have seen a school experiment in physics class with a rope. You take a rope, tighten it at one end to the wall and you swing the other end. What you see is that the pulse you sent on the rope travels along it and reflects back at the wall. A transmission line does the same thing, just with electricity.
Any transmission line has a property known as the characteristic impedance of the transmission line. It does not matter how long the cable is, it will always have the same characteristic impedance. To remove the energy you put into the cable, you must match the termination resistor with the cable's characteristic impedance. In case of a CAT5e cable that is 100±15Ω. It is a known or measurable parameter for any cable.
The reason why the characteristic impedance has to be matched with an equally sized termination resistor is based on the maximum power theorem. For maximum power transfer, you must match driving and loading impedance. Any termination resistor that does not match the characteristic impedance leaves part of the energy in the cable to reflect.
You can measure the characteristic impedance of any cable by adjusting the termination resistor (using a variable resistor) until you see no more reflection. Doing so on the used cable, with a 68Ω fixed resistor in series with a 100Ω potentiometer, gave a result of 114Ω. A value within the tolerance of the cable specification.
If you now are thinking "why don't I use a cable with an infinite characteristic impedance?" I have to disappoint you because dampening of the cable follows impedance. The higher the characteristic impedance of a cable becomes, the more difficult it becomes to transmit a signal through it. The energy of the signal you put in gets eaten by the cable and nothing comes out. The other way around, having a characteristic impedance of zero, would make a cable of no dampening (no loss). However, you would not be able to match that zero on the output, unless you create a short-circuit and that means you have no signal left either.
Using a cable, you are either doomed or damned. You have to live with the properties and match your design to cope with them.
As shown in figure 8, a moderate 100kHz signal gets trashed. Lets up the frequency a bit to 1MHz and see what happens:
Figure 9: 1MHz low drive signal on 80m of cable (upper left: input unterminated, upper right: output unterminated, lower left: input terminated, lower right: output terminated); click to enlargeAnother effect of the cable becomes apparent with the higher frequency. The edges are no longer sharp and show an exponential component, even with termination. The single gate driver cannot supply energy fast enough to the cable.
Every cable exhibits a capacitive component, which is normally specified per meter or kilometer. According to the CAT5e specification this is 52pF per meter. With a cable length of 80m that results in a capacity of 4.16nF.
Looking a bit closer at figure 9's output signals shows that the first part of the edge is steep and almost linear. The terminated case (lower right) shows that the first 1.8V rise takes about 40ns and is nearly linear. The inverter's output buffer is supplying a current of (!) for this short time.
An exponential curve follows the initial current push. The curve is based on the driver's capabilities and the cable's DC-resistance, capacity and inductance. The exact timing of the curve is a complex integral calculation beyond the scope of this writing, but sufficed to say, it is in your way and should not be there.
A significantly higher driving current is required in order to overcome the cable's capacity and make the signal look like anything "normal" again. So, redoing the low and high frequency measurements using the High-Drive circuit from figure 3:
Figure 10: 100kHz high drive signal on 80m of cable (upper left: input unterminated, upper right: output unterminated, lower left: input terminated, lower right: output terminated); click to enlargeThe higher drive current has two effects. Firstly, the energy that is put into the cable is significantly higher. Therefore, a lot of energy will reflect in an unterminated cable (upper right image of figure 10). As you can see, it can wreak havoc on the signal level and the output voltage is ≫5V.
Secondly, with proper termination, the transitions of the signal are fast and snappy again. It can also be seen that the signal is at an acceptable digital level of about 3.8V (figure 10 lower right).
The maximum output voltage of the setup is actually limited by the DC characteristics of the cable and termination. The whole cable has a DC resistance of . Please note that the whole cable's resistance is over 160m because there are two wires of 80m each. The voltage divider is comprised of the wire resistance and the 100Ω termination resistor. The voltage over the termination resistor has a maximum value of . The measurement comes very close to the theoretical value. Not bad for a test-setup.
The DC resistance of the cable should also make it clear that you cannot short the IN_GND and OUT_GND signals (see figure 2 and 3). The return path from OUT_GND to IN_GND exhibits a resistance of 15Ω and therefore has a significant voltage drop of about 0.58V.
If you short the grounds, then you remove a part of the cable and effectively create a ground-loop. Part of the return current would flow through the cable and another part would flow through the short. The problem, however, is that the lengths and transmission line properties of the cable and the short are not the same and a propagation and impedance difference between the two returns will play a significant role. I.e. BadThings™ will happen if you short-circuit the grounds.
Moving on to 1MHz frequency with high driving power:
Figure 11: 1MHz high drive signal on 80m of cable (upper left: input unterminated, upper right: output unterminated, lower left: input terminated, lower right: output terminated); click to enlargeIt should be apparent from figure 11 that the signal exiting the cable with the high drive force is acceptable when properly terminated. An estimation of the peak drive current is in the order of (!). You can imagine that there are huge stresses on a driver when putting a signal on a cable.
The high drive current required to put a signal through a cable is the reason why there are specialized bus- and line-driver chips. These chips are designed to provide a very high current for short periods and do not burn themselves out while driving cables. You should also make sure that you have proper decoupling capacitors placed with the driver chips.
Short Cable, Big ProblemSo far, only long cables were considered. However, the special thing about a transmission line is that its characteristic impedance is independent of its length. Translated into human terms: you are also doomed or damned when using short cables.
Out with the 20m patch cable, in with the 0.5m patch cable and measure the propagation delay of the signal to verify the cable:
Figure 12: Propagation delay on 2.3m cable (upper trace: input, lower trace: output); click to enlargeThe expected delay with a cable of 4 times 0.5m would be somewhere around 10ns, but the measurement shows a value that is way off. There are several factors that play a role here:
What happens when putting a moderate 100kHz signal through a not-so-long cable?
Figure 13: 100kHz high drive signal on 2.3m of cable (upper left: input unterminated, upper right: output unterminated, lower left: input terminated, lower right: output terminated); click to enlargeAnswer: You get a lot of ringing if you do not terminate your cable.
It is apparent from figure 13 (upper right) that the output exhibits a lot of ringing noise just after the transitions when you have no termination. That noise is the signal bouncing back and forth between the ends of the cable.
The 2.3m cable has the same characteristic impedance as the 80m version. The ringing is as good as gone when terminating with 100Ω, which means that the energy entering the cable has been able to exit.
Doing the same experiment at a higher frequency gives more insight into the ringing:
Figure 14: 1MHz high drive signal on 2.3m of cable (upper left: input unterminated, upper right: output unterminated, lower left: input terminated, lower right: output terminated); click to enlarge
An unterminated transmission line, carrying a signal, will show resonant ringing. That is what figure 14 upper right demonstrates. In this case, neither side of the cable is terminated. The energy put into the cable will reflect at the end of the cable, traveling back to the beginning, and reflect again. This results in a resonant wave in the cable. The wave persists until all of its energy is dissipated by the cable dampening.
The frequency of the resonance, from figure 14, is about 1/50ns or 20MHz. The reason for this specific frequency can be found in the length of the cable. The cable exhibits a propagation delay of about 12.7ns, as previously measured, and 50ns is a factor 4, give or take some measurement tolerance.
The ring frequency is correlated to the wavelength (denoted by lambda: λ) of the signal in the cable. You have to imagine the ringing as a standing wave inside the cable. When you excite the system, it will resonate at the precise frequency where the wavelength fits the cable. For resonance, you are at ¼λ or any higher overtone (the entire cable has two ¼λ wires, so the actual standing wave is ½λ). Good advice: do not let your cable ring like this. It wreaks havoc on your system.
The output voltage (figure 14 lower right) is at a "normal" 5V level when terminating the cable. Unlike the 80m cable, there is only very little DC resistance in the 2.3m cable (about 0.86Ω). So the voltage divider effect as seen in the long cable is not very pronounced. However, the output's ground connection is still not the same as the input's ground and should be treated as such.
Signal RecoveryIt's one thing to put a signal into a cable, it's another to make it into something intelligible again. There are three main problems after a signal has been through a transmission line:
The second part is a bit more tricky. The signal balance in digital logic has to do with when and how something is interpreted as '0' or '1'. There are voltages assigned to the logical values and they are rather strict and depend on the type of logic you use (HC, HCT, LVC, etc.).
The 80m cable test showed that the maximum output voltage was significantly decreased. All logic levels have been scaled by the voltage division and are no longer compatible with the logic family. A Schmitt-trigger on the cable output can only recover the signal correctly if the levels are well defined. If deviations are present, they will represent themselves in the duty-cycle of the signal.
The third problem, as mentioned several times before, has to do with the output ground being not equal to the input ground. For a long 80m cable, this would most often not present a problem, as there would be independent power supplies for each end of the cable. However, shorter cables often invite to have a common power supply, and therefore a shared ground connection.
It has already been shown that sharing ground connections is a BadThing™ when dealing with transmission lines. You must ensure that you decouple the power supplies into separate power domains for both live and ground lines(*).
Note that you only need to decouple the power supply for the electronics that recover the signal. You are free to have a global ground reference, but you must deal with local grounds introduced by the transmission lines.
(*): There are exceptions if you know what you are doing. That is advanced expert-level tinkering and you should ask your local resident Guru or Radio amateur how that works.
Figure 15: Signal recovery using a Schmitt-trigger and separated power domainsThe signal exiting the cable has to be "lifted" a bit to match the definition of '0' and '1'. This is done by altering the termination resistor so that it becomes a voltage divider and biases the cable output to be somewhere in the middle of the Schmitt-trigger thresholds.
The positive and negative going thresholds for a 74HC14 at 5V are: and .
It would be expected to set the voltage divider at 1.9V (middle of thresholds), but this should be confirmed experimentally. The termination resistor, if set at 1.9V, has a compound value of 82Ω, this falls a bit short of 100Ω, but should still be a good example. The compounding of the termination resistor is determined by the AC coupling of the upper and lower parts of the voltage divider. The power supply has a near zero resistance for AC signals. The cable therefore sees the upper and lower part parallel. For 1.9V it translates into 217Ω from 5V down and 133Ω from ground up.
Note: The only reason why figure 15 employs two inverters is to get the same polarity.
Figure 16: Signal recovery duty-cycle fixing by bias; click to enlargeReturning to the second point made, rebalancing the signal. Figure 16, upper right, shows what happens to an unterminated signal. The high-period from the source, 251.4ns, is not the same after the signal exits the Schmitt-trigger. It is off by ~40ns or almost 16%. If you are cascading transmission lines, you can imagine that there is no signal left after only few cascades.
It is important to note that the duty-cycle variations are highly dependent on the frequency of the signal in combination with the length of the transmission line. Small changes in frequency can have huge impact while some other changes may not be noticeable. Not seeing the problem is not always an indication that the problem does not exist in the design.
Adding the biased termination, figure 16 lower right, shows that the high-period is again matched perfectly. The termination resistor was tuned to bias at 1.81V (instead of the predicted 1.9V) to recover the duty-cycle. This is probably due to the termination resistor value being off a bit.
In real life, you would make a few tests of the designs and then recalculate all values to see if they fit correctly. Nobody wants variable resistors in a final design and you normally do not need any. Most designs can live with few percent deviations if designed properly.
Resonant EffectsReflection in a transmission line can create significant problems when the wavelength of the input frequency matches the length of the cable. Figure 17, below, shows the cable output at a collection of frequencies that match the 80m cable at ⅛λ, ¼λ, ½λ, ¾λ and 1λ.
It has previously been shown that the first resonant frequency in a transmission line is at ¼λ. However, any multiple of ¼λ will create a standing wave in the cable. The anti-node of the wave will always be at the end of the cable when the frequency is an odd multiple of a quarter wavelength (i.e. ¼λ, ¾λ, etc...). The end of the cable will be at a node when the frequency is any multiple of a half wavelength (i.e. ½λ, 1λ, etc...).
The problem occurs when an anti-node is at the end of the cable. The exiting voltage is a superposition of the input and the cable's resonant wave. The magnitude of the voltage at the end of the cable depends heavily on the Q-factor of the cable. The Q-factor depends on the resistance, capacitance and inductance of the cable. A high Q-factor (>1) means that the voltage measured at an anti-node will be significantly higher than the voltage put into the cable.
In the world of high powered radio signals, it is known that a resonant wave can blow your cable. The cable-internal anti-nodes can reach magnitudes that cause sparks in the cable.
Figure 17: Resonance effects at different wavelengths/frequencies (left side: unterminated, right side: terminated; upper trace: cable output, lower trace: recovered signal); click to enlarge.
The frequency of the resonant wavelength, where the cable's length equals one λ, can be calculated from the cable's propagation delay. It was measured at 402ns, which gives a frequency of about 2.5MHz. Figure 17, bottom image, shows that frequency, within tolerance.
It should be noted that a transmission line becomes completely transparent when the frequency matches multiples of the wavelength. At those frequencies all capacitive and inductive elements cancel each other out.
An interesting observation in the above image is that signal recovery is exceptionally robust. However, do not expect your hardware to live a long life when it has to cope with high voltages at the cable's output.
Matching Impedance at InsertionTransmission lines are inherently symmetrical. In terms of termination that means: what is true for the output is also true for the input (see matched load properties). Properly terminated transmission lines have following components:
Figure 18: Transmission circuit High-Drive (hd) with insertion resistorThe generator (the 74HC04 buffers) can be seen as a signal source with very low internal resistance (order of <5Ω). The 100Ω series resistor (Rterm) creates a generator with a matching characteristic impedance.
Figure 19: Termination at transmission line entrance; click to enlargeWhen the signal is put onto the cable, it will reflect at the end and travel back to the start of the cable. Back at the start it "sees" a proper termination, causing the energy to leave the cable again. Figure 19 shows that the signal and reflection are superimposed only at point IN_SIG and nowhere else.
No resonance will emerge in this setup because the signal is not allowed to reflect back and forth. Therefore, the output voltage of the cable is always stable.
The primary advantage of this setup is its simplicity. The secondary advantage is that power consumption is reduced. The driver always sees, at least, 100Ω resistance, which limits the rush current to a maximum of 50mA@5V. However, the reduced power requirement is also the greatest disadvantage because the cable capacitance cannot be overcome as easily. That means that the bandwidth of the cable is limited.
Another disadvantage is that the line-driver must cope with the reflection and have a low impedance. If used in practice, protection diodes may be required to protect the driver.
A few notes on this type of design:
Symmetric TerminationTransmission lines are supposed to be terminated at the beginning and end of the line, so goes the theory and has been described in the previous paragraph. So why not do so then?
The extra resistance makes signal recovery a difficult task. It has already been established that the 80m cable with 100Ω termination has a maximum output voltage of 3.85V, due to the voltage divider. The introduction of an additional resistor at the start of the cable for full termination at both ends would lower the maximum output voltage even further to: . At that level, the 2.4V positive going threshold of the Schmitt-trigger would never be reached and the signal is lost.
A short cable would at best give you 2.5V, which does not leave a lot of margin to play with.
Transmission of digital signals need to live up to minimum voltage specifications at the cable's output. There is no way around that unless you are prepared to add additional hardware to cope with the reduced signal level.
Power DecouplingThe problem of ground-loops has been stressed throughout the article. Creating short-circuits in the grounding may result in uncontrolled ringing at various frequencies. Said simply, there is no easy solution.
The best solution is to ensure that no grounds are allowed to connect, not even through case, earth or shield connection. However, that is not always practical and certainly not cheap. There is a relatively simple way to decouple the power supply, including ground, when power connections are carried together with data.
Figure 20: Power decoupling using a chokeEach branch of the power lines is fed through a choke (or ferrite bead). Both positive and negative leads must be coupled. The windings on the choke are wound in such way that the magnetic fields from positive and negative leads cancel each other out (no DC magnetic load).
The choke is a very high resistance for differential AC signals and that ensures that the transmission line's ground, which is an AC signal, is not connected to the power distribution. A local capacitor at each side of the choke, which is a very low resistance for AC signals, ensures that, for AC, the power supply is a local entity.
The inductance of the choke and the size of the capacitors will depend heavily on the frequency of the data signals. Lower frequencies means using larger values. It depends entirely on the design as a whole.
Distributing power like shown in figure 20 does not isolate the grounds perfectly. For example, the DC resistance of the GND return will still be influenced by the power connection. The altered DC resistance will change the voltage divider dictating absolute levels, but this should be no problem and may actually be beneficial.
Balancing the LineAn alternative to complex grounding design is to drop the ground as a reference altogether and let the signal float instead.
Dropping the ground-as-reference is done by balancing the output and using a '+' and '-' transmitter/receiver setup. The signal is conveyed through the potential difference of the '+' and '-' leads and are only reference to each other. This is also known as creating a differential pair.
Examples of transmission lines using balanced lines are RS-485, Controller Area Network, Universal Serial Bus and Low-Voltage Differential Signaling.
Balanced lines do not solve any of the other transmission line problems. Balanced lines must be properly terminated to function, just like any other cable. However, balanced line advantages are very good immunity to noise, no common reference and very high bandwidth. Disadvantages are increased design complexity and added component count to accommodate for the line-transceivers.
ConclusionThere are many more things to say about the transmission line subject. Whole books have been written about the intricacies of cables and transmission lines. I do hope you have been able to understand some of the problems with help from the provided examples. Some advice for your next design with interconnecting cables carrying digital signals:
UpdateMark sent me a link to Similarities of Wave Behavior from Bell Labs (via AT&T archives). A must watch and truly inspiring.
Many thanks to Mark and Ian for proofreading.
|Overengineering @ request||Prutsen & Pielen since 1982|