Introduction
The Serial Peripheral Interface (SPI) allows high-speed synchronous data transfer between an Atmel® AVR® device and peripheral devices, or between several AVR devices. The strength of the SPI bus includes ease of use, high communication speed, and a vast amount of peripheral devices supporting it.
The Universal Serial Interface (USI) module on devices like Atmel ATmega169, ATtiny26, and ATtiny2313 has a dedicated Three-wire mode. The USI provides the basic hardware resources needed for synchronous serial communication. Combined with a minimum of control software, the USI allows higher transfer rates, less CPU load, and in general uses less code space than solutions based on software only.
This application note describes an SPI interface implementation, in form of a full-featured driver and an example of usage for this driver. The driver handles transmission according to SPI Modes 0 and 1.