SPI Protocol and DAC Interfacing

Slides:



Advertisements
Similar presentations
PROGRAMMABLE PERIPHERAL INTERFACE -8255
Advertisements

The 8051 Microcontroller Chapter 5 SERIAL PORT OPERATION.
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) 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.
4.0 rtos implementation part II
16F877A. Timer 0 The Timer0 module timer/counter has the following features: –8-bit timer/counter –Readable and writable –8-bit software programmable.
I NTRODUCTION P IN CONFIGARATION O PERATING MODE.
AT91 Embedded Peripherals
Universal Asynchronous Receiver/Transmitter (UART)
 8251A is a USART (Universal Synchronous Asynchronous Receiver Transmitter) for serial data communication.  Programmable peripheral designed for synchronous.
MICROCONTROLLER SYSTEMS Part 1. Figure 1.1Elements of a digital controller CPU Central Processing Unit Input Peripherals Output Peripherals ROM Read Only.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
ARM MIPS.  32 registers, each 32-bit wide. 30 are general purpose, R30(Hi) and R31(Low) are reserved for the results of long multiplication (64-bit.
7 - 1 Texas Instruments Incorporated Module 7 : Serial Peripheral Interface C28x 32-Bit-Digital Signal Controller TMS320F2812.
INTRODUCTION TO PIC MICROCONTROLLER. Overview and Features The term PIC stands for Peripheral Interface Controller. Microchip Technology, USA. Basically.
12/16/  List the elements of 8255A Programmable Peripheral Interface (PPI)  Explain its various operating modes  Develop a simple program to.
RX Serial Peripheral Interface (RSPI)
PPI-8255.
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose:  This course provides an overview of the serial communication.
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( )
 The LPC2xxx devices currently have two on- chip UARTS.  Except UART1 has additional modem support.
16F877A.
PROGRAMMABLE PERIPHERAL INTERFACE -8255
Serial mode of data transfer
I2C Protocol and RTC Interfacing
Serial Communication Buses: I2C and SPI
Tutorial Introduction
EE 107 Fall 2017 Lecture 5 Serial Buses – UART & SPI
Introduction An interrupt is an event which informs the CPU that its service (action) is needed. Sources of interrupts: Internal fault (e.g.. divide by.
Refer to Chapter 10 in the reference book
NS Training Hardware.
Programming Microcontroller ADC – Analog Digital Converter
Programmable Interval Timer
Two Wire Interface (TWI)
ADC, DAC, and Sensor Interfacing
SERIAL PERIPHERAL INTERFACE
SPI Protocol and DAC Interfacing
DMA CONTROLLER 8257 Features: It is a 4-channel DMA.
Atmega32 Serial Programming Basics
..
Programming Microcontroller
SPI Protocol and DAC Interfacing
Interrupt and Exception Programming
SPI Protocol and DAC Interfacing
UART Serial Port Programming
STM Arm I/O Programming
PROGRAMMABLE PERIPHERAL INTERFACE -8255
8255.
UART Serial Port Programming
Serial Communication Interface: Using 8251
ADC, DAC, and Sensor Interfacing
Parallel communication interface 8255
SPI Protocol and DAC Interfacing
Programmable Interval timer 8253 / 8254
I2C Protocol and RTC Interfacing
Chapter 13 DMA Programming.
82C55 Programmable Peripheral Interface
SPI Protocol Sepehr Naimi
Programmable Interval timer 8253 / 8254
Programmable Data Communication Blocks
AVR – ATmega103(ATMEL) Architecture & Summary
EUSART Serial Communication.
Programmable Interrupt Controller (PIC)
Serial Communication 19th Han Seung Uk.
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

Master SPI Connection to multiple slaves SPI in Parallel

Master SPI Connection to multiple slaves SPI in serial

SPI Clock Polarity and phase Mode 0 (CPOL = 0, CPHA = 0) and Mode 2 (CPOL = 1, CPHA = 0)

SPI Clock Polarity and phase Mode 1 (CPOL = 0, CPHA = 1) and Mode 3 (CPOL = 1, CPHA = 1)

SPI Clock Polarity and phase 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

STM32F4xx Arm SPI Module Base Addresses 0x4001 3000 - 0x4001 33FF SPI2 0x4000 3800 - 0x4000 3BFF SPI3 0x4000 3C00 - 0x4000 3FFF

STM32F4xx SPI Registers Register Name Register Function Register Address Offset SPI_CR1 Control 1 0x00 SPI_CR2 Control 2 0x04 SPI_SR Status 0x08 SPI_DR Data 0x0C

RCC APB1 peripheral clock enable register (RCC_APB1ENR)

RCC APB2 peripheral clock enable register (RCC_APB2ENR)

SPI Control 1 (SPI_CR1) Register in STM32F4xx

SPI_CR2 (Contolr 2) Registers in STM32F4xx Bit 7 TXEIE: Tx buffer empty interrupt enable 0: TXE interrupt masked 1: TXE interrupt not masked. Used to generate an interrupt request when the TXE flag is set. Bit 6 RXNEIE: RX buffer not empty interrupt enable 0: RXNE interrupt masked 1: RXNE interrupt not masked. Used to generate an interrupt request when the RXNE flag is set. Bit 5 ERRIE: Error interrupt enable This bit controls the generation of an interrupt when an error condition occurs (OVR, CRCERR, MODF, FRE in SPI mode, and UDR, OVR, FRE in I 2 S mode). 0: Error interrupt is masked 1: Error interrupt is enabled Bit 4 FRF : Frame format 0: SPI Motorola mode 1: SPI TI mode

Using STM32F4xx SPI module as Master

Using STM32F4xx SPI module as Master

SPI_DR (Data) register

SPI_SR (Status) Register

SPI_SR (Status) Register Bits Name Function Description 1 TXE: Transmit buffer empty Data Register Empty The bit is 1 when the transmit data is empty and can accept another byte of data. RXNE: Receive buffer not empty Receive Complete The bit is 1 when there is new data in the receive buffer registers. It is cleared when data are read.

Alternate pin Function multiplexing for STM32F446RE (See Appendix B for complete list)

GPIOx_MODER Bits 2y:2y+1 MODERy[1:0]: Port x configuration bits (y = 0..15) These bits are written by software to configure the I/O direction mode. 00: Input (reset state) 01: General purpose output mode 10: Alternate function mode 11: Analog mode

GPIOx_AFRL Register Bits 31:0 AFRLy: Alternate function selection for port x bit y (y = 0..7) These bits are written by software to configure alternate function I/Os AFRLy selection: 0000: AF0 0001: AF1 0010: AF2 0011: AF3 0100: AF4 0101: AF5 0110: AF6 0111: AF7 1000: AF8 1001: AF9 1010: AF10 1011: AF11 1100: AF12 1101: AF13 1110: AF14 1111: AF15

LTC1661 Internal Block Diagram

Sending a Packet of Data to LTC166x

LTC1661 DAC Control Functions A3 A2 A1 A0 Interrupt Register DAC Register Power Down Status Comments 0 0 0 0 No Change No Update No operation. power-down status unchanged 0 0 0 1 Load DAC A Load input register A with data. DAC outputs unchanged. power-down Status unchanged 0 0 1 0 Load DAC B Load input register B with data. DAC outputs unchanged. power-down status unchanged 0 0 1 1 - Reserved 0 1 0 0 0 1 0 1

LTC1661 DAC Control Functions (Cont.) A3 A2 A1 A0 Interrupt Register DAC Register Power Down Status Comments 0 1 1 0 - Reserved 0 1 1 1 1 0 0 0 No Change Update Outputs Wake Load both DAC Regs with existing contents of input Regs. Outputs update. Part wakes up 1 0 0 1 Load DAC A Load input Reg A. Load DAC Regs with new contents of input Reg A and existing contents of Reg B. Outputs update. 1 0 1 0 Load DAC B Load input Reg B. Load DAC Regs with existing contentsof input Reg A and new contents of Reg B. Outputs update

LTC1661 DAC Control Functions (Cont.) A3 A2 A1 A0 Interrupt Register DAC Register Power Down Status Comments 1 0 1 1 - Reserved 1 1 0 0 1 1 0 1 No Change No Update Wake Part wakes up. Input and DAC Regs unchanged. DAC outputs reflect existing contents of DAC Regs 1 1 1 0 Sleep Part goes to sleep. Input and DAC Regs unchanged. DAC outputs set to high impedance state 1 1 1 1 Load ADCs A, B with same 10-bit code Update Outputs Load both input Regs. Load both DAC Regs with new contents of input Regs. Outputs update. Part wakes up

Connecting LTC1661 to the STM32F4xx

The Generated sawTooth waveform