Embedded Systems

SPI interfacing with ATmega16

SPI interfacing  with ATmega16


  • What is SPI protocol ? – The Serial Peripheral Interface or SPI bus is a synchronous serial data link, a de facto standard, named by Motorola, that operates in full duplex mode. It is used for short distance, single master communication

 SPI interfacing  with ATmega16

  • How SPI work – Firstly, SPI works in a master/slave setup. The master is the one that sends the clock pulses. At each pulse, data will be sent and received. SPI has a chip select pin. Every device will share the “SDI”, “SDO” and “Clock” pins, but each device will have it’s own chip select pin (also known as slave select). This means we can have a virtually unlimited number of devices on the same SPI bus. You should also note that the chip select pin can be active high or active low depending on the device. For some devices, the chip select pin must stay enabled throughout the transmission, and others require a change in the chip select line before the next transmission. SPI is Dual-Duplex. This means data can be sent and received at the same time. Here’s a diagram showing the way in which SPI sends & receives data:


  •   Feature of  SPI
    • Full duplex communication.
    • Higher throughput than TWI.
    • Not limited to 8 bit words in the case of bit transferring.
    • Simple hardware interfacing
    • Arbitrary choice of message sizes, contents and purpose.
    • Typically low power requirements
    • Slave uses master’s clock and does not require precision oscillators.
    • Lower power requirements than TWI due to less circuitry.
    • Many SPI-enabled ICs and Microcontrollers can cope with data rates of over 10MHz, so transfer is much faster than with I2C


  • Applications-  SPI is used to talk to a variety of peripherals, such as
    • Sensors: temperature, pressure, ADC, touchscreens, video game controllers
    • Control devices: audio codecs, digital potentiometers, DAC
    • Camera lenses: Canon EF lens mount
    • Communications: Ethernet, USB, USART, CAN, IEEE 802.15.4, IEEE 802.11, handheld video games
    • Memory: flash and EEPROM
    • Real-time clocks
    • LCD, sometimes even for managing image data
    • Any MMC or SD card (including SDIO variant)

Click Here: Depth understanding of SPI Protocol

 1. Circuit of spi interfacing with ATmega16 using MAX7221




1. Program of spi interfacing with ATmega16 using MAX7221


PROTEUS File for SIMULATION(Password Of RAR file is

download (1)

Content for the tab VIDEO