SPI Bus implementation  - Page 1
Forum section: electronics / projects

author: gogoman
author_rank: Regular Contributor
timestamp: July 01, 2016, 04:56:56 am
content: looking for feedback implementing a single SPI bus.hi need some helpthe application requires a spi bus connected to 4 peripheral devices.A possible configuration is a star pattern, leading from the micro to each peripheral.The distance to each peripheral is ~ 3 feet away.The SPI clock is 2.5mhz and robustness is mandatory.Would a differential line be an over kill (one/leg) , or would a single ended design be adequate?Suggestions?thanks

author: rs20
author_rank: Super Contributor
timestamp: July 01, 2016, 05:47:39 am
content: What exactly would differential SPI look like? When you say "differential", do you mean truly active differential signalling (with active differential drivers and receivers inbetween your SPI masters and slaves), or in your mind is a single-ended line with a ground line next to it classed as "differential"?Is this 3 feet in ribbon cable, or across a PCB? Is the enclosure shielded? What sort of environment are we in? There are far too many variables here for us to give a simple answer. I could certainly contrive situations where single-ended over 3 feet of ribbon cable would work just fine.You can measure or simulate the amount of noise coupled onto the lines, and you can use the datasheets for the devices involved to see the drive levels and guaranteed input ranges. These things should allow you to calculate the margin of error you're working with.

author: gogoman
author_rank: Regular Contributor
timestamp: July 01, 2016, 11:33:19 am
content: "What exactly would differential SPI look like? When you say "differential", do you mean truly active differential signalling (with active differential drivers and receivers inbetween your SPI masters and slaves), "-Yes active differential signaling, possibly using a LTC491 or similar(ti make a bunch)" in your mind is a single-ended line with a ground line next to it classed as "differential"?""-no, single ended"Is this 3 feet in ribbon cable, or across a PCB?"-short run through a pcb then out a cable to a destination, most likely a ribbon"is the enclosure shielded? What sort of environment are we in? There are far too many variables here for us to give a simple answer. I could certainly contrive situations where single-ended over 3 feet of ribbon cable would work just fine"-un-shielded enclosure, industrial environment.

author: Jeroen3
author_rank: Super Contributor
timestamp: July 01, 2016, 12:16:04 pm
content: You'll need drivers anyway. I wouldn't run bare mcu lines off PCB.It's up to you if you use twisted pair wire to allow differential pair signalling, such as UTP. If you use simple ribbon cable, just make robust drivers. As in RS-232.

author: Fungus
author_rank: Super Contributor
timestamp: July 01, 2016, 12:48:46 pm
content: Quote from: gogoman on July 01, 2016, 04:56:56 amYou have two choices if robustness is important:a) A packet-based protocol with checksum/retransmit.b) RS485 or similar (eg. your LTC491).(a) Doesn't sound like an option, so...(nb. Advice given without knowing anything about the application or environment, is it a secret?)

author: nctnico
author_rank: Super Contributor
timestamp: July 01, 2016, 07:19:25 pm
content: I'd use at least differential signalling. RS485 drivers are a good choice for this kind of application. Shielded twisted pair would be a good choice but standard ethernet cable will also do.

author: gogoman
author_rank: Regular Contributor
timestamp: July 02, 2016, 03:00:21 am
content: differential is the way to go, thanks for the input

author: Delta
author_rank: Super Contributor
timestamp: July 02, 2016, 03:22:59 am
content: Single ended + 3ft cables + 2.5MHz + industrial environment =

author: David Hess
author_rank: Super Contributor
timestamp: July 02, 2016, 07:23:58 am
content: SPI signals are all undirectional so if you are driving them from the center of the star (clock and data out), then there is no problem; whatever appropriate termination scheme can be used. The data in signals would usually be a problem though; 3 feet at roughly 1.5 nanoseconds per foot is 4.5 nanoseconds. That leaves plenty of time (200 ns) for reflections to settle with a 2.5 MHz (400 ns) clock. That also means that no special precautions are needed for the data out because it will also have time to settle before the SPI clock latches the data. So only the SPI clock signal and maybe chip selects need to be carefully terminated to prevent false triggering.3 feet is not all that far and I assume the endpoints all share a common ground so differential signalling will not be needed. Just keep the signal lines physically close to ground return lines. I would use low value series termination resistors on all of the drivers and carefully check the clock endpoints for potential problems; maybe use a RC termination for the clock and chip select lines.If the signals are all point to point without a common clock, data out, and data in, then things are easier.