SPI By Alexander Maroudis. Outline What is SPI? SPI Configuration SPI Operation Master Slave Setup...

14
SPI SPI By Alexander Maroudis

Transcript of SPI By Alexander Maroudis. Outline What is SPI? SPI Configuration SPI Operation Master Slave Setup...

Page 1: SPI By Alexander Maroudis. Outline What is SPI? SPI Configuration SPI Operation Master Slave Setup SPI Transactions SPI Digital Potentiometer Example.

SPISPI

• By Alexander Maroudis

Page 2: SPI By Alexander Maroudis. Outline What is SPI? SPI Configuration SPI Operation Master Slave Setup SPI Transactions SPI Digital Potentiometer Example.

OutlineOutline

• What is SPI?• SPI Configuration• SPI Operation• Master Slave Setup• SPI Transactions• SPI Digital Potentiometer Example (EE 583)• SPI Peripheral Types• SPI and Microcontrollers• ESBUS

Page 3: SPI By Alexander Maroudis. Outline What is SPI? SPI Configuration SPI Operation Master Slave Setup SPI Transactions SPI Digital Potentiometer Example.

SPISPI(Serial Peripheral Interface)(Serial Peripheral Interface)

• • Developed by Motorola Developed by Motorola

••Also known as MicroWire (National Also known as MicroWire (National

Semiconductor), QSPI Semiconductor), QSPI (Queued),MicrowirePlus(Queued),MicrowirePlus

••Synchronous Serial CommunicationSynchronous Serial Communication

Page 4: SPI By Alexander Maroudis. Outline What is SPI? SPI Configuration SPI Operation Master Slave Setup SPI Transactions SPI Digital Potentiometer Example.

SPI ConfigurationSPI Configuration

• Primarily used for serial communication between a host processor and peripherals.

• Can also connect 2 processors via SPI

• SPI works in a master slave configuration with the master being the host microcontroller for example and the slave being the peripheral

Page 5: SPI By Alexander Maroudis. Outline What is SPI? SPI Configuration SPI Operation Master Slave Setup SPI Transactions SPI Digital Potentiometer Example.

SPI OperationSPI Operation

• For SPI, there are Serial Clocks (SCLK), Chip Select lines (CS), Serial Data In (SDI) and Serial Data Out( SDO)

• There is only one master, there number of slaves depends on the number of chip select lines of the master.

• Synchronous operation, latch on rising or falling edge of clock, SDI on rising edge, SDO on falling edge

• Operates in 1 to 2 MHz range• Master sends out clocks and chip selects. Activates the

slaves it wants to communicate with

Page 6: SPI By Alexander Maroudis. Outline What is SPI? SPI Configuration SPI Operation Master Slave Setup SPI Transactions SPI Digital Potentiometer Example.

Master Slave SetupMaster Slave Setup

• In this setup, there are 3 slave devices. The SDO lines are tied together to the SDI line of the master.

• The master determines which chip it is talking to by the CS lines. For the slaves that are not being talked to, the data output goes to a Hi Z state

• Multiple Independent Slave Configuration

Page 7: SPI By Alexander Maroudis. Outline What is SPI? SPI Configuration SPI Operation Master Slave Setup SPI Transactions SPI Digital Potentiometer Example.

Master Slave SetupMaster Slave SetupMultiple slave cascadedMultiple slave cascaded

• In this example, each slave is cascaded so that the output of one slave is the input of another. When cascading, they are treated as one slave and connecting to the same chip select

Page 8: SPI By Alexander Maroudis. Outline What is SPI? SPI Configuration SPI Operation Master Slave Setup SPI Transactions SPI Digital Potentiometer Example.

SPI Timing Diagram SPI Timing Diagram EEPROM ReadEEPROM Read

Page 9: SPI By Alexander Maroudis. Outline What is SPI? SPI Configuration SPI Operation Master Slave Setup SPI Transactions SPI Digital Potentiometer Example.

SPI Digital POT (EE 583)SPI Digital POT (EE 583)

• We used a Microchip digital POT in EE 583 with SPI interface.• Motorola 68HC12 had SPI built in hardware, very easy to use. • Data we sent to POT via SPI consisted of 2 bytes. • Command Byte- XXC1C0XXP1P0• C1C0 determines type of command, • eg. 01 = Write Data• 10 =Shutdown• P1P0 Determines which potentiometer is affected by• the command• 00 = Nothing affected• 01 = Command executed on POT 0• 10 = Command executed on POT 1• 11 = Command executed on both POT’s• Data byte indicates value of the wiper

Page 10: SPI By Alexander Maroudis. Outline What is SPI? SPI Configuration SPI Operation Master Slave Setup SPI Transactions SPI Digital Potentiometer Example.

SPI Potentiometer TransactionSPI Potentiometer Transaction

Page 11: SPI By Alexander Maroudis. Outline What is SPI? SPI Configuration SPI Operation Master Slave Setup SPI Transactions SPI Digital Potentiometer Example.

SPI Peripheral TypesSPI Peripheral Types

• Converters (ADC, DAC)

• Memories (EEPROM, RAM’s,Flash)

• Sensors (Temperature, Humidity, Pressure)

• Real Time Clocks

• Misc- Potentiometers, LCD controllers, UART’s, USB controller, CAN controller,amplifiers

Page 12: SPI By Alexander Maroudis. Outline What is SPI? SPI Configuration SPI Operation Master Slave Setup SPI Transactions SPI Digital Potentiometer Example.

PeripheralsPeripherals

• Vendors that make these peripherals :

• Atmel –EEPROM, Dig. POT’s

• Infineon- Pressure Sensors, Humidity Sensors

• Maxim- ADC, DAC, UART,

• TI- DSP’s, ADC, DAC

• National Semiconductor- Temperature Sensors, LCD/USB controllers

Page 13: SPI By Alexander Maroudis. Outline What is SPI? SPI Configuration SPI Operation Master Slave Setup SPI Transactions SPI Digital Potentiometer Example.

SPI and MicrocontrollersSPI and Microcontrollers

• Motorola 68HC12 Has SPI built in hardware. Easy to integrate. See EE583

• Intel 8051 Depending on Models, Most Cygnal products have I2C and some have SPI also built in hardware for easy integration.

Page 14: SPI By Alexander Maroudis. Outline What is SPI? SPI Configuration SPI Operation Master Slave Setup SPI Transactions SPI Digital Potentiometer Example.

EsbusEsbus

• Sensors bus• Being developed by Esensors Inc, (see www.eesensors.com for

more info)• 6 wire sensor bus with modular connector based on modified SPI• Byte of data is exchanged between the master and slave • Optical isolators provide ground isolation for safety and noise

reduction • Data is transmitted from master along EDI lines • The signal is connected to the data input to SPI serial bus on

microcontroller • Sensor information from slave are transmitted on EDO line to output

of remote sensor • Data line is connected to SDO in sensor end. • Isolated DC to DC supply is used to retain ground isolation

(optional)