ECE 371 Unit 13 - Part 1 Serial Peripheral Interface (SPI)

Slides:



Advertisements
Similar presentations
IO Interfaces and Bus Standards. Interface circuits Consists of the cktry required to connect an i/o device to a computer. On one side we have data bus.
Advertisements

The 8051 Microcontroller Chapter 5 SERIAL PORT OPERATION.
Bits and Bytes + Controlling 8 LED with 3 Pins Binary Counting and Shift Registers.
SHIFT REGISTERS: CONVERTING BETWEEN SERIAL AND PARALLEL DATA Mark Neil - Microprocessor Course 1 Serial versus Parallel Data Transfers.
SPI Serial Peripheral Interface. SPI Serial Peripheral Interface is communication between two devices, one bit at a time sequential one bit at time over.
Lecture 8: Serial Interfaces
Shift Register Application Chapter 22 Subject: Digital System Year: 2009.
HD44780 LCD programming From the Hardware Side Design and implementation details on the way to a valid SPI-LCD interface driver.
Serial Communication Buses: I 2 C and SPI By Brody Dunn.
Guitar Effects Processor Critical Design Review October, 07, 2003 Groups Members: Adam Bernstein Hosam Ghaith Jasenko Alagic Matthew Iyer Yousef Alyousef.
Serial Peripheral Interface (SPI)
SPISPI Term Dr Abdelhafid Bouhraoua Term Dr Abdelhafid Bouhraoua.
7-1 Digital Serial Input/Output Two basic approaches  Synchronous shared common clock signal all devices synchronised with the shared clock signal data.
1 ECE 263 Embedded System Design Lessons 2, 3 68HC12 Hardware Overview, Subsystems, and memory System.
9/20/6Lecture 3 - Instruction Set - Al Hardware interface (part 2)
ECE 353 Introduction to Microprocessor Systems Michael G. Morrow, P.E. Week 13.
ECE 301 – Digital Electronics Flip-Flops and Registers (Lecture #15)
Interfaces A practical approach. Lesson 2 I2C and SPI
Serial Peripheral Interface (SPI) Bus. SPI Bus There is no official specification for the SPI bus. It is necessary to consult the data sheets of the devices.
Serial Peripheral Interface Module MTT M SERIAL PERIPHERAL INTERFACE (SPI)
ECE 265 – LECTURE 12 The Hardware Interface 8/22/ ECE265.
HD44780 LCD programming From the Hardware Side
Lecture 111 Lecture 11: Lab 3 Overview, the ADV7183B Video Decoder and the I 2 C Bus ECE 412: Microcomputer Laboratory.
CRKit RF Control WINLAB – Rutgers University Date : June Authors : Prasanthi Maddala, Khanh Le,
4.0 rtos implementation part II
DEVICES AND COMMUNICATION BUSES FOR DEVICES NETWORK–
Input/Output mechanisms
CRKit RF Control WINLAB – Rutgers University Date : June Authors : Prasanthi Maddala, Khanh Le,
Dr. Rabie A. Ramadan Al-Azhar University Lecture 6
Volume. 1-the idea of the program is to increase, decrease the volume. 2-the program does the following: A-PF8:decrease the volume B-Pf9:increase the.
16F877A. Timer 0 The Timer0 module timer/counter has the following features: –8-bit timer/counter –Readable and writable –8-bit software programmable.
Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.
1 Neutron Monitor Workshop 3(B): Next Generation Readout Board Mahidol University January 6, 2010 Paul Evenson University of Delaware Bartol Research Institute.
ECE 353 Introduction to Microprocessor Systems Michael Schulte Week 13.
Chapter 8 Serial and Parallel Port Interfacing Valvano’s Intro. To Embedded Systems.
Embedded System Design Laboratory October 4, 2002Stanford University - EE281 Lecture #3#1 Lecture #3 Outline Announcements AVR Processor Resources –UART.
University of Calcutta CBM 1 ROC Design Issues Dr. Amlan Chakrabarti, Dr. Sanatan Chattopadhyay & Mr. Suman Sau.
 8251A is a USART (Universal Synchronous Asynchronous Receiver Transmitter) for serial data communication.  Programmable peripheral designed for synchronous.
Network and Systems Laboratory nslab.ee.ntu.edu.tw se.
OCRP RF Control WINLAB – Rutgers University Date : June Authors : Prasanthi Maddala, Khanh Le,
HCS12 Technical Training, Rev 2.0 Module 7- SCI, Slide 1 MOTOROLA and the Stylized M Logo are registered in the US Patent & Trademark Office. All other.
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose:  This course provides an overview of the serial communication.
OCRP RF Control WINLAB – Rutgers University Date : June Authors : Prasanthi Maddala, Khanh Le,
Essentials of Communication This simple model requires many guarantees. Sender Receiver Communication Link Data.
Revised: Aug 1, ECE263 Embedded System Design Lessons 27, 28 Serial Peripheral Interface.
Department of Electronic & Electrical Engineering Serial interfaces Serial Interfaces allow communication between devices sending one bit at a time. In.
ECE 371 Microprocessor Interfacing
Serial Peripheral Interface SPI I2C (i-squared cee)
SHIFT REGISTERS: CONVERTING BETWEEN SERIAL AND PARALLEL DATA Mark Neil - Microprocessor Course 1 Serial versus Parallel Data Transfers.
Embedded Systems February 10, Serial Interface - SPI  Serial Peripheral Interface  Synchronous communications  Clock supplied by the Master.
Embedded Communication Protocols Don Heer 10/18/10 1.
Networked Embedded Systems Sachin Katti & Pengyu Zhang EE107 Spring 2016 Lecture 9 Serial Buses – SPI, I2C.
BIRLA VISHVAKARMA MAHAVIDYALAY SUBJECT: SPI PROTOCOL & MAX7221 DISPLAY INTERFACING SUBMITTED BY: KISHAN AVASTHI( ) MANSI CHANDEGARA( )
MICROCONTROLLER AND INTERFACING Presented by: Shefali Jethva ( ) Shivali Panchal ( ) Komal Soni ( ) Roll no. :- 14EC308.
1 Serial Peripheral Interface What is it? Basic SPI Capabilities Protocol Pros and Cons Uses Serial Peripheral Interface
Serial Communication Originally created by Anurag Dwidedi and Rudra Pratap Suman.
Serial Communication Buses: I2C and SPI
EE 107 Fall 2017 Lecture 5 Serial Buses – UART & SPI
ECE 3430 – Intro to Microcomputer Systems
Atmega32 Serial Programming Basics
BJ Furman ME 106 Fundamentals of Mechatronics 15NOV2012
EEPROM Comparison – Parallel or Serial
SPI Protocol and DAC Interfacing
SPI Protocol and DAC Interfacing
SPI Protocol and DAC Interfacing
SPI Protocol Sepehr Naimi
SYEN 3330 Digital Systems Chapter 7 – Part 1 SYEN 3330 Digital Systems.
HD44780 LCD programming From the Hardware Side
HD44780 LCD programming From the Hardware Side
14 Digital Systems.
Presentation transcript:

ECE 371 Unit 13 - Part 1 Serial Peripheral Interface (SPI)

Serial Peripheral Interface Synchronous Serial Interface Widely used to interface Peripheral Chips with Microcontrollers Much faster bit rate than asynchronous SCI method.

SPI system consist of one Master Device and one or more Slave Devices Master Device sends out a Serial Shift Clock signal (SCK) to all slaves, to serve as timing reference for the serial data transfer. No Start Bits or Stop Bits as used in SCI (asynchronous serial I/O method)

3 SPI Channels on MC9S12Dp256B Microcontroller 4 Pins Associated with Each SPI Channel - MISO (Serial input data for a Master, serial output data for a Slave) - MOSI ((Serial output data for a Master, serial input data for a Slave) - SCK (Serial data clock) - SS (Slave select; for a system with a single slave, SS = 0 selects the Slave and SS = 1 selects the Master.

Master/Slave SPI Interface

Parallel-to-Serial and Serial to Parallel-to-Serial Registers are needed to interface a peripheral device to the microcontroller using the SPI protocol. 74HC Serial-to-Parallel Converter Register - Serial Input - Parallel Output - (Also serial output) 74HC Parallel-to Serial Converter Register - Parallel Input - Serial Output - (Also Serial Input)

74HC595 8-bit Shift Register (Serial to parallel converter) Serial input Parallel output Serial output

74HC595 8-bit Shift Register and 8-bit Storage Serial input Parallel Output Serial Output

SPI Connections between the Microcontroller and a 74HC595 Register to implement an Output Port MOSI DS (Serial Data Input for 74HC595) SCK SH_CP (“Shift” Clock Pulse) SS ST_CP (Store Shift Register Data into Latch) OE = “0” (Enable Latch Output Bus Drivers) MR = “1” -- (Master Reset not active) Microcontroller signal74HC595 pin

D7D6D5D4D3D2D1D0 MOSI – Shifted into Shift Register SCLK SYNC or SS Clock Latches 74HC595 8-bit Shift Register with Output Latches

SYNC PULSE Transfer Shift Register Data to Data Latches when SYNC Pulse occurs Set Flag to Signal that there is Received Data in Data Latches Shift Data into Shift Register Shift Data into Shift Register SPI Overview

Slave – 74HC595

Serial Data Out SS SCLK Load Reset Serial Data In 74HC597 – 8 bit Parallel In Serial Out Parallel Input

SP Slave – 74HC597 LCLK = Load Parallel FF

SPI1 and SPI2 can be implemented on Port P or Port H SPI1 signals If MODRR[5]=0 SPI2 signals If MODRR[6]=0 SPI1 signals If MODRR[5]=1 SPI2 signals If MODRR[6]=1

SPI0 can be implemented on Port M or Port S SPI0 signals if MODRR[4]=0 SPI0 signals if MODRR[4]=1

Module Routing Register

SPI Channel 0 Routing

SPI Channel 1 and 2 Routing Use MODRR[5] = 0 and MODRR[6] = 0

SPI Channel 1 If SPI pin is output, then DDRx must set pin as out. SPI1 uses Port P on our System: –PP0 – MISO1 – In –PP1 – MOSI1 – Out –PP2 – SCK1 – Out –PP3 - SS1 – Out

SPI Register Designations SPI1CR1, SPI1CR2, SPI1SR, SPI1DR, SPI1BR, DDRM, PTM, DDRP, PTP Laboratory –Port M is Used to Select 1 of 8 SPI Serial Devices on Project Board –Port S Shares Pins with SPI Channel 0

Project Board Laboratory 8 SPI Devices on Project Board Port M [6:4] Selects SPI Device –PM[4] = SS0 –PM[5] = SS1 –PM[6] = SS2 D/A Converter is Device 5, (SS2 SS1 SS0 = 1 0 1) SPI Slaves Implemented with 74HC595

Slave Selection – 8 Slaves on Project Board PM[4] => SS0 PM[5] => SS1 PM[6] => SS2 SS = PP[3] SS => S5 SER_DIS = “1” Connected to gnd by jumper

SPI Channel 1 – SPI1 Port P[0] = MISO Port P[1] = MOSI Port P[2] = SCK Port P[3] = SS

SPI Channel 1 Definitions #define SPI1CR1 _P(0xF0) #define SPI1CR2 _P(0xF1) #define SPI1BR _P(0xF2) #define SPI1SR _P(0xF3) #define SPI1DR _P(0xF5)

SPI Data Register

SPI Baud Rate Register Baud = BusClock/BaudRateDivisor = /BaudRateDivisor

SPI Control Register 1

SPI Control Register 2