Electronic – Short Distance Board to Board Communication

signal integrityspi

My MCU runs a SPI bus with about 4 devices. I'd like to extend this bus to be off board as well i.e. have some PCBs connect to the "main" board and extend the functionality. The "pad to pad" distance would be:

trace length of main board + Cable length + trace length on the extending board

3" + 6" + 3" = about 12"

In my experience, even a 1 MHz signal, with about 7 ns rise times, over this distance via a ribbon cable was overshooting by over 1 V (but there was no excessive ringing). The boards will be powered by the same power supply.

enter image description here

Note: You can't see the rise times here but you can see the excessive overshoot – this is a 3.3V signal. And yes, this was measured properly with a very short wire from the probe to ground. Much like it's often recommend on this site. I don't think it's a measurement error.

I'd like the system to work at 4 MHz but 2 MHz is also acceptable. The max. number of boards I'd like to connect would be about 4 and this would extend the SPI bus to have about 12 devices. I don't think this would be too difficult to manage via code as I already have something working like this. Having the additional slave select lines is also not an issue.

However, my concern is how to send the SPI data from one board to another. Should I just send straight SPI or convert it to LVDS at one end and then convert it back into SPI on the other end?

Best Answer

Rule-of-thumb says you have to calculate transmission line effects in if your connection length is longer than 1/10th of the signal's wavelength.

enter image description here

Transmission lines will cause reflections where they show a sudden change in impedance. The reflected signal adds to the original, may reflect again at the transmitter side, and that way go back and forth. The result is shown in the graph: the overshoot you're talking about, and some ringing.

A 12" wire length (30cm) is 1/10 of a 3m wavelength, or 100MHz. 1MHz, and even 4MHz shouldn't give much problems here. Terminating the line, like Wouter says, could be a first measure, though. The input is probably high impedance, and that's never a good matching. Since you have three different pieces in your connection (PCB, wire, PCB) finding the characteristic impedance will be difficult. (It will also be different for the PCB and the wire, so at very high frequencies you'd also get reflections at the cable's connections.) Given the short length and the low frequency the value of your terminating resistor is not critical. 100\$\Omega\$ may be too low for the microcontroller, most of them can't supply 33mA (or even 50mA, at 5V). I would try a 1k\$\Omega\$ resistor to start with, and see how far that gets us.

edit (re question update)
Rise time seems to be 7ns. That's fast, like Kortuk says, it means you have a spectrum at least to 400MHz, and those harmonics will indeed suffer transmission line effects, even if your clock is only 1MHz. Try to filter them out, a 20MHz bandwidth (80MHz for the 4MHz clock) gives you more than enough rise time. This is a 1MHz square wave filtered with a brick wall LPF at 20MHz:

enter image description here

Placing a series resistor will form a first order LPF with the line's capacitance. If we estimate that at 50pF then

\$ R = \dfrac{1}{2 \pi \cdot 100 MHz \cdot 50 pF} =32 \Omega \$

gives you cutoff frequency of 100MHz. So a 33\$\Omega\$ series resistor should decrease your rise time, but leave more than enough to have a good signal at 4MHz.