SlideShare une entreprise Scribd logo
1  sur  20
SPI Bus Protocol
20th April 2018
Sudhanshu Janwadkar, SVNIT
Introduction
• The Serial Peripheral Interface bus (SPI) is
 synchronous
 serial communication interface specification
 used for short distance communication
• The interface was developed by Motorola in 1980s
• SPI devices communicate in full duplex mode using
a master-slave architecture with a single master.
 The master device originates the frame for reading
and writing.
 Multiple slave devices are supported through
selection with individual slave select (SS) lines.
The trouble with asynchronous
protocols
• The common serial port, such as UART, is called
“asynchronous” because there is no control over
when data is sent or any guarantee that both sides
are running at precisely the same rate.
• There can be an issue when two systems with
slightly different clocks try to communicate with
each other.
• To mitigate this issue, asynchronous serial
connections add extra start and stop bits to each
byte, so as to help the receiver sync up to data as it
arrives.
• Both sides must also agree on the same baud rate
in advance.
The trouble with asynchronous
protocols
• Asynchronous serial works just fine, but
 has a lot of overhead in both the extra start and
stop bits sent with every byte
 the complex hardware required to send and receive
data
 if both sides aren’t set to the same speed, the
received data will be garbage. This is because the
receiver is sampling the bits at very specific times If
the receiver is looking at the wrong times, it will see
the wrong bits.
How is ‘synchronous’ beneficial?
• A “synchronous” data bus uses separate lines for
data and clock that keeps both sides in perfect
sync.
• 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
• Because the clock is sent along with the data,
specifying the speed isn’t important, although
devices will have a top speed at which they can
operate
The SPI Protocol - basics
• The SPI bus can operate with a single master
device and with one or more slave devices.
• One unique feature of SPI is that data can be
transferred without interruption.
• Any number of bits can be sent or received in
a continuous stream.
 With I2C and UART, data is sent in packets, limited
to a specific number of bits.
 Start and stop conditions define the beginning and
end of each packet, so the data is interrupted
during transmission.
• Devices communicating via SPI are in a master-
slave relationship.
• In SPI, only one side generates the clock signal
 The side that generates the clock is called the
“master”, and the other side is called the “slave”.
• The master is the controlling device (usually a
microcontroller), while the slave (usually a sensor,
display, or memory chip) takes instruction from the
master.
• There is always only one master but there can be
multiple slaves.
The SPI Protocol - basics
The SPI Interface
The SPI bus specifies four logic signals:
 SCLK: Serial Clock (output from master).
 MOSI: Master Output Slave Input (data output from
master).
 MISO: Master Input Slave Output, or Master In Slave
Out (data output from slave).
 SS: Slave Select (often active low, output from
master).
The SPI Interface
Serial Clock (SCLK)
• SPI is a synchronous communication protocol.
• The clock signal synchronizes the output of data
bits from the master with the sampling of bits by the
slave.
• One bit of data is transferred in each clock cycle,
so the speed of data transfer is determined by the
frequency of the clock signal.
• SPI communication is always initiated by the
master since the master configures and generates
the clock signal.
The SPI Interface
Slave Select
• The master can choose which slave it wants to
communicate to by setting the slave’s CS/SS line to
a low voltage level.
• In the idle, non-transmitting state, the slave select
line is kept at a high voltage level.
 Multiple CS/SS pins may be available on the
master, which allows for multiple slaves to be wired
in parallel.
 If only one CS/SS pin is present, multiple slaves
can be wired to the master by daisy-chaining
The SPI Interface
Multiple Slaves
 Multiple CS/SS pins
are available on the
master
Only one CS/SS pin is
present, multiple slaves
are wired to the master by
daisy-chaining
The Protocol
1. To begin communication, the bus master configures
the clock, using a frequency supported by the slave
device, typically up to a few MHz.
2. The master then selects the slave device with a logic
level 0 on the select line.
 If a waiting period is required, such as for an analog-
to-digital conversion, the master must wait for at
least that period of time before issuing clock cycles.
3. During each SPI clock cycle, a full duplex data
transmission occurs.
 The master sends a bit on the MOSI line and the
slave reads it, while the slave sends a bit on the
MISO line and the master reads it.
The Protocol (summary)
1. The master outputs the clock signal
2. The master switches the SS/CS pin to a low voltage
state, which activates the slave:
The Protocol (summary)
3. The master sends the data one bit at a time to the
slave along the MOSI line. The slave reads the bits
as they are received
4. If a response is needed, the slave returns data one
bit at a time to the master along the MISO line. The
master reads the bits as they are received
Data Transmission in SPI
• Transmissions normally involve two shift registers
of some given word size ( may be 8eight bits), one
in the master and one in the slave
• They are connected in a virtual ring topology.
• Data is usually shifted out with the most-significant
bit first. On the clock edge, both master and slave
shift out a bit and output it on the transmission line
to the counterpart.
Data Transmission in SPI
• On the next clock edge, at each receiver the bit is
sampled from the transmission line and set as a
new least-significant bit of the shift register.
• After the register bits have been shifted out and in,
the master and slave have exchanged register
values.
• If more data needs to be exchanged, the shift
registers are reloaded and the process repeats.
• Transmission may continue for any number of clock
cycles.
• When complete, the master stops toggling the
clock signal, and typically deselects the slave.
Advantages of SPI
• Full duplex
• Push-pull drivers (as opposed to open drain)
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
• Not limited to 8-bit words
• Slaves use the master's clock and do not need
precision oscillators
• Slaves do not need a unique address — unlike I²C
or GPIB or SCSI
Limitations of SPI
• Requires more pins on IC packages than I²C
• 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
Applications of SPI
SPI is used to talk to a variety of peripherals, such as
• Sensors: temperature, pressure, ADC,
touchscreens, video game controllers
• Control devices: audio codecs, digital
potentiometers, DAC
• Memory: flash and EEPROM
• Real-time clocks
• LCD, sometimes even for managing image data
• Any MMC or SD card
Review Questions
1. Compare and contrast UART, I2C and SPI, citing
the features, advantages and disadvantages of
each.
2. What are the demerits of asynchronous
communication protocols? How are they overcome
in SPI?
3. List out the Interface signals used in SPI protocol
and brief out their significance.
4. List the set of operations involved in completing a
serial communication using SPI protocol. Draw the
hardware interface, in support.
5. List out the advantages and limitations of SPI
protocol. Also, list some of the applications.

Contenu connexe

Tendances

I2c protocol - Inter–Integrated Circuit Communication Protocol
I2c protocol - Inter–Integrated Circuit Communication ProtocolI2c protocol - Inter–Integrated Circuit Communication Protocol
I2c protocol - Inter–Integrated Circuit Communication ProtocolAnkur Soni
 
I2C And SPI Part-23
I2C And  SPI Part-23I2C And  SPI Part-23
I2C And SPI Part-23Techvilla
 
Serial Peripheral Interface
Serial Peripheral InterfaceSerial Peripheral Interface
Serial Peripheral InterfaceChirag Parikh
 
APB protocol v1.0
APB protocol v1.0APB protocol v1.0
APB protocol v1.0Azad Mishra
 
Serial peripheral Interface - Embedded System Protocol
Serial peripheral Interface - Embedded System ProtocolSerial peripheral Interface - Embedded System Protocol
Serial peripheral Interface - Embedded System ProtocolAditya Porwal
 
Verilog Tasks & Functions
Verilog Tasks & FunctionsVerilog Tasks & Functions
Verilog Tasks & Functionsanand hd
 
spi-180501092933-converted.pptx
spi-180501092933-converted.pptxspi-180501092933-converted.pptx
spi-180501092933-converted.pptxsauryakumar3
 

Tendances (20)

SPI Protocol
SPI ProtocolSPI Protocol
SPI Protocol
 
Advance Peripheral Bus
Advance Peripheral Bus Advance Peripheral Bus
Advance Peripheral Bus
 
I2C BUS PROTOCOL
I2C BUS PROTOCOLI2C BUS PROTOCOL
I2C BUS PROTOCOL
 
The I2C Interface
The I2C InterfaceThe I2C Interface
The I2C Interface
 
I2C introduction
I2C introductionI2C introduction
I2C introduction
 
I2c protocol - Inter–Integrated Circuit Communication Protocol
I2c protocol - Inter–Integrated Circuit Communication ProtocolI2c protocol - Inter–Integrated Circuit Communication Protocol
I2c protocol - Inter–Integrated Circuit Communication Protocol
 
I2C And SPI Part-23
I2C And  SPI Part-23I2C And  SPI Part-23
I2C And SPI Part-23
 
Serial Peripheral Interface
Serial Peripheral InterfaceSerial Peripheral Interface
Serial Peripheral Interface
 
APB protocol v1.0
APB protocol v1.0APB protocol v1.0
APB protocol v1.0
 
I2C
I2CI2C
I2C
 
AMBA Ahb 2.0
AMBA Ahb 2.0AMBA Ahb 2.0
AMBA Ahb 2.0
 
UART
UARTUART
UART
 
I2C
I2CI2C
I2C
 
axi protocol
axi protocolaxi protocol
axi protocol
 
Serial peripheral Interface - Embedded System Protocol
Serial peripheral Interface - Embedded System ProtocolSerial peripheral Interface - Embedded System Protocol
Serial peripheral Interface - Embedded System Protocol
 
SPI Protocol in LPC2148
SPI  Protocol in LPC2148SPI  Protocol in LPC2148
SPI Protocol in LPC2148
 
Verilog Tasks & Functions
Verilog Tasks & FunctionsVerilog Tasks & Functions
Verilog Tasks & Functions
 
Ambha axi
Ambha axiAmbha axi
Ambha axi
 
spi-180501092933-converted.pptx
spi-180501092933-converted.pptxspi-180501092933-converted.pptx
spi-180501092933-converted.pptx
 
Axi protocol
Axi protocolAxi protocol
Axi protocol
 

Similaire à SPI Bus Protocol

Deepu Kumar Shah.pptx
Deepu Kumar Shah.pptxDeepu Kumar Shah.pptx
Deepu Kumar Shah.pptxDeepuShah
 
communication interfaces-Embedded real time systems
communication interfaces-Embedded real time systemscommunication interfaces-Embedded real time systems
communication interfaces-Embedded real time systemsRaghunath reddy
 
serial_busses_i2c.pptx
serial_busses_i2c.pptxserial_busses_i2c.pptx
serial_busses_i2c.pptxSKUP1
 
UNI T 6- SPI_I2C_Lecture8.pptx
UNI                    T 6- SPI_I2C_Lecture8.pptxUNI                    T 6- SPI_I2C_Lecture8.pptx
UNI T 6- SPI_I2C_Lecture8.pptxnaveen088888
 
Raspberry Pi - Lecture 3 Embedded Communication Protocols
Raspberry Pi - Lecture 3 Embedded Communication ProtocolsRaspberry Pi - Lecture 3 Embedded Communication Protocols
Raspberry Pi - Lecture 3 Embedded Communication ProtocolsMohamed Abdallah
 
lecture_I2C_SPI.pptx
lecture_I2C_SPI.pptxlecture_I2C_SPI.pptx
lecture_I2C_SPI.pptxreemasajin1
 
Embedded networking
Embedded networkingEmbedded networking
Embedded networkingArul Kumar
 
SOC Peripheral Components & SOC Tools
SOC Peripheral Components & SOC ToolsSOC Peripheral Components & SOC Tools
SOC Peripheral Components & SOC ToolsA B Shinde
 
Spi in arm7(lpc2148)
Spi in arm7(lpc2148)Spi in arm7(lpc2148)
Spi in arm7(lpc2148)Aarav Soni
 
SPI AND UART COMMUNICATION PROTOCOLS
SPI AND UART COMMUNICATION PROTOCOLSSPI AND UART COMMUNICATION PROTOCOLS
SPI AND UART COMMUNICATION PROTOCOLSDHIVYA MANI
 
Peripherals and interfacing
Peripherals  and interfacingPeripherals  and interfacing
Peripherals and interfacingRAMPRAKASHT1
 
Embedded systems and robotics by scmandota
Embedded systems and robotics by scmandotaEmbedded systems and robotics by scmandota
Embedded systems and robotics by scmandotascmandota
 
Master synchronous serial port (mssp)
Master synchronous serial port (mssp)Master synchronous serial port (mssp)
Master synchronous serial port (mssp)babak danyal
 
Input Output Operations
Input Output OperationsInput Output Operations
Input Output Operationskdisthere
 

Similaire à SPI Bus Protocol (20)

Deepu Kumar Shah.pptx
Deepu Kumar Shah.pptxDeepu Kumar Shah.pptx
Deepu Kumar Shah.pptx
 
Serial Busses.pptx
Serial Busses.pptxSerial Busses.pptx
Serial Busses.pptx
 
communication interfaces-Embedded real time systems
communication interfaces-Embedded real time systemscommunication interfaces-Embedded real time systems
communication interfaces-Embedded real time systems
 
serial_busses_i2c.pptx
serial_busses_i2c.pptxserial_busses_i2c.pptx
serial_busses_i2c.pptx
 
UNI T 6- SPI_I2C_Lecture8.pptx
UNI                    T 6- SPI_I2C_Lecture8.pptxUNI                    T 6- SPI_I2C_Lecture8.pptx
UNI T 6- SPI_I2C_Lecture8.pptx
 
Raspberry Pi - Lecture 3 Embedded Communication Protocols
Raspberry Pi - Lecture 3 Embedded Communication ProtocolsRaspberry Pi - Lecture 3 Embedded Communication Protocols
Raspberry Pi - Lecture 3 Embedded Communication Protocols
 
lecture_I2C_SPI.pptx
lecture_I2C_SPI.pptxlecture_I2C_SPI.pptx
lecture_I2C_SPI.pptx
 
serial.ppt
serial.pptserial.ppt
serial.ppt
 
serial.ppt
serial.pptserial.ppt
serial.ppt
 
Embedded networking
Embedded networkingEmbedded networking
Embedded networking
 
USART
USARTUSART
USART
 
Lec 5
Lec 5Lec 5
Lec 5
 
Introduction to embedded systems
Introduction to embedded systemsIntroduction to embedded systems
Introduction to embedded systems
 
SOC Peripheral Components & SOC Tools
SOC Peripheral Components & SOC ToolsSOC Peripheral Components & SOC Tools
SOC Peripheral Components & SOC Tools
 
Spi in arm7(lpc2148)
Spi in arm7(lpc2148)Spi in arm7(lpc2148)
Spi in arm7(lpc2148)
 
SPI AND UART COMMUNICATION PROTOCOLS
SPI AND UART COMMUNICATION PROTOCOLSSPI AND UART COMMUNICATION PROTOCOLS
SPI AND UART COMMUNICATION PROTOCOLS
 
Peripherals and interfacing
Peripherals  and interfacingPeripherals  and interfacing
Peripherals and interfacing
 
Embedded systems and robotics by scmandota
Embedded systems and robotics by scmandotaEmbedded systems and robotics by scmandota
Embedded systems and robotics by scmandota
 
Master synchronous serial port (mssp)
Master synchronous serial port (mssp)Master synchronous serial port (mssp)
Master synchronous serial port (mssp)
 
Input Output Operations
Input Output OperationsInput Output Operations
Input Output Operations
 

Plus de Sudhanshu Janwadkar

Keypad Interfacing with 8051 Microcontroller
Keypad Interfacing with 8051 MicrocontrollerKeypad Interfacing with 8051 Microcontroller
Keypad Interfacing with 8051 MicrocontrollerSudhanshu Janwadkar
 
ASIC design Flow (Digital Design)
ASIC design Flow (Digital Design)ASIC design Flow (Digital Design)
ASIC design Flow (Digital Design)Sudhanshu Janwadkar
 
Fpga architectures and applications
Fpga architectures and applicationsFpga architectures and applications
Fpga architectures and applicationsSudhanshu Janwadkar
 
Introduction to 8051 Timer/Counter
Introduction to 8051 Timer/CounterIntroduction to 8051 Timer/Counter
Introduction to 8051 Timer/CounterSudhanshu Janwadkar
 
Architecture of the Intel 8051 Microcontroller
Architecture of the Intel 8051 MicrocontrollerArchitecture of the Intel 8051 Microcontroller
Architecture of the Intel 8051 MicrocontrollerSudhanshu Janwadkar
 
Introduction to Embedded Systems
Introduction to Embedded SystemsIntroduction to Embedded Systems
Introduction to Embedded SystemsSudhanshu Janwadkar
 
Interconnects in Reconfigurable Architectures
Interconnects in Reconfigurable ArchitecturesInterconnects in Reconfigurable Architectures
Interconnects in Reconfigurable ArchitecturesSudhanshu Janwadkar
 
Design and Implementation of a GPS based Personal Tracking System
Design and Implementation of a GPS based Personal Tracking SystemDesign and Implementation of a GPS based Personal Tracking System
Design and Implementation of a GPS based Personal Tracking SystemSudhanshu Janwadkar
 
Embedded Logic Flip-Flops: A Conceptual Review
Embedded Logic Flip-Flops: A Conceptual ReviewEmbedded Logic Flip-Flops: A Conceptual Review
Embedded Logic Flip-Flops: A Conceptual ReviewSudhanshu Janwadkar
 

Plus de Sudhanshu Janwadkar (20)

DSP Processors versus ASICs
DSP Processors versus ASICsDSP Processors versus ASICs
DSP Processors versus ASICs
 
Keypad Interfacing with 8051 Microcontroller
Keypad Interfacing with 8051 MicrocontrollerKeypad Interfacing with 8051 Microcontroller
Keypad Interfacing with 8051 Microcontroller
 
ASIC design Flow (Digital Design)
ASIC design Flow (Digital Design)ASIC design Flow (Digital Design)
ASIC design Flow (Digital Design)
 
Fpga architectures and applications
Fpga architectures and applicationsFpga architectures and applications
Fpga architectures and applications
 
LCD Interacing with 8051
LCD Interacing with 8051LCD Interacing with 8051
LCD Interacing with 8051
 
Interrupts in 8051
Interrupts in 8051Interrupts in 8051
Interrupts in 8051
 
Serial Communication in 8051
Serial Communication in 8051Serial Communication in 8051
Serial Communication in 8051
 
Introduction to 8051 Timer/Counter
Introduction to 8051 Timer/CounterIntroduction to 8051 Timer/Counter
Introduction to 8051 Timer/Counter
 
Intel 8051 Programming in C
Intel 8051 Programming in CIntel 8051 Programming in C
Intel 8051 Programming in C
 
Hardware View of Intel 8051
Hardware View of Intel 8051Hardware View of Intel 8051
Hardware View of Intel 8051
 
Architecture of the Intel 8051 Microcontroller
Architecture of the Intel 8051 MicrocontrollerArchitecture of the Intel 8051 Microcontroller
Architecture of the Intel 8051 Microcontroller
 
Introduction to Embedded Systems
Introduction to Embedded SystemsIntroduction to Embedded Systems
Introduction to Embedded Systems
 
CMOS Logic
CMOS LogicCMOS Logic
CMOS Logic
 
Interconnects in Reconfigurable Architectures
Interconnects in Reconfigurable ArchitecturesInterconnects in Reconfigurable Architectures
Interconnects in Reconfigurable Architectures
 
Introduction to FPGAs
Introduction to FPGAsIntroduction to FPGAs
Introduction to FPGAs
 
Design and Implementation of a GPS based Personal Tracking System
Design and Implementation of a GPS based Personal Tracking SystemDesign and Implementation of a GPS based Personal Tracking System
Design and Implementation of a GPS based Personal Tracking System
 
Embedded Logic Flip-Flops: A Conceptual Review
Embedded Logic Flip-Flops: A Conceptual ReviewEmbedded Logic Flip-Flops: A Conceptual Review
Embedded Logic Flip-Flops: A Conceptual Review
 
Pass Transistor Logic
Pass Transistor LogicPass Transistor Logic
Pass Transistor Logic
 
Memory and Processor Testing
Memory and Processor TestingMemory and Processor Testing
Memory and Processor Testing
 
Pass Transistor Logic
Pass Transistor LogicPass Transistor Logic
Pass Transistor Logic
 

Dernier

ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 

Dernier (20)

Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 

SPI Bus Protocol

  • 1. SPI Bus Protocol 20th April 2018 Sudhanshu Janwadkar, SVNIT
  • 2. Introduction • The Serial Peripheral Interface bus (SPI) is  synchronous  serial communication interface specification  used for short distance communication • The interface was developed by Motorola in 1980s • SPI devices communicate in full duplex mode using a master-slave architecture with a single master.  The master device originates the frame for reading and writing.  Multiple slave devices are supported through selection with individual slave select (SS) lines.
  • 3. The trouble with asynchronous protocols • The common serial port, such as UART, is called “asynchronous” because there is no control over when data is sent or any guarantee that both sides are running at precisely the same rate. • There can be an issue when two systems with slightly different clocks try to communicate with each other. • To mitigate this issue, asynchronous serial connections add extra start and stop bits to each byte, so as to help the receiver sync up to data as it arrives. • Both sides must also agree on the same baud rate in advance.
  • 4. The trouble with asynchronous protocols • Asynchronous serial works just fine, but  has a lot of overhead in both the extra start and stop bits sent with every byte  the complex hardware required to send and receive data  if both sides aren’t set to the same speed, the received data will be garbage. This is because the receiver is sampling the bits at very specific times If the receiver is looking at the wrong times, it will see the wrong bits.
  • 5. How is ‘synchronous’ beneficial? • A “synchronous” data bus uses separate lines for data and clock that keeps both sides in perfect sync. • 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 • Because the clock is sent along with the data, specifying the speed isn’t important, although devices will have a top speed at which they can operate
  • 6. The SPI Protocol - basics • The SPI bus can operate with a single master device and with one or more slave devices. • One unique feature of SPI is that data can be transferred without interruption. • Any number of bits can be sent or received in a continuous stream.  With I2C and UART, data is sent in packets, limited to a specific number of bits.  Start and stop conditions define the beginning and end of each packet, so the data is interrupted during transmission.
  • 7. • Devices communicating via SPI are in a master- slave relationship. • In SPI, only one side generates the clock signal  The side that generates the clock is called the “master”, and the other side is called the “slave”. • The master is the controlling device (usually a microcontroller), while the slave (usually a sensor, display, or memory chip) takes instruction from the master. • There is always only one master but there can be multiple slaves. The SPI Protocol - basics
  • 8. The SPI Interface The SPI bus specifies four logic signals:  SCLK: Serial Clock (output from master).  MOSI: Master Output Slave Input (data output from master).  MISO: Master Input Slave Output, or Master In Slave Out (data output from slave).  SS: Slave Select (often active low, output from master).
  • 9. The SPI Interface Serial Clock (SCLK) • SPI is a synchronous communication protocol. • The clock signal synchronizes the output of data bits from the master with the sampling of bits by the slave. • One bit of data is transferred in each clock cycle, so the speed of data transfer is determined by the frequency of the clock signal. • SPI communication is always initiated by the master since the master configures and generates the clock signal.
  • 10. The SPI Interface Slave Select • The master can choose which slave it wants to communicate to by setting the slave’s CS/SS line to a low voltage level. • In the idle, non-transmitting state, the slave select line is kept at a high voltage level.  Multiple CS/SS pins may be available on the master, which allows for multiple slaves to be wired in parallel.  If only one CS/SS pin is present, multiple slaves can be wired to the master by daisy-chaining
  • 11. The SPI Interface Multiple Slaves  Multiple CS/SS pins are available on the master Only one CS/SS pin is present, multiple slaves are wired to the master by daisy-chaining
  • 12. The Protocol 1. To begin communication, the bus master configures the clock, using a frequency supported by the slave device, typically up to a few MHz. 2. The master then selects the slave device with a logic level 0 on the select line.  If a waiting period is required, such as for an analog- to-digital conversion, the master must wait for at least that period of time before issuing clock cycles. 3. During each SPI clock cycle, a full duplex data transmission occurs.  The master sends a bit on the MOSI line and the slave reads it, while the slave sends a bit on the MISO line and the master reads it.
  • 13. The Protocol (summary) 1. The master outputs the clock signal 2. The master switches the SS/CS pin to a low voltage state, which activates the slave:
  • 14. The Protocol (summary) 3. The master sends the data one bit at a time to the slave along the MOSI line. The slave reads the bits as they are received 4. If a response is needed, the slave returns data one bit at a time to the master along the MISO line. The master reads the bits as they are received
  • 15. Data Transmission in SPI • Transmissions normally involve two shift registers of some given word size ( may be 8eight bits), one in the master and one in the slave • They are connected in a virtual ring topology. • Data is usually shifted out with the most-significant bit first. On the clock edge, both master and slave shift out a bit and output it on the transmission line to the counterpart.
  • 16. Data Transmission in SPI • On the next clock edge, at each receiver the bit is sampled from the transmission line and set as a new least-significant bit of the shift register. • After the register bits have been shifted out and in, the master and slave have exchanged register values. • If more data needs to be exchanged, the shift registers are reloaded and the process repeats. • Transmission may continue for any number of clock cycles. • When complete, the master stops toggling the clock signal, and typically deselects the slave.
  • 17. Advantages of SPI • Full duplex • Push-pull drivers (as opposed to open drain) 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 • Not limited to 8-bit words • Slaves use the master's clock and do not need precision oscillators • Slaves do not need a unique address — unlike I²C or GPIB or SCSI
  • 18. Limitations of SPI • Requires more pins on IC packages than I²C • 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
  • 19. Applications of SPI SPI is used to talk to a variety of peripherals, such as • Sensors: temperature, pressure, ADC, touchscreens, video game controllers • Control devices: audio codecs, digital potentiometers, DAC • Memory: flash and EEPROM • Real-time clocks • LCD, sometimes even for managing image data • Any MMC or SD card
  • 20. Review Questions 1. Compare and contrast UART, I2C and SPI, citing the features, advantages and disadvantages of each. 2. What are the demerits of asynchronous communication protocols? How are they overcome in SPI? 3. List out the Interface signals used in SPI protocol and brief out their significance. 4. List the set of operations involved in completing a serial communication using SPI protocol. Draw the hardware interface, in support. 5. List out the advantages and limitations of SPI protocol. Also, list some of the applications.