Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
nocturnal1
PostPosted: Mar 10, 2008 - 05:24 PM
Hangaround


Joined: Jan 21, 2008
Posts: 308
Location: USA

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.
 
 View user's profile Send private message  
Reply with quote Back to top
glitch
PostPosted: Mar 10, 2008 - 05:33 PM
Raving lunatic


Joined: Jan 12, 2002
Posts: 7834
Location: Canada

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)
 
 View user's profile Send private message  
Reply with quote Back to top
ka7ehk
PostPosted: Mar 10, 2008 - 05:50 PM
10k+ Postman


Joined: Nov 22, 2002
Posts: 13536
Location: Tangent, OR, USA

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

Fournier RF4d - My dream plane!
 
 View user's profile Send private message  
Reply with quote Back to top
bobgardner
PostPosted: Mar 10, 2008 - 05:50 PM
10k+ Postman


Joined: Sep 04, 2002
Posts: 23464
Location: Orlando Florida

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
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
UNiXWHoRe
PostPosted: Mar 10, 2008 - 06:41 PM
Posting Freak


Joined: Nov 03, 2006
Posts: 1120


If you absolutely MUST use SPI for long runs, add in some repeaters at regular interval...
 
 View user's profile Send private message  
Reply with quote Back to top
awit
PostPosted: Mar 10, 2008 - 07:42 PM
Hangaround


Joined: May 14, 2003
Posts: 170
Location: Opole, Poland

In SPI all lines are unidirectional. This allow to using any symmetrical transmission (e.q. RS485) to increase distance of reliable transmission.
 
 View user's profile Send private message  
Reply with quote Back to top
Gluteal-Cleft
PostPosted: Mar 10, 2008 - 08:29 PM
Hangaround


Joined: Sep 11, 2007
Posts: 340
Location: USA

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


Yeah, what he said. Very Happy

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.
 
 View user's profile Send private message  
Reply with quote Back to top
peter_smith
PostPosted: Mar 10, 2008 - 10:22 PM
Wannabe


Joined: Sep 18, 2006
Posts: 65
Location: Debrecen, Hungary

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.
 
 View user's profile Send private message  
Reply with quote Back to top
nocturnal1
PostPosted: Mar 11, 2008 - 05:19 PM
Hangaround


Joined: Jan 21, 2008
Posts: 308
Location: USA

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.
 
 View user's profile Send private message  
Reply with quote Back to top
bobgardner
PostPosted: Mar 12, 2008 - 05:26 PM
10k+ Postman


Joined: Sep 04, 2002
Posts: 23464
Location: Orlando Florida

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
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
nocturnal1
PostPosted: Mar 12, 2008 - 06:46 PM
Hangaround


Joined: Jan 21, 2008
Posts: 308
Location: USA

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.
 
 View user's profile Send private message  
Reply with quote Back to top
bobgardner
PostPosted: Mar 12, 2008 - 08:42 PM
10k+ Postman


Joined: Sep 04, 2002
Posts: 23464
Location: Orlando Florida

Its a 'schmidt trigger'... it reads in a digital signal that might be noisy, and retransmits it nice and square.

_________________
Imagecraft compiler user
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
nocturnal1
PostPosted: Mar 12, 2008 - 08:54 PM
Hangaround


Joined: Jan 21, 2008
Posts: 308
Location: USA

Thank you bob.
 
 View user's profile Send private message  
Reply with quote Back to top
Kleinstein
PostPosted: Mar 12, 2008 - 10:18 PM
Resident


Joined: Sep 22, 2007
Posts: 978
Location: Germany

With long lines and steep slopes, one has to use impedance matching at the ends of the lines. Without properly terminated lines there can be ringing, which is particulatly bad on the clk line. Once using terminated lines and resonable drivers there is not much need for repeaters in between, unless you really go over 100s of meters.
 
 View user's profile Send private message  
Reply with quote Back to top
squidgit
PostPosted: Mar 14, 2008 - 05:59 AM
Raving lunatic


Joined: Sep 14, 2003
Posts: 4228
Location: Queanbeyan, Australia

In my experience you don't get a chance to have to deal with slew rates and the suchlike. Running SPI at distance (~1M) I've only ever run in to problems with noise on the clock line throwing your sync out. You need good shielding and LPFication before you even need care about waveform.

Then of course sufficient LPFication and shielding kind of Ronnie's your wanted waveforms as well...

Meh, async tx ftw!

-S.

_________________
Blag: http://www.niasdigital.com/blag
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits