Author Topic: SPI over 1.5m distance  (Read 2852 times)

0 Members and 1 Guest are viewing this topic.

Online ricko_ukTopic starter

  • Super Contributor
  • ***
  • Posts: 1150
  • Country: gb
Re: SPI over 1.5m distance
« Reply #25 on: October 10, 2024, 12:01:28 am »
Thank you Tim for both details explanations, much appreciated! :)

@varjag, yes I did as mentioned in the O.P. That was the whole point of posting here asking for other suggestions. They are very expensive for that project.
 

Offline varjag

  • Contributor
  • Posts: 10
  • Country: no
    • My blog
Re: SPI over 1.5m distance
« Reply #26 on: October 10, 2024, 05:14:04 pm »
Oh my apologies: it's ridiculous that I somehow missed this.
 
The following users thanked this post: ricko_uk

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 17363
  • Country: us
  • DavidH
Re: SPI over 1.5m distance
« Reply #27 on: October 12, 2024, 10:15:50 am »
I have just a couple comments:

1. When used point-to-point, the transmission line does *not* have to be terminated at both ends to prevent reflections.  Driving one end with a voltage *or* current with the other end parallel terminated produces a clean full level transition at any point.

2. Source termination halves the output level which would be a problem if logic levels have to be preserved.  The implication is that if no source termination is used with a logic level driver, logic levels will be preserved and a normal gate can be used as a receiver.

3, In a bus application, both ends of the transmission line must be terminated, however current or voltage drive at any point along the transmission line can be used without series termination.  The driver sees two parallel transmission lines so drive impedance is halved.

A couple years ago I had a remote GPS timing receiver that used RS-232 levels and I needed a level shifter for the long cable.  I did not have any suitable ICs handy, so I designed and built a discrete level shifter using 2N3904 and 2N3906 current mirrors to drive the output which would saturate at their compliance voltage producing the proper levels.  The constant current driving the cable capacitance produced an incredibly clean ramp waveform despite the lack of any cable termination.  With the current chosen and the cable capacitance, transitions were about 50 nanoseconds, but I could have increased the current to make it faster.

My point here is that there are slightly more complex discrete solutions for the drivers which simply the transmission line and termination requirements.
 
The following users thanked this post: Nominal Animal

Online ricko_ukTopic starter

  • Super Contributor
  • ***
  • Posts: 1150
  • Country: gb
Re: SPI over 1.5m distance
« Reply #28 on: October 12, 2024, 03:06:12 pm »
Thank you David :)
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 6330
  • Country: es
Re: SPI over 1.5m distance
« Reply #29 on: October 12, 2024, 04:48:24 pm »
LVDS driver over UTP cable definitely seems a good idea. Cheap and common, can use a simple ethernet cable found anywhere.
TI made some testing here:
https://www.ti.com/lit/an/slla053b/slla053b.pdf
« Last Edit: October 12, 2024, 04:57:22 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: Nominal Animal

Online Siwastaja

  • Super Contributor
  • ***
  • Posts: 9205
  • Country: fi
Re: SPI over 1.5m distance
« Reply #30 on: October 12, 2024, 05:42:01 pm »
First try something like ribbon cable with groun - signal - ground - signal - ground pinout and 47R series termination resistors (resistors at driving pins, which on SPI is easy since every signal is unidirectional; MISO resistor is at slave, other resistors at master). Maybe that gives good enough signal integrity with bog standard single-ended signalling. That is how computer systems were built for decades, think about IDE and other clocked parallel buses. 1.5m is of course longer than typical IDE cable but not like different order of magnitude.
« Last Edit: October 12, 2024, 06:05:55 pm by Siwastaja »
 

Offline uer166

  • Super Contributor
  • ***
  • Posts: 1017
  • Country: us
Re: SPI over 1.5m distance
« Reply #31 on: October 12, 2024, 07:01:54 pm »
2. Source termination halves the output level which would be a problem if logic levels have to be preserved.  The implication is that if no source termination is used with a logic level driver, logic levels will be preserved and a normal gate can be used as a receiver.

Is this really true though? It halves the output level *at the transmitter*, but that voltage is doubled when it hits a high-impedance receiver, at the end of the transmission line so you do get 100% of it back where it matters. If the receiver is also terminated, then it will get 50% of the swing.
 

Offline Smokey

  • Super Contributor
  • ***
  • Posts: 3001
  • Country: us
  • Not An Expert
Re: SPI over 1.5m distance
« Reply #32 on: October 12, 2024, 10:09:54 pm »
LVDS driver over UTP cable definitely seems a good idea. Cheap and common, can use a simple ethernet cable found anywhere.
TI made some testing here:
https://www.ti.com/lit/an/slla053b/slla053b.pdf

This sounds like a great idea!  :)
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 17363
  • Country: us
  • DavidH
Re: SPI over 1.5m distance
« Reply #33 on: October 13, 2024, 12:43:38 am »
2. Source termination halves the output level which would be a problem if logic levels have to be preserved.  The implication is that if no source termination is used with a logic level driver, logic levels will be preserved and a normal gate can be used as a receiver.

Is this really true though? It halves the output level *at the transmitter*, but that voltage is doubled when it hits a high-impedance receiver, at the end of the transmission line so you do get 100% of it back where it matters. If the receiver is also terminated, then it will get 50% of the swing.

You are correct, but let me explain.

If the transmission line is open, then the series termination at the source divides with the transmission line impedance to make a half level incident wave, which doubles restoring the original value once it reflects off of the open end of the transmission line.  If the transmission line has a parallel termination on the end, then there is no reflection and the level remains at half.

The problem with the first case is that the signal level at the receiver starts out at half, and then doubles to full once the reflection gets back, which makes detecting the level tricky unless the receiver is only at the end.  The trouble with the second case is that the signal level is halved so likely will not work with logic level receivers.

In a party line application with a bus where multiple receivers are present, series termination is not used.  Standards like LVDS, RS-485, 10Base-2, and GTL (Gunning transceiver logic) work this way.

My weirdo compliance limited current output RS-232 driver that I described worked this way also, but managed without termination at all.  I never followed up in detail, but I suspect saturation of the current mirror output presented the proper series termination impedance once the output reached full voltage.  There are some tricky terminations which use the non-linear impedance of a diode this way.
 

Offline coppercone2

  • Super Contributor
  • ***
  • Posts: 11214
  • Country: us
  • $
Re: SPI over 1.5m distance
« Reply #34 on: October 13, 2024, 12:45:12 am »
SPI over 1.5 mile distance.

Is it possible?
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 17363
  • Country: us
  • DavidH
Re: SPI over 1.5m distance
« Reply #35 on: October 13, 2024, 02:29:40 am »
SPI over 1.5 mile distance.

Is it possible?

Even with a physical interface that can work at that distance, it would be awfully slow, like 50 kHz, because the clock has to wait for propitiation of the data.  It could be pipelined, but then it is not really SPI.

RS-485 can do 100 kb/s at 4000 feet, so sure, 1.5 miles is possible for SPI using the right drivers and receivers.  It would not even be all that difficult.
« Last Edit: October 13, 2024, 02:36:02 am by David Hess »
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22436
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: SPI over 1.5m distance
« Reply #36 on: October 13, 2024, 03:03:33 am »
LVDS driver over UTP cable definitely seems a good idea. Cheap and common, can use a simple ethernet cable found anywhere.
TI made some testing here:
https://www.ti.com/lit/an/slla053b/slla053b.pdf

I see absolutely no study of CM immunity, and the EVM is common-ground.  Presumably the cable is set on the bench with minimal/no source of CM noise as well. Wouldn't be surprised if that's still what dominates the received noise?

CAT5 has no ground wire or reference plane defined, so this is a terrible idea in practice.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline ejeffrey

  • Super Contributor
  • ***
  • Posts: 3998
  • Country: us
Re: SPI over 1.5m distance
« Reply #37 on: October 13, 2024, 03:04:09 am »
SPI over 1.5 mile distance.

Is it possible?

Only at low speed.  SPI requires the slave to drive transitions on the falling edge of the clock and the master samples on the rising edge.  That means the round trip time has to be << half the clock period.  For typical cable (velocity factor 0.7) that would limit you to under about 20 kHz.  If you are ok with that then SPI should work fine as long as you can control the ground potential offsets.
 

Offline Smokey

  • Super Contributor
  • ***
  • Posts: 3001
  • Country: us
  • Not An Expert
Re: SPI over 1.5m distance
« Reply #38 on: October 13, 2024, 03:04:42 am »
SPI over 1.5 mile distance.

Is it possible?

(not a super long distance transmission expert... )
You probably want a current loop for signaling over that distance right, with some pretty high compliance voltage at the transmitters?
 

Offline Smokey

  • Super Contributor
  • ***
  • Posts: 3001
  • Country: us
  • Not An Expert
Re: SPI over 1.5m distance
« Reply #39 on: October 13, 2024, 03:08:22 am »
LVDS driver over UTP cable definitely seems a good idea. Cheap and common, can use a simple ethernet cable found anywhere.
TI made some testing here:
https://www.ti.com/lit/an/slla053b/slla053b.pdf

I see absolutely no study of CM immunity, and the EVM is common-ground.  Presumably the cable is set on the bench with minimal/no source of CM noise as well. Wouldn't be surprised if that's still what dominates the received noise?

CAT5 has no ground wire or reference plane defined, so this is a terrible idea in practice.

Tim

Differential SPI would only need three pairs (6 wires) and a chip select per slave.  If you could still run the chip select single ended, then you could use the 8th wire in a cat5 as the ground reference maybe.  Don't some of the higher speed cat ratings spec shielded cables?
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22436
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: SPI over 1.5m distance
« Reply #40 on: October 13, 2024, 03:10:08 am »
SPI over 1.5 mile distance.

Is it possible?

Even with a physical interface that can work at that distance, it would be awfully slow, like 50 kHz, because the clock has to wait for propitiation of the data.  It could be pipelined, but then it is not really SPI.

RS-485 can do 100 kb/s at 4000 feet, so sure, 1.5 miles is possible for SPI using the right drivers and receivers.  It would not even be all that difficult.

If you have a CLK return line, the round trip delay evens out; you need a second SPI channel to receive it, it won't be in sync with the source.  Depending on length and delay matching, synchronizers may be required along the way (which can also counter line loss).

Undersea telephone cables (analog) I think had amplifiers every couple of miles? And significant compensation filters of course.  That was a few MHz of BW, up to a few 10s in the later generations before fiber took over i think.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15683
  • Country: fr
Re: SPI over 1.5m distance
« Reply #41 on: October 13, 2024, 03:29:43 am »
SPI over 1.5 mile distance.

Is it possible?

How about 250,000 miles?
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 7132
  • Country: fi
    • My home page and email address
Re: SPI over 1.5m distance
« Reply #42 on: October 13, 2024, 03:32:50 am »
When the distance exceeds 100m, I go for fiberoptics.  SFP transceivers are quite affordable.

Don't some of the higher speed cat ratings spec shielded cables?
Well, no, it's a separate cable classification.   Basically, S/FTP = foiled twisted pair with shield (each pair with a foil shield with a common wire mesh shield), F/FTP = foiled twisted pair with foil shield (each pair with a foil shield with a common foil shield), U/FTP = foiled twisted pair unshielded (each pair with a foil shield, no common shield), F/UTP = twisted pair with foil shield (only one common outer foil shield), U/UTP = unshielded twisted pair (no shields, most common cheap type).  The category refers more to the frequency characteristics of each individual pair.

For example, if you intend to install some Ethernet cable for use with security cameras powered over Ethernet, you might choose outdoors-rated Cat 6A S/FTP cables, and make sure the conductors are not CCA (copper-clad aluminimium).  Some of them are rated for direct underground installation, too.

How about 250,000 miles?
Laser link.  "Traditional" SPI at such distances makes absolutely no sense, unless you use star-sized emitters and Very Low Frequencies.
« Last Edit: October 13, 2024, 03:40:12 am by Nominal Animal »
 
The following users thanked this post: Smokey

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22436
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: SPI over 1.5m distance
« Reply #43 on: October 13, 2024, 05:21:49 am »
You might not consider it SPI anymore, but joining clock with data as Manchester coding for example, negates differences in propagation delay, and then you can modulate it on light as above for example.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 4822
  • Country: dk
Re: SPI over 1.5m distance
« Reply #44 on: October 16, 2024, 02:08:32 pm »
SPI over 1.5 mile distance.

Is it possible?

Only at low speed.  SPI requires the slave to drive transitions on the falling edge of the clock and the master samples on the rising edge. 

doesn't have to be, SPI is very losely defined to say the least, and how your use the clock edges is a matter of the trading setup for hold
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf