SPI Protocol and DAC Interfacing

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

Serial Communications Interface (SCI) Michael LennardZachary PetersBao Nguyen.
Anurag Dwivedi Rudra Pratap Suman. Scope of Communica tion Telephones and Cell Phones.
PROGRAMMABLE PERIPHERAL INTERFACE -8255
Programmable Keyboard/ Display Interface: 8279
ECE 371 Unit 13 - Part 1 Serial Peripheral Interface (SPI)
Serial Communication Buses: I 2 C and SPI By Brody Dunn.
Serial Peripheral Interface (SPI)
ECE 353 Introduction to Microprocessor Systems Michael G. Morrow, P.E. Week 13.
INPUT-OUTPUT ORGANIZATION
Serial Communication Interface (SCI) Kevin Stuart Matt Betts March 27, 2007 ME 6405, Sp 07.
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)
Khaled A. Al-Utaibi  Intel Peripheral Controller Chips  Basic Description of the 8255  Pin Configuration of the 8255  Block Diagram.
CRKit RF Control WINLAB – Rutgers University Date : June Authors : Prasanthi Maddala, Khanh Le,
CRKit RF Control WINLAB – Rutgers University Date : June Authors : Prasanthi Maddala, Khanh Le,
CRKit RF Control WINLAB – Rutgers University Date : June Authors : Prasanthi Maddala, Khanh Le,
CRKit RF Control WINLAB – Rutgers University Date : June Authors : Prasanthi Maddala, Khanh Le,
7/23 Inter-chip Serial Communication: SPI and I 2 C Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee.
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.
Universal Asynchronous Receiver/Transmitter (UART)
ECE 353 Introduction to Microprocessor Systems Michael Schulte Week 13.
Scott Baker Will Cross Belinda Frieri March 9 th, 2005 Serial Communication Overview ME4447/6405.
 8251A is a USART (Universal Synchronous Asynchronous Receiver Transmitter) for serial data communication.  Programmable peripheral designed for synchronous.
7 - 1 Texas Instruments Incorporated Module 7 : Serial Peripheral Interface C28x 32-Bit-Digital Signal Controller TMS320F2812.
Appendix B: System Development Example MTT48 V2.1 B - 1 APPENDIX B: SYSTEM DEVELOPMENT.
12/16/  List the elements of 8255A Programmable Peripheral Interface (PPI)  Explain its various operating modes  Develop a simple program to.
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.
RX Serial Peripheral Interface (RSPI)
©2008 R. Gupta, UCSD COSMOS Summer 2008 Peripheral Interfaces Rajesh K. Gupta Computer Science and Engineering University of California, San Diego.
Serial Communications Interface Module Slide #1 of 19 MC68HC908GP20 Training PURPOSE -To explain how to configure and use the Serial Communications Interface.
OCRP RF Control WINLAB – Rutgers University Date : June Authors : Prasanthi Maddala, Khanh Le,
8255:Programmable Peripheral Interface
Communicating. The ATmega16 communicates through one of the following ways: Serial Peripheral Interface (SPI) Universal Synchronous and Asynchronous serial.
BIRLA VISHVAKARMA MAHAVIDYALAY SUBJECT: SPI PROTOCOL & MAX7221 DISPLAY INTERFACING SUBMITTED BY: KISHAN AVASTHI( ) MANSI CHANDEGARA( )
KEYBOARD/DISPLAY CONTROLLER - INTEL Features of 8279 The important features of 8279 are, Simultaneous keyboard and display operations. Scanned keyboard.
©F.M. Rietti Communication Lines Fundamentals. ©F.M. Rietti LM-18 Computer Science SSI Embedded Systems I 2 Communication Lines Generally used to connect.
 The LPC2xxx devices currently have two on- chip UARTS.  Except UART1 has additional modem support.
STUDY OF PIC MICROCONTROLLERS.. Design Flow C CODE Hex File Assembly Code Compiler Assembler Chip Programming.
Application Case Study Christmas Lights Controller
The HCS12 SCI Subsystem A HCS12 device may have one or two serial communication interface. These two SCI interfaces are referred to as SCI0 and SCI1. The.
PROGRAMMABLE PERIPHERAL INTERFACE -8255
I2C Protocol and RTC Interfacing
Serial Communication Buses: I2C and SPI
Tutorial Introduction
Chapter 11: Inter-Integrated Circuit (I2C) Interface
1 Input-Output Organization Computer Organization Computer Architectures Lab Peripheral Devices Input-Output Interface Asynchronous Data Transfer Modes.
SERIAL PERIPHERAL INTERFACE
SPI Protocol and DAC Interfacing
Keyboard/Display Controller INTEL 8279
I2C Protocol and RTC Interfacing
SPI Protocol and DAC Interfacing
BJ Furman ME 106 Fundamentals of Mechatronics 15NOV2012
SPI Protocol and DAC Interfacing
UART Serial Port Programming
PROGRAMMABLE PERIPHERAL INTERFACE -8255
SPI Protocol and DAC Interfacing
8255.
ADC, DAC, and Sensor Interfacing
Serial Communication Interface: Using 8251
Parallel communication interface 8255
SPI Protocol Sepehr Naimi
LCD and Keyboard Interfacing
Keyboard/Display Controller (8279)
SPI Protocol and Programming
EUSART Serial Communication.
Serial Communication 19th Han Seung Uk.
Serial Peripheral Interface Bus
The Programmable Peripheral Interface (8255A)
Presentation transcript:

SPI Protocol and DAC Interfacing Chapter 8 SPI Protocol and DAC Interfacing

SPI Bus vs. Traditional Parallel Bus Connection to Microcontroller

SPI Architecture

SPI Clock Polarity and phase

SPI Clock Polarity and phase CPOL CPHA Data Read and change time SPI Mode read on rising edge, changed on a falling edge 1 read on falling edge, changed on a rising edge 2 3

Some of the KL25Z SPI Registers Absolute Address Register 4007 6000 SPI control register 1 (SPI0_C1) 4007 6001 SPI control register 2 (SPI0_C2) 4007 6002 SPI baud rate register (SPI0_BR) 4007 6003 SPI status register (SPI0_S) 4007 6005 SPI data register (SPI0_D) 4007 7000 SPI control register 1 (SPI1_C1) 4007 7001 SPI control register 2 (SPI1_C2) 4007 7002 SPI baud rate register (SPI1_BR) 4007 7003 SPI status register (SPI1_S) 4007 7005 SPI data register (SPI1_D)

SIM_SCGC4 register for enabling Clock to SPI

SPIx_C1 Control 1 Register

SPIx_C1 Control 1 Register Field Bit Descriptions SPIE D7 SPI Interrupt Enable. This bit enables SPI interrupt request for SPRF and MODF. 1 = SPRF and MODF interrupts enabled 0 = SPRF and MODF interrupts disabled SPE D6 SPI System Enable bit 1 = Enables SPI port and configures pins as serial port pins 0 = Disables SPI port and configures these pins as I/O ports SPTIE D5 SPI Transmit Interrupt Enable. This bit enables the SPI interrupt request if SPTEF = 1. 1 = SPTEF interrupt enabled 0 = SPTEF interrupt disabled MSTR D4 SPI Master/Slave mode Select bit. This bit selects master or slave mode. 1 = SPI in master mode 0 = SPI in slave mode CPOL D3 SPI Clock Polarity bit 1 = Active-LOW clocks selected. In idle state SCK is high. 0 = Active-HIGH clocks selected. In idle state SCK is low. CPHA D2 SPI Clock Phase bit 1 = Sampling of data occurs at even edges of the SCK clock. 0 = Sampling of data occurs at odd edges of the SCK clock. SSOE D1 Slave Select Output Enable. See the KL25Z manual. LSBFE D0 LSB First Enable 1 = Data is transferred least significant bit first. 0 = Data is transferred most significant bit first.

SPIxC2 (SPI Control 2) Register

SPIxC2 (SPI Control 2) Register Field Bit Descriptions MODFEN D4 Mode Fault Enable Bit. See the KL25Z reference manual. 1 = SS port pin with MODF feature 0 = SS port pin is not used by the SPI (default) BIDIROE D3 Bidirectional Output Enable. Used in bidirectional mode. 1 = Output Buffer enabled. See the HCS12 manual. 0 = Output Buffer enabled. (default) SPC0 D0 Serial Pin Control bit 0. Used in bidirectional mode. 1 = Bidirectional. See the KL25Z reference manual. 0 = Normal (default)

SPI Baud Rate Generation

SPIx_BR Register

SPIx_BR Register Field Bit Description SPPR2–SPPR0 D6–D4 SPI Baud Rate Prescaler Divisor bits SPR3–SPR0 D3–D0 SPI Baud Rate Divisor bits These bits specify the SPI baud rates as shown in the following two equations: BaudRateDivisor = (SPPR + 1) × 2 (SPR + 1) Baud Rate = BusClock / BaudRateDivisor

Some possible Values for SPIx_BR Register SPPR2 SPPR1 SPPR0 SPR3 - SPR0 SPIx_BR (Hex) BaudRateDivisor 0 0 0 0 0 0 0 00 2 0 0 0 1 01 4 0 0 1 0 02 8 0 0 1 1 03 16 0 1 0 0 04 32 0 1 0 1 05 64 . . . . . . . . . . . . 1 1 0 0 1 1 1 67 1792 1 1 1 70 71 72 73 128 74 256 75 512 0 1 1 0 76 1024 77 2048 Note: The highest Baud Rate = BusFreq/2 and the lowest Baud Rate is BusFreq/2048

SPI Data (SPIx_D) Register

SPI Status (SPIx_S) Register

SPI Status (SPIx_S) Register Field Bit Descriptions SPRF D7 SPI read buffer full Flag. This bit is set after a received byte of data has been placed into the SPI Data Register. This bit is cleared by reading the SPI Status Register (SPIx_S) followed by a read from the SPI Data Register. 1 = New data has been received and placed in SPIx_D. 0 = Transfer not yet complete   SPTEF D5 SPI Transmit Buffer Empty Flag. If set, this bit indicates that the transmit data register is empty and ready for a new byte of data. 1 = SPI Data Register empty 0 = SPI Data Register not empty MODF D4 Mode Fault flag is used for mode selection error. See the KL25Z manual. 1 = Mode fault has occurred. 0 = Mode fault has not occurred.

I/O Pin Assignment for both SPI0 and SPI1 Modules

Initialization Flowchart for SPI Master Device

Common Cathode Connections in a 7-Segment Display

MAX7219 and MAX7221

MAX7221 Connections to the Microcontroller

MAX7221 Packet Format

List of Commands in MAX7221/MAX7219 Hex Code No operation X X0 Set value of digit 0 1 X1 Set value of digit 1 X2 Set value of digit 2 X3 Set value of digit 3 X4 Set value of digit 4 X5 Set value of digit 5 X6 Set value of digit 6 X7 Set value of digit 7 X8 Set decoding mode X9 Set intensity of light XA Set scan limit XB Turn on/off XC Display test XF Notes: X means don't care. Digits are designated as 0-7 to drive total of eight 7-segment LEDs.

Set Decoding Mode Command Format

Bits Assigned to Segments