AN-1248 Application Note: SPI Interface
AN-1248 Application Note: SPI Interface
AN-1248 Application Note: SPI Interface
APPLICATION NOTE
One Technology Way P.O. Box 9106 Norwood, MA 02062-9106, U.S.A. Tel: 781.329.4700 Fax: 781.461.3113 www.analog.com
SPI Interface
by Miguel Usach
INTRODUCTION
MASTER-SLAVE COMPATIBILITY
The first step is to guarantee the compatibility of the masterslave connection. The SPI interface is not an official specification, so it is important to ensure that data from the master
to the slave and/or vice versa fits within both specifications.
The SPI bus consists of four unidirectional wires. The names for
these wires vary between parts, even within the same range of
products.
For the most part, the slave cannot be configured and can only
operate in one mode. However, sometimes it can operate in up
to two different modes.
SLAVE
SCLK
DATA OUT
DATA IN
CS
SCLK
SDI
SDO
CS
t1
t9
SCLK
t8
t4
t3
t2
t7
CS
t5
SDI
t6
DB31
DB0
Rev. 0 | Page 1 of 8
11585-002
11585-001
AN-1248
Application Note
TABLE OF CONTENTS
Introduction ...................................................................................... 1
Topologies...........................................................................................6
REVISION HISTORY
7/13Revision 0: Initial Version
Rev. 0 | Page 2 of 8
Application Note
AN-1248
t1
t6
DB31
11585-005
t5
DB0
SCLK
CS
11585-003
SCLK
CPHA = 1
t7
CS
SDI
CPOL = 0
t2
t3
CPHA = 0
CPOL = 1
t9
SCLK
Polarity (CPOL)
t1
t9
Phase (CPHA)
SCLK
0
t8
t3
t2
t7
CS
t5t5
2
11585-004
SDI
tt66
DB31
DB0
Rev. 0 | Page 3 of 8
11585-006
t4
AN-1248
Application Note
The main trade-off is for slow masters because the data only is
stable in the pin several nanoseconds after the sampling edge
and the master hold time can be violated. This problem occurs
because the hold time is high, that is, >15 ns. If this is the case,
the recommendation is to use a logic gate to delay the new data
in the DATA IN pin as long as it needed as shown in Figure 6.
SAMPLING EDGE
U1
DATA IN SCLK CS
CS
ORIGINAL
SCLK
DELAYED
SCLK
SDO
MICROCONTROLLER
If the SDO signal is updated in the driving edge, the pin has
only one-half (or even less) of a clock period to update the
signal because a signal should be stable several nanoseconds
before the sampling edge.
SDI
DATA OUT
36 ns
Propagation Delay
4.4 ns
9 ns
11 ns
t1
t2
t7
SCLK
t3
t8
tt99
C3
C2
C1
C0
D7
D6
D5
t10
D2
D1
D2
D0
11585-007
SYNC
SDO
CS
t8
1
18
t3
DOUT A
THREE-STATE
19
20
20
t6
2121
t7
tt4
4
DB13A DB12A DB11A
B13A DB12A DB11A
Rev. 0 | Page 4 of 8
31
32
33
t9
t5 t5
DB1A
DB0A
tQUIET
THREESTATE
11585-008
t2
SCLK
UPDATE SDO
11585-009
Application Note
AN-1248
Enable Time
Enable time defines how fast the SPI interface is enabled and
ready to receive or transmit data. This is typically referred to
as the SCLK sampling edge as shown in Figure 9.
Disable Time
Disable time defines how fast the SPI is disabled to ignore any
new generated sampling edge transitions as shown in Figure 9.
t10
First Scenario
The SCLK signal is used as an internal clock, and continuous
SCLK is needed. In this case, the SCLK is limited between a
maximum and minimum value as shown in Table 3.
tt 9
t1
SCLK
tt44
t2
t3
t7
CS
SDI
t6
DB31
11585-010
t5
DB0
Min
0.01
Max
20
Unit
MHz
t1
CS
tCONVERT
t2t2
11
SCLK
t6
2
SDATA
ZERO
13
t4
t3
THREESTATE
Description
SCLK
frequency
ZERO
ZERO
DB11
14
DB10
15
16
t5
t7
t8
tQUIET
DB2
DB1
DB0
THREE-STATE
4 LEADING ZEROS
Rev. 0 | Page 5 of 8
11585-016
t8
AN-1248
Application Note
Second Scenario
TOPOLOGIES
CNV
tCONV
tCONV
tACQ
CONVERSION
ACQUISITION CONVERSION
tHSDO
SDO
tQUIET
17
18
D16
tDIS
D1
D0
Daisy-Chain Topology
In this configuration, there is one master and multiple slaves
connected in series as shown in Figure 13.
MOSI
MISO SCLK CS
SDO
SDI
CS
SCLK
SDO
U2
U1
CS
SCLK
SDI
MICROCONTROLLER
CS
19
tSCKH
tCSDO
D17
SDO
CS
11585-013
SDI
DATA IN
11585-017
SCLK
DATA OUT
tSCK
tSCKL
SCK
SLAVE
SCLK
(QUIET
TIME)
ACQUISITION
11585-012
tCNVH
Standalone Topology
Rev. 0 | Page 6 of 8
Application Note
AN-1248
SCLK
16
17
18
32
CS
DB15
DB0
DB15
DB0
MOSI
DB15
DB15
DB0
SDO_U1
UNDEFINED
11585-014
Parallel Configuration
In this configuration, there is one master with multiple slaves
connected in parallel as shown Figure 15.
SLAVE
MASTER
DATA OUT
SDI
SDO
SCK
SCLK
CS1
CS
CS2
SLAVE
DATA IN CS3
SDO
SDI
SCLK
CS
SLAVE
SDI
SDO
CS
11585-015
SCLK
Rev. 0 | Page 7 of 8
AN-1248
Application Note
NOTES
Rev. 0 | Page 8 of 8