Embedded System: Serial Peripheral Interface (SPI)
Embedded System: Serial Peripheral Interface (SPI)
Embedded System: Serial Peripheral Interface (SPI)
Taksim Team
.Anas Reda Shamasneh
.Abdullah Barakat Njoum
.Asalah Farraj
.Doha Jaradat
Dr. Emad Hamadeh
Anas
SPI is also called as a three wire interface, but the interface bus
comprises more than three wires. The three wires carry input data to
that slave and output data from the slave and the timing clock. The
four wires of SPI are labelled as:
Master In Slave Out(MISO): Data input to the SPI Master and output from the
selected SPI slave. Only one selected slave device can drive data out from its
MISO pin.
Serial Clock(SCK): Driven by the SPI Master and regulates the flow of data
bits.
Read Protocol
Anas
Multiple slaves
In general, each slave will need a separate SS line. To talk to a particular
slave, you'll make that slave's SS line low and keep the rest of them high (you
don't want two slaves activated at the same time, or they may both try to talk
on the same MISO line resulting in garbled data)
Anas
Multiple slaves
On the other hand, some parts prefer to be daisy-chained together, with
the MISO (output) of one going to the MOSI (input) of the next.
In this case, a single SS line goes to all the slaves. Once all the data is
sent, the SS line is raised, which causes all the chips to be activated
simultaneously.
Abdullah
Data Sending
The clock is an oscillating signal that tells the receiver exactly when to
sample the bits on the data line.
This could be the rising (low to high) or falling (high to low) edge of the
clock signal; the datasheet will specify which one to use.
When the receiver detects that edge, it will immediately look at the
data line to read the next bit (see the arrows in the below diagram)
Abdullah
Data Receiving
When data is sent from the master to a slave, it's sent on a data line
called MOSI, for "Master Out / Slave In".
If the slave needs to send a response back to the master, the master
will continue to generate a prearranged number of clock cycles, and the
slave will put the data onto a third data line called MISO, for "Master In
Slave Out".
Abdullah
Bandwidth of SPI
Abdullah
Bandwidth of SPI
The previous figure shows some of the buses with their properties.
The SPI had the largest bandwidth since the year of its invention (1989)
till the beginning of the hyper buses invention (2001).
There was a gap between the SPI’s bandwidth and the other buses’
bandwidth.
Abdullah
Block Diagram
Abdullah
SPI Advantages
Full duplex communication.
Provide good signal integrity and high speed.
Higher throughput than I²C or SMBus. Not limited to any maximum clock
speed, enabling potentially high speed.
Complete protocol flexibility for the bits transferred.
Extremely simple hardware interfacing.
At most one unique bus signal per device.
Simple software implementation.
Abdullah
SPI Disadvantages
Requires more pins on IC packages than I²C, even in the three-
wire variant.
No hardware flow control by the slave (but the master can delay the
next clock edge to slow the transfer rate).
No hardware slave acknowledgment (the master could be transmitting
to nowhere and not know it)
Typically supports only one master device (depends on device's
hardware implementation).
No error-checking protocol is defined.
Only handles short distances.
SPI does not support hot swapping (dynamically adding nodes).
Asalah
SPI Registers
Asalah
Mode 2 occurs when Clock Polarity is HIGH and Clock Phase is 0 (CPOL = 1
and CPHA = 0). During Mode 2, data transmission occurs during rising edge of
the clock
Mode 3:
Mode 3 occurs when Clock Polarity is HIGH and Clock Phase is 1 (CPOL = 1
and CPHA = 1). During Mode 3, data transmission occurs during rising edge of
the clock.
Doha
Cache Architecture
Doha
Key Point
Taksim
?Any Question
Taksim Team