Serial Peripheral Interface – SPI Bus overview

Serial Peripheral Interface is a simple interface which enables to communicate microcontroller and peripheral chips or intercommunicate between two or more microcontrollers. Serial Peripheral Interface bus sometimes called four wire interface may be used to interface such chips or devices like: LCD, sensors, memories, ADC, RTC. The range of usage is huge.

SPI Bus uses synchronous protocol, where transmitting and receiving is guided by clock signal generated by master microcontroller. SPI interface allows connecting several SPI devices while master selects each of them with CS (Chip Select) signal – (Underline means that active is LOW).

SPI bus consists of four signal wires:

Master Out Slave In (MOSI),

Master In Slave Out (MISO),

Serial Clock (SCLK or SCK)

Chip Select (CS) for the peripheral.

Some microcontrollers have a dedicated chip select for SPI interfacing called Slave Select (SS).

MOSI signal is generated by master – recipient is Slave. MOSI may also be labeled as SI or SDI.

MISO signals are generated by slave. In some chips you might find labels SO or SDO.

SCLK or SCK are generated by master to synchronize data transfers.

CS (SS) signal is also generated by master to select slave chip or device.

image001.gif

Data transfer is organized by using Shift register in both: master and slave. While master shifts register value out through MOSI line then slave shifts data in to its shift register. If there is full duplex used, then send and receive is performed at the same time:

image002.gif

There also is multiple byte stream mode available with SPI bus interface. In this mode master can shift bytes continuously. Using this type of transfer slave select (SS) must remain low until all stream process continues. For example you can write to memory by sending address bytes and then data in the same stream operation. In this way kilobytes or more can be sent using multiple byte transfer mode.

Daisy-chained mode

Some chips have ability when you can connect multiple SPI devices in series and data can be transferred to all devices though other. For instance if you connect three devices to microcontroller in series MCU-A-B-C, then MCU will have to send three bytes of information. The first byte goes to C device, second to B and third byte to A:

image003.gif

Daisy-chain won’t work with devices which support or require multiple bytes operation (memory chips).

For instance AD8403 - 4-Channel Digital Potentiometer can be connected in daisy-chain circuit:

image005.jpg

Depending on Clock (SKC) polarity, there may be four operation modes of SPI:

Low clock polarity – when clock is low in idle and toggles in high;

High clock polarity – when clock is high in idle and toggles in low stage;

Clock phase zero – MOSI and MISO outputs are valid on rising edge of clock signal (from low to high);

Clock phase one – MOSI and MISO outputs are valid on falling edge of SCK signal (high to low)

Blogsphere: TechnoratiFeedsterBloglines
Bookmark: Del.icio.usSpurlFurlSimpyBlinkDigg
RSS feed for comments on this post
 |  TrackBack URI for this post

New on WinAVR Tutorial
Running TX433 and RX433 RF modules with AVR microcontrollers,
Sometimes in embedded design you may want to go wireless. Might be you will want to log various readi …
Programming AVR ADC module with WinAVR,
Most of AVR microcontrollers have Analog to Digital Converter (ADC) integrated in to chip. Such solut …
New on WinARM Tutorial
What are differences between WinARM and WinAVR,
Everyone who is working with AVR microcontrollers knows this powerful tool – WinAVR (http://win …
LPC2000 watchdog timer,
As in all microcontrollers watchdog timers purpose isto reset microcontroller after reasonable amount …

One Response to “Serial Peripheral Interface – SPI Bus overview”

  1. adi Says:

    I still not understanding, can you give me some information about SPI method ?

    please help me.ASAP.

    Adi
    s3prayer@yahoo.co.uk

Leave a Reply