Introduction
Author: Alin Stoicescu, Microchip Technology Inc. |
This technical brief provides information about Serial Peripheral Interface (SPI) on tinyAVR® 0- and 1-series, megaAVR® 0-series, and AVR® DA devices, and intends to familiarize the user with AVR microcontrollers. The document describes the application area, the modes of operation, and the hardware and software requirements of the SPI.
Throughout the document, the configuration of the peripheral will be described in detail, starting with the location of the SPI pins, the direction of the pins, how to initialize the device as a host or a client, and how to exchange data inside the system. This document covers the following use cases:
- Sending Data
as a Host SPI Device:
The device will be configured as a host, will control the client, and will send data using a method called polling.
- Receiving
Data as a Client SPI Device:
The device will be configured as a client and will wait for the incoming data. The data reception will be triggered by interrupts.
- Changing Data
Transfer Type:
The device will be configured as a host and will send data with respect to the clock polarity and the clock phase.