The Serial Peripheral Interface

Similar documents
The I2C BUS Interface

The Controller Area Network (CAN) Interface

Introduction to L.A.P. 1

Using the Special Function Registers of the Digital I/O interface of STM32

Using the Digital I/O interface of STMicroelectronics STM32 Microcontrollers

Using the Special Function Registers of the Digital I/O interface of STM32

Introduction. Serial Peripheral Interface (SPI) SPI Basics. Capabilities of SPI

Understanding SPI with Precision Data Converters

Universität Dortmund. IO and Peripheral Interfaces

Lecture 14 Serial Peripheral Interface

McMaster University Embedded Systems. Computer Engineering 4DS4 Lecture 6 Serial Peripherals Amin Vali Feb. 2016

Embedded Systems and Software. Serial Interconnect Buses I 2 C (SMB) and SPI

Real Time Embedded Systems. Lecture 1 January 17, 2012

Serial Peripheral Interface. What is it? Basic SPI. Capabilities. Protocol. Pros and Cons. Uses

The Analog to Digital Converter (ADC)

< W3150A+ / W5100 Application Note for SPI >

or between microcontrollers)

The 9S12 Serial Peripheral Inteface (SPI) Huang Section 10.2 through 10.6 SPI Block User Guide

Using Timers of Microchip PIC18F Microcontrollers

Microcontrollers and Interfacing

Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso

EE 456 Fall, Table 1 SPI bus signals. Figure 1 SPI Bus exchange of information between a master and a slave.

PARALLEL COMMUNICATIONS

Groking the Linux SPI Subsystem FOSDEM Matt Porter

Parallel Data Transfer. Suppose you need to transfer data from one HCS12 to another. How can you do this?

Introduction the Serial Communications Parallel Communications Parallel Communications with Handshaking Serial Communications

Introduction the Serial Communications Huang Sections 9.2, 10.2 SCI Block User Guide SPI Block User Guide

PIC Serial Peripheral Interface (SPI) to Digital Pot

SPI Overview and Operation

Level Translator For SPI and I²C Bus Signals

Amarjeet Singh. January 30, 2012

Design Development and Implementation of SPI

LAB4. Program the on chip SPI module

CprE 488 Embedded Systems Design. Lecture 4 Interfacing Technologies

IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT -4 1 UNIT 4

ECE 471 Embedded Systems Lecture 20

Additional Timer Functionalities. Capture, Compare, PWM

spi 1 Fri Oct 13 13:04:

Raspberry Pi - I/O Interfaces

Handling Asynchronous Events in MCUs A Light Keyboard Driver

ICS Humla CTF. Copyright 2017 Payatu 1

More on the 9S12 SPI Using the Dallas Semiconductor DS1302 Real Time Clock with the 9S12 SPI

PAN502x Capacitive Touch Controller Datasheet

Serial Communication. Simplex Half-Duplex Duplex

Serial Buses in Industrial and Automotive Applications

Lecture 25 March 23, 2012 Introduction to Serial Communications

An SPI interface for the 65(C)02 family of microprocessors

Design with Microprocessors

App Note Application Note: Addressing Multiple FPAAs Using a SPI Interface

Interfacing Techniques in Embedded Systems

SPI 3-Wire Master (VHDL)

SPI Protocol of the TLE941xy family

Introducing SPI Xpress SPI protocol Master / Analyser on USB

SPI: Serial Peripheral Interface

EE 308 Spring Using the 9S12 SPI

Serial Peripheral Interface Bus SPI

Module 3.C. Serial Peripheral Interface (SPI) Tim Rogers 2017

Microcontrollers and Interfacing week 10 exercises

Growing Together Globally Serial Communication Design In Embedded System

i_csn i_wr i_rd i_cpol i_cpha i_lsb_first i_data [15:0] o_data [15:0] o_tx_ready o_rx_ready o_rx_error o_tx_error o_tx_ack o_tx_no_ack

Introduction to I2C & SPI. Chapter 22

Pmod modules are powered by the host via the interface s power and ground pins.

LABORATORIO DI ARCHITETTURE E PROGRAMMAZIONE DEI SISTEMI ELETTRONICI INDUSTRIALI. Laboratory Lesson 9: Serial Peripheral Interface (SPI)

Using the MagAlpha Serial Interface Advanced Features. Application Note

Using the Z8051 MCU s USI Peripheral as an SPI Interface

Serial Communication. Spring, 2018 Prof. Jungkeun Park

FPGA Implementation Of SPI To I2C Bridge

ASNTu2s PCB with Tiger Board USB to 7-Channel 3-Wire Interface Bridge Application Notes

By: Haron Abdel-Raziq

intan intan RHD2000 Dual Headstage Adapter RHD2000 Dual Headstage Adapter Features Applications Description TECHNOLOGIES, LLC

Groking the Linux SPI Subsystem Embedded Linux Conference Matt Porter

Mbed Microcontroller SPI. Spring, 2018 Prof. Jungkeun Park

Digital Storage Oscilloscope

An SPI Temperature Sensor Interface with the Z8 Encore! SPI Bus

SPI bus communication with LDE/LME pressure sensors

PIN ASSIGNMENT PIN DESCRIPTION

Basics of UART Communication

High Speed SPI Slave Implementation in FPGA using Verilog HDL

SPI master multifield HDL core

output current sink/source 2 ma PIC 16F690 (see datasheet) SPI resolution 12 bit position accuracy 0.2 deg

UART TO SPI SPECIFICATION

ZigBee Compliant Platform 2.4G RF Low Power Transceiver Module for IEEE Standard. DATA SHEET Version B

Temperature Sensor TMP2 PMOD Part 1

SPI - Serial Peripheral Interface

MISO MOSI Clock. The master and the slave use a protocol based on the following frame structure. Preamble Body Postamble

ArduCAM-M-2MP Camera Shield

1.3inch OLED User Manual

SPI Xpress. Data sheet

Serial Communication. Simplex Half-Duplex Duplex

How to Troubleshoot System Problems Using an Oscilloscope with I 2 C and SPI Decoding APPLICATION NOTE

Block Diagram. mast_sel. mast_inst. mast_data. mast_val mast_rdy. clk. slv_sel. slv_inst. slv_data. slv_val slv_rdy. rfifo_depth_log2.

I 2 C and SPI Protocol Triggering and Decode for Infiniium 9000 Series Oscilloscopes

PSIM Tutorial. How to Use SPI in F2833x Target. February Powersim Inc.

For reference only Refer to the latest documents for details

Part 1 Using Serial EEPROMs

Doc: page 1 of 8

SPI Block User Guide V02.07

C8051F700 Serial Peripheral Interface (SPI) Overview

± 2g Tri-axis Accelerometer Specifications

ams AG austriamicrosystems AG is now The technical content of this austriamicrosystems document is still valid. Contact information:

Transcription:

(SPI) ARSLAB - Autonomous and Robotic Systems Laboratory Dipartimento di Matematica e Informatica - Università di Catania, Italy santoro@dmi.unict.it L.S.M. 1 Course

What is SPI? The SPI Serial Peripheral Interface is a communication hardware designed to interconnect integrated circuits to a MCU belonging to the same board. It has been introduced by Motorola in the 80s. Now, it is a standard interface supported by any MCU and many devices like sensors, memories (EEPROM, SDCards, etc.), power drivers, etc.

SPI: Philosophy and Connections SPI Master (MCU) MOSI MISO SPI Slave (e.g. Sensor) SPI is a Master-Slave interface: Master, is the head of the communication and is - in general - a MCU; Slave, all the other devices which respond to master solicitations. It has (at least) 4 point-to-point unidirectional wires: Master to Slave, the serial clock, generated by the Master; MOSI Master to Slave, Master-Out-Slave-In, the serial data transmitted by the Master and sent to a Slave; MISO Slave to Master, Master-In-Slave-Out, the serial data transmitted by a Slave and sent to the Master; Slave to Master, Slave Select, a logic signal that is used to wake-up and select a slave device.

SPI: Signals and Timing MOSI D0 D1 D2 D3 D4 Dn-1 Dn MISO D0 D1 D2 D3 D4 Dn-1 Dn A SPI Transaction is always started by the Master by setting the Line to Logic 0 The Master then starts to generating the clock signal in the Line At each clock tick: The Master puts a data-bit in the MOSI Line The Slave puts a data-bit in the MISO Line When the transation terminates, the Master sets the Line to Logic 1

Meaning of Data Bits MOSI D0 D1 D2 D3 D4 Dn-1 Dn MISO D0 D1 D2 D3 D4 Dn-1 Dn Conceptually, communication is packet-based A packet is a set of bits, whose meaning is defined by the slave device addressed The number of bits of a packet may be multiple of 8, but this is not a mandatory requirement

Example: the MCP4921/MCP4922 Voltage Output SPI Interface The MCP4921/MCP4922 chip are Digital-to-Analog Converters (DAC) A DAC is a circuit that receives a digital data and is able to generate a voltage signal proportional to the received data The MCP4921 has only one output channel, the MCP4922 has two output channels The SPI interface of MCP4921 is made of the following signals: CS, Chip Select, alternative name for, the Serial Clock (from master) SDI, Serial Data Input, alternative name for MOSI

Example: the data packet of MCP4921/MCP4922 The SPI packet, sent by the Master, is made of 16 bit: The first 4 bits represent a configuration of the chip A/B, channel select (for the MCP4922) GA, gain (proportionality factor) control SHDN, shutdown bit (turns off the output) The other 12 bits represent the DAC value The chip does not generate data, so it does not have a MISO line

Multiple Slaves: Parallel Connection SPI Master (MCU) MISO MOSI SPI Slave 1 1 MOSI SPI Slave 2 MISO 2 When more that a single SPI device is present, parallel connection may be employed, MOSI and MISO are wired together A line per addressed device is present When a specific slave needs to be addressed, the relevant line is activated

Multiple Slaves: Daisy-Chain Connection SPI Master (MCU) MOSI MISO SPI Slave 1 MOSI SPI Slave 2 MISO The daisy-chain connection implies a MOSI/MISO cascade connection of all SPI slave devices MOSI and MISO lines are connected in sequence A single line for all devices is present The devices must support this kind of connection Since all slaves are involved in each transaction, the SPI packet must contain the address of the device to interact with

Clock Polarity and Phase The clock of the SPI interface can be programmed in order to set its behaviour There are two kind of setting: CPOL = Clock Polarity: specifies the initial logic state of the clock CPHA = Clock Phase: specifies the clock transition used to sample data (thus data changes in the other transition) MOSI D0 D1 D2 D3 D4 Dn-1 Dn MISO D0 D1 D2 D3 D4 Dn-1 Dn

Clock Polarity and Phase The clock of the SPI interface can be programmed in order to set its behaviour There are two kind of setting: CPOL = Clock Polarity: specifies the initial logic state of the clock CPHA = Clock Phase: specifies the clock transition used to sample data (thus data changes in the other transition), CPOL = 0, CPOL = 1 MOSI D0 D1 D2 D3 D4 Dn-1 Dn CPHA = 0 MISO D0 D1 D2 D3 D4 Dn-1 Dn CPHA = 0, data is sampled in the first edge of the clock

Clock Polarity and Phase The clock of the SPI interface can be programmed in order to set its behaviour There are two kind of setting: CPOL = Clock Polarity: specifies the initial logic state of the clock CPHA = Clock Phase: specifies the clock transition used to sample data (thus data changes in the other transition), CPOL = 0, CPOL = 1 MOSI D0 D1 D2 D3 D4 Dn-1 Dn CPHA = 1 MISO D0 D1 D2 D3 D4 Dn-1 Dn CPHA = 1, data is sampled in the second edge of the clock

SPI and I 2 C: Comparison Wiring: I 2 C has only two lines SPI has at least four lines Electrical Aspects: I 2 C is a bus and has also a bidirectional line, therefore is more critical (from the electrical point of view) with respect to SPI SPI has point-to-point unidirectional lines Speed: Due to electrical characteristics, I 2 C is designed for a max speed of 400 Kbps SPI has no theoretical speed limit, even if the rule-of-thumb suggests 1 Mbps

SPI and I 2 C: Comparison Protocol and Addressing: I 2 C specifies a standard for device addressing and functionalities are mapped to device registers SPI does not define a standard data frame, each device has its own data format Number of supported devices: I 2 C is a bus and thus it has no theoretical limit on the number of devices that can be interconnected Limits on SPI are defined by the number of wires (in case of parallel connection) or latency (in case of daisy-chain connection)

(SPI) ARSLAB - Autonomous and Robotic Systems Laboratory Dipartimento di Matematica e Informatica - Università di Catania, Italy santoro@dmi.unict.it L.S.M. 1 Course