0% found this document useful (0 votes)
26 views

SPI Extension

This document discusses extending the SPI bus for long-distance communication. It notes that while SPI is designed for short distances, some systems now require distances of 100m or more. At these distances, propagation delay can cause data from slaves to become unsynchronized with the clock. The document proposes using a clock feedback path from the slave to the master to restore synchronization. It also discusses using differential signaling to increase noise immunity, and galvanic isolation to prevent ground loops and potential differences that could damage transceivers.

Uploaded by

Ali Muhtaroglu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

SPI Extension

This document discusses extending the SPI bus for long-distance communication. It notes that while SPI is designed for short distances, some systems now require distances of 100m or more. At these distances, propagation delay can cause data from slaves to become unsynchronized with the clock. The document proposes using a clock feedback path from the slave to the master to restore synchronization. It also discusses using differential signaling to increase noise immunity, and galvanic isolation to prevent ground loops and potential differences that could damage transceivers.

Uploaded by

Ali Muhtaroglu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Interface (Data Transmission) Texas Instruments Incorporated

Extending the SPI bus for


long-distance communication
By Thomas Kugelstadt
Senior Applications Engineer
The serial peripheral interface (SPI) bus is an unbalanced Over long distances, however, the transmission cable
or single-ended serial interface designed for short-distance introduces significant propagation delay into the signal
communication between integrated circuits. Typically, a path. Assuming a typical signal velocity of 5 ns/m, a 100-m
master device exchanges data with one or multiple slave cable will cause a propagation delay of 500 ns. Because the
devices. The data exchange is full-duplex and requires syn­ data sent from the master to the slave experiences the
chronization to an interface clock signal. However, recent same delay as the master-initiated interface clock, both
trends in the design of industrial data-acquisition systems will remain in sync across the entire data link. In the oppo-
have not taken this synchronization requirement into site direction, however, the slave sends data to the master
account, and distances between the microcontroller and only when the first clock edge reaches the slave. Further­
the corresponding analog-to-digital and digital-to-analog more, this data will experience a second delay on its way
converters (ADCs and DACs) can reach 100 m or more. back to the master, so the slave data will be out of sync by
The impact of the added propagation delay on the data- twice the cable’s propagation delay.
to-clock synchronicity is often ignored, and interface Of course, communicating across a 100-m cable won’t
designs that operate perfectly in the lab environment cease be possible without appropriate line drivers and receivers.
operation when implemented on the factory floor. There These components will further increase the propagation
can be multiple reasons for the interface malfunction. This delay by about another 50 ns, for a total of 550 ns. The
article tries to shed light on the major ones, including: slave data will therefore lag behind the first clock edge by
• Lack of synchronization due to large propagation delays a total of 1100 ns, or 11 bits when a data rate of 10 Mbps
of the signal path is assumed.
• Reduced noise immunity due to long-distance,
unbalanced signal paths
Figure 1. Simplified schematic of an SPI
• Damaged transceivers due to large ground-potential
differences (GPDs)
• Data transmission errors due to unterminated data lines
SCK CLK
• Transceiver latch-up and network downtime due to
MOSI SIMO
large electrical transients ADC1
MCU MISO SOMI
Synchronicity SS1 CE
An SPI primarily uses three interface lines: SS2
• An interface clock initiated by the master device to
ensure synchronous data transfers CLK

• A data line for data sent from the master to a slave SIMO
ADC2
• A data line for data sent from a slave to the master SOMI
CE
A fourth wire that carries what is known as the slave-
select signal is not required for controlling interface flow
(a) MCU master controlling two slaves
but is needed for addressing a specific slave out of a range
of slave devices. Figure 1a shows a simplified schematic of
a microcontroller unit (MCU) operating as the master that SCK
controls two data converters representing the slaves.
With byte lengths ranging from 8 to 12 bits and multiples
thereof, and data rates ranging from 1 to 20 Mbps, the MOSI SIMO Tx1 Tx2 Tx3
standard SPI configuration allows for short propagation
times and hence only short distances in order to maintain
synchronicity between the interface clock and the data MISO SIMO Rx1 Rx2 Rx3
transmitted in both directions. Figure 1b shows the inter-
face timing of the first three data bits when the SPI is (b) Timing of first three data bits
configured to change data at the rising clock edge and to
sample data at the falling clock edge.
16

High-Performance Analog Products www.ti.com/aaj 4Q 2011 Analog Applications Journal


Texas Instruments Incorporated Interface (Data Transmission)

The only possible solution for restoring


Figure 2. Clock-feedback path restores synchronicity
synchronicity between the slave data and
the interface clock while maintaining a
high data rate is to feed the clock signal
Master Data Slave
from the slave back to the master. Figure 2 Link
clarifies the benefit of clock feedback. Here t0 t 0 + tP
SCKM tP CLK
t 0 represents the first rising clock edge, or
the start of a data transmission, and tP is SPl1 =
Master
the data-link propagation delay. After tra- t0 t 0 + tP
versing the data link, both the master clock MOSI tP SIMO1
(SCKM) and the master data (MOSI)
remain in sync. Feeding back the master t 0 + 2tP t 0 + tP
clock signal synchronizes the clock with SCKS tP
the slave data so that both arrive equally SPl2 =
delayed at the master. The only require- Slave
t 0 + 2tP t 0 + tP
ment is that the master provide two inde- SIMO2 tP SOMI
pendent SPI ports, one configured as a
master (SPI1) and the other configured as
a slave (SPI2). Most modern microcontrol­
lers possess two or more SPI ports, so this
requirement poses no problem. Because the conductors of twisted-pair cable are closely
Nevertheless, implementing a long-distance, SPI- electrically coupled, external noise induced equally into
compatible interface in the real world is not a trivial task. both conductors appears as common-mode noise at the
Long-distance data links are always subject to external receiver input. Although differential receivers are sensitive
noise sources, ground-potential differences (GPDs), volt- to signal differences, they are immune to common-mode
age and current surges due to inductive load switching, signals. The receiver therefore rejects common-mode
and often even reflections due to wrong or no termination. noise, and signal integrity is maintained.
The flowing schematic in Figure 3 (see next page) tries to Another benefit of close electric coupling is that the
cover all of these aspects by showcasing the various trans- currents in the two conductors create magnetic fields that
ceiver and protection circuits that can counteract the cancel each other. The initial transversal electromagnetic
derogating effects. (TEM) waves of the two conductors are therefore largely
reduced to electric fields that cannot radiate into the envi-
Increasing noise immunity ronment (see Figure 4). Only the far smaller fringing fields
Unbalanced or single-ended drivers and receivers are outside the conductor loop can radiate, thus yielding
inadequate for accomplishing a robust data link over long much lower electromagnetic interference (EMI).
distances, as they are susceptible to common-mode noise.
An excellent method to eliminate common-mode noise in Eliminating ground loops and GPDs
a synchronous, full-duplex interface such as an SPI is the While the RS-485 and RS-422 standards specify that a data
use of RS-422 differential driver and receiver circuits in link without a ground wire can be operated with a GPD of
combination with twisted-pair cable. up to ±7 V, it is advisable not to assume that these values

Figure 4. TEM-wave radiation effects

Coupled
H Large
Fields
Fringing
Fields

t Small
Fringing
E Large Fields
Fringing
Fields

(a) Relationship of magnetic and electric fields (b) Single conductor (c) Closely coupled conductor pair

17

Analog Applications Journal 4Q 2011 www.ti.com/aaj High-Performance Analog Products


Interface (Data Transmission) Texas Instruments Incorporated

Figure 3. SPI extended via RS-422 data link

VS1b
VS1a
1 kΩ 0.1 µF Master
0.1 µF
Node
DE VCC
DVCC 1Y
RF
UCA0CLK 1D
1Z
SPI CF
Master RF 2Y
2D
UCA0SOMI 2Z
CF
RF 1A 100 Ω
1R
UCB0CLK 1B
SPI CF
Slave RF 2A 100 Ω
2R
UCB0SIMO 2B
CF
DVSS
RE GND

1 kΩ

MSP430G2X33 SN65C1167 4700 pF


2 kV
To PE Mains
PE

VS2_ISO VS2
Slave 1 kΩ 0.1 µF 0.1 µF 1 kΩ 1 kΩ 0.1 µF
Node
VS2
DE VCC VCC1 EN1 EN2 VCC2 0.1 µF
100 Ω 1A RF
1R INA OUTA
1B
CF VCC
100 Ω 2A CLKIN A0
RF INB OUTB
2R
2B SDI ADC
CF
1Y SDO A0
RF OUTC INC GND
1D
1Z
CF
2Y RF
2D OUTD IND
2Z
CF
RE GND GND1 GND2

1 kΩ

4700 pF SN65C1167 ISO7242C


2 kV
To PE Mains
PE

18

High-Performance Analog Products www.ti.com/aaj 4Q 2011 Analog Applications Journal


Texas Instruments Incorporated Interface (Data Transmission)

represent the maximum GPD. Much higher values are often Depending on their location, the wave nodes (minima)
encountered in industrial plants, sometimes reaching sev- and antinodes (maxima) can have varying effects on the
eral hundreds and even thousands of volts. Because GPDs bus transceivers (see Figure 5). A driver close to an anti-
largely depend on factors outside the system designer’s node sees a high impedance and therefore transfers insuf-
control, such as the electric installation and/or the number ficient energy to the bus. A driver close to a node sees a
of electric motors and generators, the most secure way to very low impedance or a short. The resulting output current
prevent transceiver damage from large ground-potential can exceed the driver’s maximum drive capability and
variations is to galvanically isolate any remote network node even trigger its current limit at around 250 mA. Receivers
from the bus. The circuit in Figure 3 demonstrates this by located at antinodes can be damaged by excessively large
having only the remote transceiver connected to the bus, input signals that exceed the receiver’s common-mode
while the data-converter circuit is galvanically isolated. input range. Receivers close to nodes experience insuffi-
Also, to provide the input and output signals of the cient signal strength and are highly susceptible to noise
remote transceiver with a stable ground reference, the and EMI. Any of the foregoing events will result in data
transceiver’s ground terminal as well as the digital isola- errors from either the transmission or the reception of
tor’s ground terminal (GND1) are connected to the master wrong data.
ground potential via a separate ground conductor. This
form of grounding is known as a single ground reference. Protecting the network against
damaging transients
Avoiding antennas through line termination Electrical overstress transients caused by electrostatic dis-
The data link in Figure 3 is terminated with 100-W resis- charge (ESD), switching of inductive loads, or lightning
tors, as suggested by the RS-422 standard, matching the strikes will corrupt data transmission and damage bus
characteristic impedance of the bus cable. A myth exists transceivers unless effective measures are taken to dimin-
that bus cables of a few meters in length or data links ish their impact. Modern transient-voltage suppressors,
operating at low data rates don’t need termination. Don’t such as the ones in Figure 3, are the preferred protection
believe it. Operating the bus without termination can turn components for high-speed data transmission due to their
the transmission line into a nasty receiver/transmitter low capacitance, which allows them to be designed into
antenna. The lack of termination resistors, which usually every node of a multinode network without requiring a
absorb the incident wave power sent by the driver, causes reduction in data rate.
standing waves to occur; and the entire incident wave is Depending on the power rating of the transient-voltage
reflected into the bus. The reflected waves mix with other suppressor chosen, the maximum clamp voltages can
incident waves, thus yielding standing waves for signal fre- range from 25 to 35 V, which is higher than a standard
quencies whose quarter wavelengths, or multiples thereof, transceiver’s maximum bus voltage of 14 V. In this case,
equal the length of the data link. the internal protection circuit of the transceiver must

Figure 5. Effects of an unterminated bus

L=¼×n×λ
for n = 1, 3, 5 Open
L Line
Open
Driver at Antinode Driver at Node Receiver at Node Receiver at Antinode
Line
– Driver sees a – Driver sees – Low signal voltage – Received signal can
high impedance a short – Highly susceptible exceed maximum
Driver sees a low Receiver sees a – Very small supply – Very high to noise/EMI common-mode
impedance (short) high impedance current supply current input range
– Receiver can be
(a) Effects with a quarter-wave line length damaged

(b) Effects of connecting drivers and receivers at nodes and antinodes

19

Analog Applications Journal 4Q 2011 www.ti.com/aaj High-Performance Analog Products


Interface (Data Transmission) Texas Instruments Incorporated

absorb the remaining clamp energy to protect the device high-voltage capacitor that has one plate connected to
from damage. ground and the other plate connected to a protective-
For ESD and burst transients, the clamp energy is rather earth (PE) island. This island is then connected via a
low due to the short pulse duration and does not pose a short, low-inductance earthing wire to the PE terminal of
problem to the internal ESD cells. Clamp energy from the local mains supply.
surge transients, however, can present a serious challenge In addition to the suppressor’s action on the bus side,
due to the much longer pulse duration. For transceivers further protection against signal degradation is required on
specified with low ESD immunity, series resistors might be the transceiver’s single-ended sides. This is accomplished
necessary to reduce the remaining current flowing into the with R-C low-pass filters, which filter transient remnants
transceiver. Common resistor values range from 5 to 10 W. in the reception path and stop high-frequency noise from
Note that these resistors must be surge-rated to provide entering the transmission path.
high pulse robustness.
Although the transient-voltage suppressor’s diodes divert Related Web sites
large transient currents to ground, it must be ensured that interface.ti.com
these currents are further diverted to true earth potential www.ti.com/product/ISO7242C
without disturbing the ground reference of the remaining www.ti.com/product/SN65C1167
circuitry. Often this is accomplished by implementing a

20

High-Performance Analog Products www.ti.com/aaj 4Q 2011 Analog Applications Journal


TI Worldwide Technical Support

Internet
TI Semiconductor Product Information Center
Home Page
support.ti.com

TI E2E™ Community Home Page


e2e.ti.com

Product Information Centers Asia


Americas Phone +1(972) 644-5580 Phone
International +91-80-41381665
Brazil Phone 0800-891-2616
Domestic Toll-Free Number
Mexico Phone 0800-670-7544 Note: Toll-free numbers do not support
mobile and IP phones.
Fax +1(972) 927-6377 Australia 1-800-999-084
Internet/Email support.ti.com/sc/pic/americas.htm China 800-820-8682
Hong Kong 800-96-5941
Europe, Middle East, and Africa India 1-800-425-7888
Phone Indonesia 001-803-8861-1006
European Free Call 00800-ASK-TEXAS Korea 080-551-2804
(00800 275 83927)
Malaysia 1-800-80-3973
International +49 (0) 8161 80 2121
New Zealand 0800-446-934
Russian Support +7 (4) 95 98 10 701
Philippines 1-800-765-7404
Singapore 800-886-1028
Note: The European Free Call (Toll Free) number is not active
in all countries. If you have technical difficulty calling the free Taiwan 0800-006800
call number, please use the international number above. Thailand 001-800-886-0010
Fax +8621-23073686
Fax +(49) (0) 8161 80 2045 Email [email protected] or [email protected]
Internet support.ti.com/sc/pic/euro.htm Internet support.ti.com/sc/pic/asia.htm
Direct Email [email protected]
Important Notice: The products and services of Texas Instruments Incorporated and
its subsidiaries described herein are sold subject to TI’s standard terms and conditions
Japan of sale. Customers are advised to obtain the most current and complete information
about TI products and services before placing orders. TI assumes no liability for
Phone Domestic 0120-92-3326 applications assistance, customer’s applications or product designs, software
performance, or infringement of patents. The publication of information regarding any
Fax International +81-3-3344-5317 other company’s products or services does not constitute TI’s approval, warranty or
endorsement thereof.
Domestic 0120-81-0036
Internet/Email International support.ti.com/sc/pic/japan.htm A122010
Domestic www.tij.co.jp/pic E2E is a trademark of Texas Instruments. All other trademarks are the property of their
respective owners.

© 2011 Texas Instruments Incorporated SLYT441


IMPORTANT NOTICE
Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications, enhancements, improvements,
and other changes to its products and services at any time and to discontinue any product or service without notice. Customers should
obtain the latest relevant information before placing orders and should verify that such information is current and complete. All products are
sold subject to TI’s terms and conditions of sale supplied at the time of order acknowledgment.
TI warrants performance of its hardware products to the specifications applicable at the time of sale in accordance with TI’s standard
warranty. Testing and other quality control techniques are used to the extent TI deems necessary to support this warranty. Except where
mandated by government requirements, testing of all parameters of each product is not necessarily performed.
TI assumes no liability for applications assistance or customer product design. Customers are responsible for their products and
applications using TI components. To minimize the risks associated with customer products and applications, customers should provide
adequate design and operating safeguards.
TI does not warrant or represent that any license, either express or implied, is granted under any TI patent right, copyright, mask work right,
or other TI intellectual property right relating to any combination, machine, or process in which TI products or services are used. Information
published by TI regarding third-party products or services does not constitute a license from TI to use such products or services or a
warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual
property of the third party, or a license from TI under the patents or other intellectual property of TI.
Reproduction of TI information in TI data books or data sheets is permissible only if reproduction is without alteration and is accompanied
by all associated warranties, conditions, limitations, and notices. Reproduction of this information with alteration is an unfair and deceptive
business practice. TI is not responsible or liable for such altered documentation. Information of third parties may be subject to additional
restrictions.
Resale of TI products or services with statements different from or beyond the parameters stated by TI for that product or service voids all
express and any implied warranties for the associated TI product or service and is an unfair and deceptive business practice. TI is not
responsible or liable for any such statements.
TI products are not authorized for use in safety-critical applications (such as life support) where a failure of the TI product would reasonably
be expected to cause severe personal injury or death, unless officers of the parties have executed an agreement specifically governing
such use. Buyers represent that they have all necessary expertise in the safety and regulatory ramifications of their applications, and
acknowledge and agree that they are solely responsible for all legal, regulatory and safety-related requirements concerning their products
and any use of TI products in such safety-critical applications, notwithstanding any applications-related information or support that may be
provided by TI. Further, Buyers must fully indemnify TI and its representatives against any damages arising out of the use of TI products in
such safety-critical applications.
TI products are neither designed nor intended for use in military/aerospace applications or environments unless the TI products are
specifically designated by TI as military-grade or "enhanced plastic." Only products designated by TI as military-grade meet military
specifications. Buyers acknowledge and agree that any such use of TI products which TI has not designated as military-grade is solely at
the Buyer's risk, and that they are solely responsible for compliance with all legal and regulatory requirements in connection with such use.
TI products are neither designed nor intended for use in automotive applications or environments unless the specific TI products are
designated by TI as compliant with ISO/TS 16949 requirements. Buyers acknowledge and agree that, if they use any non-designated
products in automotive applications, TI will not be responsible for any failure to meet such requirements.
Following are URLs where you can obtain information on other Texas Instruments products and application solutions:
Products Applications
Audio www.ti.com/audio Communications and Telecom www.ti.com/communications
Amplifiers amplifier.ti.com Computers and Peripherals www.ti.com/computers
Data Converters dataconverter.ti.com Consumer Electronics www.ti.com/consumer-apps
DLP® Products www.dlp.com Energy and Lighting www.ti.com/energy
DSP dsp.ti.com Industrial www.ti.com/industrial
Clocks and Timers www.ti.com/clocks Medical www.ti.com/medical
Interface interface.ti.com Security www.ti.com/security
Logic logic.ti.com Space, Avionics and Defense www.ti.com/space-avionics-defense
Power Mgmt power.ti.com Transportation and Automotive www.ti.com/automotive
Microcontrollers microcontroller.ti.com Video and Imaging www.ti.com/video
RFID www.ti-rfid.com
OMAP Mobile Processors www.ti.com/omap
Wireless Connectivity www.ti.com/wirelessconnectivity
TI E2E Community Home Page e2e.ti.com

Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265
Copyright © 2011, Texas Instruments Incorporated

You might also like