Is long SPI cable earth shield needed?

Status
Not open for further replies.

mortonkopf

Well-known member
Hi All. I have been working on project with an SPI bus driving eight chained port expanders (MCP23S17) with T3.6, a set of Adafruit Trellis button pads, and an ILI9341 screen. Moving from breadboard to a more permanent setup I extended the SPI bus wires and immediately ran into problems with signal integrity. Lots of malfunctioning at the rotary encoders that are attached to the chips. I thought it was my soldering, that perhaps a trace had broken on my homemade PCB, or that I simply blew something. As i was resoldering, switched on again after I was done and I moved the data and clock lines to the first chip. Immediately there was an improvement in chip response. I then realised that every time I touched these lines, there was a response of some kind.

So, I found that I was acting as an earth. I wound an earth wire around the SPI data and clock, and hey presto, perfect functioning of high speed polling of chips.

Question is, do you think that it could be that the SPI bus needs this shield, or am I masking something more fundamental about a poor circuit that will come and bite me later. When I say 'long' cable, I am only talking of moving from 10cm to 30cm in length.

All the best.
m
 
10" or 25cm is about the 'recommended max' length for SPI wiring. If you want to go longer you better reduce the SPI clock and add impedance matching. You can do this by adding 68Ohm of 100Ohm series resistors as close to the driving part as possible (e.g. between the Teensy SPI pins and the wire). This also seems to be Pauls' suggestion.

Shielding the wire is of course always a good idea. You can also use twisted pair cabling to reduce EMI, but be sure to terminate it properly (120Ohm). Make sure all parts share a low-impedance ground!
 
@Epyon - thanks for the response. Looks like I missed impedance matching in a big way. I think that I will take the time to redo the wiring design entirely. I am a long way off low-impedance ground when I think about the potential for inductance in the current wiring setup.

much obliged.
 
@Epyon - thanks. initial tests show good signal without reducing the clock speed, by using termination resistor at source. However, early days and still some further tests to do.
 
i use 4 foot 22 gauge solid wire between a t3.5 spi2 bus to a bank of 8 mcp23s17 port expanders, straight, using only an external pullup on CS. there are no series terminating resistors either, or shielding for that fact. your mileage will vary depending on your project, but theres no problems here (knock on wood), running at 2MHz.

usually decreasing the SPI speed cures long distance issues as well if you have, so better to test it to find out how well it works for you in your project as well as not only ask opionions, because everyone has different opinions, some want to follow "standards", others will want to "flame", but trying it out doesnt hurt, if you do have "ringing" on your lines, you may also add ~100ohm series on the lines driving outputs, but like i said, you may not need it depending on the SPI speed and cabling
 
I'm always happy to hear alternative solutions to a problem. The variability of my acid etched pcbs, and my dodgy soldering only increase the potential for unintended consequences. I suspect that this may be one of the issues why using interrupts with the MCP23s17 chain was not working well. Polling, on the other hand was rock solid until the move to longer SPI cable. tests continue.
 
I have an ILI8341 display around 6 feed from my Teensy 3.2. I too have home made PCB boards but i'm using a Serial cable (DB9) from board to board. I have no issues. but have a place for a 100 ohm serial resistor on the data lines. i'll use if needed, but so far so good.
 
Status
Not open for further replies.
Back
Top