# Wire length, EMI and comms failures

I am designing a system which has a lot of wires. These pass power, communications (RS422), ethernet and even analogue video (NTSC,PAL). Now, these wires meander all over the place. One of the wires was an SPI wire that was about 25-30 cm long and was sending a clock of approx 8MHz or so. Now, the communication was failing quite often.

Now, I reduced the length to about 4 cm and the system worked well. So, I would like to do an analysis on the wire lengths in my system and its impact. How can I do that? Also are there any simulation tools or papers that can help me proceed in this ?

• Use a twisted pair for that SPI wire. Reduce some of the magnetically-induced synchronous noise. – analogsystemsrf Aug 21 '17 at 4:53
• No luck with that as well. – Board-Man Aug 21 '17 at 5:30
• Use a shielded cable most probably a twisted pair... – Solar Mike Aug 21 '17 at 5:35
• That solves the issue. But it was a combination of shielded and smaller length cables that did the trick. So, how can I simulate the effects of length in this scenario ? – Board-Man Aug 21 '17 at 5:36
• Probably not your issue here (I think the wires would need to be even longer, but I could be wrong), but keep in mind that signals don't propagate instantly. They are bound by the speed of light, and, on top of that, if impedences aren't matched there will be reflections that will delay the signal propagation further. – Essaim Aug 21 '17 at 16:36

So, I would like to do an analysis on the wire lengths in my system and its impact. How can I do that ?

If you know the current on the line and resistance, then you will know how much voltage it will generate when the return current goes through the ground. This can be modeled on paper. Either measure the wire or find an AWG chart and estimate it. This type of noise from switching return currents is called common mode noise.

Another thing you will need to account for is inductance, each wire functions like an inductor because when currents flow through a conductor they generate a magnetic field. There can be mutual inductance from one wire to the next when wires are ran together, it may be necessary to design the cable with a transmission line for the return current of the signal. Or use twisted pairs to reduce this effect.

If you can estimate or measure the inductance and resistance, you can use a spice package such as LT spice to model parasitic effects. At speeds over ~50MHz transmission line effects and capacitance will also come into play, however these are harder to model and are probably best measured.

In any case, you need to be able to take a cable and reduce it into a circuit. Remember that a wire has resistance and inductance, if you have two conductors and an electric field between them, you have a capacitor. The real world its too difficult to model all that goes on, you will never have a perfect model. The goal is to try and model all of the relevant dynamics in a circuit so you can get the answers you need to come up with a proper design.

There are also 3d FEM field solvers that you can draw parts up with 3d cad programs and tell the solver what kind of current or voltage is on the wires, the solver then solves all of the EM field equations and can give you the answers. In almost all cases, this type of analysis is just as time consuming as testing the actual physical wires. With the cost of such software in the 10k\$ it's usually not worth it.

Are there any tools that can help me automate the whole system ?

No, you will need to do this yourself.

Also are there any simulation tools or papers that can help me proceed in this ?

A good start would be to read Electromagnetic Compatibility Engineering by Henry W Ott

One of the wires was an SPI wire that was about 25-30 cm long

Wire or cable?

If you used, say, one wire per SPI signal, but forgot the GND, then the return currents will flow wherever they can, and this can form quite a long loop, possibly with enough inductance to mess with the signal, and certainly creating an EMI problem, as it acts both as a transmitting and receiving loop antenna.

A simple way to do this is to use an IDC ribbon cable, they're quite cheap and, come with practical connectors, and the corresponding headers on your board are easy to handle (ie, not a tiny flat flex that breaks when you look at it wrong).

Now, you can use half the wires in your cable for GND. So you gave GND-Signal-GND-Signal... and each signal has its own very close ground current return conductor, thus crosstalk is low, and signals are clean. You can reduce the number of GND wires (like GND-Signal-Signal-GND) and have more signals in your cable and more crosstalk, until you reach the point of only one GND wire, and it can no longer be called "highspeed".

Twisted pair uses the same principle, enhanced by the fact it is twisted, so the EM fields of incoming noise cancel out.

Note if you have other DC lines (like power supplies) then they count as GND too. Simply place a ceramic decoupling cap near each connector, and the return current for each signal will travel in the nearest wires, GND or power, then use the decoupling cap to return to GND at the connector and into your ground plane.

and was sending a clock of approx 8MHz or so. Now, the communication was failing quite often.

Another issue, and the probable cause of your problems, is that you could have forgotten the series termination resistor on the driving side. Your signal is slow (8MHz) but frequency is irrelevant, it is the risetime that matters.

So, if you use a driver with, say, 2ns risetime, and your cable is 30cm long, this means 2.5ns roundtrip time, then no matter the frequency, there will be transmission line effects on top of the fact that your cable is an undamped LC resonator. Both effects lead to ringing and other artifacts on the fast signal edges, and if it's bad enough to deform the edges of the clock signal into double-edges, then your SPI receiver will double-clock and shift one extra bit, corrupting the transmission.

So, if whatever drives the cable has both fast edges and strong drive current, don't forget the series termination resistor, right at the cable driver.

It can also be a ferrite bead (pick the right one) or any other kind of prepackaged do-it-all ESD/EMI filter but it has to slow the edges as much as you can afford (8MHz will work with 20ns edges), terminate the transmission line and damp the LC resonance of the cable.