Max SPI distance

15 posts / 0 new
Last post
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What is the maximium reliable transmission length for 4 wire SPI? I've search the internet and all I could find was this document which gives a fairly rough range of about 100cm but the graph is kind of difficult to read(page 3)http://www.ece.stevens-tech.edu/~bmcnair/ESRT-S05/Class%2013-14.pdf
I thought I would ask here beacause on paper and actual practice are usually different.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How far can I drive on 1L of gasoline? (I'll answer yours, if you answer mine)

The fact is, we can't answer your question with the data givem because there are many factors that will determine your maximum distance. (speed, line impedance, load capacitance, voltage.... and so on)

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One of the simple but overlooked issues is clock rate for LONG SPI connections.

Suppose that you are reading data from the remote SPI device. There is delay for the clock edge reaching the remote device. In real transmission media, it is about 0.5' per nanosecond. Then, there is the delay between the clock edge and the data being placed onto the MISO line, then (probably) the same delay for the data to arrive back at the master. This delay total MUST be less than the delay between the clock and the sample (usually the opposite edge of the SPI clock).

Thus, if you are using a 16MHz processor and running the SPI at half system clock, you have no more than 62.5ns to get the data back. If the slave has a 5ns delay between clock and data, then you have an absolute max of 57.5ns for link delay. At 0.5' per ns, that gives you a max distance of 28 feet.

Granted, this is very long compared to most SPI distance estimates, but it places an upper bound on what one can do. You can increase this value by reducing the SPI clock frequency.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA There are some answers that have no questions.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'd say get a cable with the length you need, write a test program to send and read known data in a loop, start at the highest rate, see if it works. If so, done. If not, slow clk rate down and recompile. Guitar cable is 47pf per ft. You might use this to calc a lo pass filter at the freq of interest? I bet you can go 10ft at 100K, can only go 1ft at 4mhz.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you absolutely MUST use SPI for long runs, add in some repeaters at regular interval...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In SPI all lines are unidirectional. This allow to using any symmetrical transmission (e.q. RS485) to increase distance of reliable transmission.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:
One of the simple but overlooked issues is clock rate for LONG SPI connections.

Yeah, what he said. :D

I was going to mention that I have, on one occasion, used ridiculously long wires to program a Mega8. It was horrible, I won't even admit to how bad it was. But it worked, the key item being that it ran at a slow clock speed.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You will have to use it at low speed! It is really sure.
Another thing that will be needed is to use properly shielded wires! If you bring out the SPI from the PCB you will have a lot more noise source.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So,
(1) Adjust SPI clock frequency according to connection length.

(2) Possible lo pass filter

(3) Possible repeater

(4) Use properly shielded wires

UNiXWHoRe, could you give some more details about the repeater you mentioned or a site where I might learn more.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How do you know you need it before you do the experiment? Did you say how far you have to go? Have a desired speed?

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your'e right bobgardner, I don't know that I will need one. I should and will experiment first I just haven't heard of a repeater before and I'am interested in knowing more in general.

Pages