Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

SPI Maximum distance

Status
Not open for further replies.

TXRX

Full Member level 2
Joined
Mar 7, 2012
Messages
121
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
2,083
Hi,

See attached, I have a SPI communucatin between Master to Slave only in ONE DIRECTION, the SPI clock is 1MHz and there is MOSI line, What is the maximum distance that it can reach ?

Thanks,

Doron
 

Attachments


barry

Advanced Member level 5
Joined
Mar 31, 2005
Messages
4,858
Helped
1,068
Reputation
2,146
Reaction score
1,053
Trophy points
1,393
Location
California, USA
Activity points
26,513
Since you are only going from master to slave, you have a little more latitude. But it still depends on your cable, drivers, etc. How far do you WANT to go? Even though you don't have to worry about the problems associated with reading from the slave, you still have to be concerned about signal degradation; i.e., your nice, square clock could be a mushy mess by the time it gets to the slave end of your cable.
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
17,464
Helped
3,945
Reputation
7,888
Reaction score
3,815
Trophy points
113
Activity points
115,783
Hi,

You need at least two other wires:
* GND
* CS....even if you have one device, and maybe you think it can be enabled all the time....you need it to synchronize the datastream.

How long:
* depends on many parameters.
* cable
* driver circuit
* receiver circuit
* frequency
* signal levels
Impossibe that anyone here can give you a reliable distance value.

If you want it for a very long distance then you may use RS422/RS485 differential signaling. For sure with appropriate cables and proper termination

Klaus
 

barry

Advanced Member level 5
Joined
Mar 31, 2005
Messages
4,858
Helped
1,068
Reputation
2,146
Reaction score
1,053
Trophy points
1,393
Location
California, USA
Activity points
26,513
GND is not part of the SPI requirement. And SS MAY be required, but some slaves don't require it, although you'll probably avoid problems if you use it.
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
17,464
Helped
3,945
Reputation
7,888
Reaction score
3,815
Trophy points
113
Activity points
115,783
Hi,

Good luck by transmitting single ended SPI signals without GND as reference....

Klaus
 

ads-ee

Super Moderator
Staff member
Joined
Sep 10, 2013
Messages
7,562
Helped
1,768
Reputation
3,542
Reaction score
1,710
Trophy points
113
Location
USA
Activity points
55,758
Well instead you could convert the single ended SPI to LVDS and then use a twisted pair cable to send the SCLK, MOSI, and SS_N to the slave easily over 20ft. TI/National has some application notes about LVDS and some of the testing that was done looks to suggest that LVDS can be reliable at 100Mpbs over 20m cables, so your 1Mbps SPI would probably work even over 40m of cable.
 
  • Like
Reactions: ferdem

    ferdem

    points: 2
    Helpful Answer Positive Rating

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
46,978
Helped
13,936
Reputation
28,120
Reaction score
12,575
Trophy points
1,393
Location
Bochum, Germany
Activity points
273,928
The original Motorola SPI specification includes a physical layer of single ended TTL/CMOS signals presuming a common ground. The four logical line bus also includes the SS (slave select) signal, which is also used as frame sync in single slave systems.

If you go beyond the original physical layer and use terminated transmission lines or preferably differential signalling like RS422, you can achieve several 100m at 1 MHz.
 

TXRX

Full Member level 2
Joined
Mar 7, 2012
Messages
121
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
2,083
Hi,

Good luck by transmitting single ended SPI signals without GND as reference....

Klaus
There is GND and we work without SS.

Thanks
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
17,464
Helped
3,945
Reputation
7,888
Reaction score
3,815
Trophy points
113
Activity points
115,783
Hi,

we work without SS.
I wonder how you ensure that bytes, words or frames are received correctely....without a sync signal.

Klaus
 

TXRX

Full Member level 2
Joined
Mar 7, 2012
Messages
121
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
2,083
Hi,


I wonder how you ensure that bytes, words or frames are received correctely....without a sync signal.

Klaus
The MOSI is sync to the clock, it works.
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
17,464
Helped
3,945
Reputation
7,888
Reaction score
3,815
Trophy points
113
Activity points
115,783
Hi,

for sure, but this is only the bit_sync,
But I´m talking about byte_sync, word_sync or frame_sync... whatever data you transfer. Without this sync an erroneous pulse (ESD, EMC) in the SCK line will cause invalid data forever.


Klaus
 

TXRX

Full Member level 2
Joined
Mar 7, 2012
Messages
121
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
2,083
Hi,

for sure, but this is only the bit_sync,
But I´m talking about byte_sync, word_sync or frame_sync... whatever data you transfer. Without this sync an erroneous pulse (ESD, EMC) in the SCK line will cause invalid data forever.


Klaus
So how can i improve the immunity to an erroneous pulse ?
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
17,464
Helped
3,945
Reputation
7,888
Reaction score
3,815
Trophy points
113
Activity points
115,783
Hi,
So how can i improve the immunity to an erroneous pulse ?
Answer already given: use differential signalling and appropriate cables with proper termination.
But I´d not rely on that.
As you don´t have a signal back...you probably won´t recognize that you receive the data with bit displacement.

Maybe you could use UART. In this case it is more reliable, because it contains START and STOP signals to indicate the borders of a byte.
Still I recommend to use differential signaling. Additional UART benefit: you need less signal lines than with SPI.

Klaus
 

TXRX

Full Member level 2
Joined
Mar 7, 2012
Messages
121
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
2,083
Hi,

Answer already given: use differential signalling and appropriate cables with proper termination.
But I´d not rely on that.
As you don´t have a signal back...you probably won´t recognize that you receive the data with bit displacement.

Maybe you could use UART. In this case it is more reliable, because it contains START and STOP signals to indicate the borders of a byte.
Still I recommend to use differential signaling. Additional UART benefit: you need less signal lines than with SPI.

Klaus
If i add SS which also mark the byte, Is it OK?
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
17,464
Helped
3,945
Reputation
7,888
Reaction score
3,815
Trophy points
113
Activity points
115,783
Hi,

Answer already given in post#3.

Note: CS = SS

Klaus
 

malli_1729

Full Member level 5
Joined
Feb 13, 2007
Messages
247
Helped
47
Reputation
94
Reaction score
46
Trophy points
1,308
Location
INDIA
Activity points
3,121
do u want to connect master and slave on board or using cables.?
on PCB you can simulate (general sim) microstrip/stripline to see the signal quality and decide on distance. that should give preliminary idea. consider all effects signal quality/GND bounce/Timing etc. MISO and MOSI capture times (tsu,thd) are different w.r.t Clk.
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
46,978
Helped
13,936
Reputation
28,120
Reaction score
12,575
Trophy points
1,393
Location
Bochum, Germany
Activity points
273,928
Unfortunately it's never been mentioned what the SPI slave is. You can omit SS as frame sync signal if and only if the slave supports alternative synchronization methods. This can be e.g. an unique data bit pattern or a timeout.
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top