Abstract:
The "Serial Peripheral Interface" (SPI) is a synchronous four wire serial link used to connect microcontrollers to sensors, memory, and peripherals. It's a simple "de facto" standard, not complicated enough to acquire a standardization body. It is a hardware and firmware communications protocol developed by Motorola and later adopted by everybody. The SPI Bus is used only on the PCB. SPI interfaces are available on popular communication processors such as the MPC8260 and microcontrollers such as the M68HC11. It is a synchronous serial data link that operates in full duplex (signals carrying data go in both directions simultaneously). Devices communicate using a master/slave relationship, in which the master initiates the data frame. When the master generates a clock and selects a slave device, data may be transferred in either or both directions simultaneously.
Introduction:
SPI (synchronous Peripheral Interface ) is bi-directional full duplex data transfer with separate bit and frame synchronization signals. Data is transferred via two unidirectional data lines called MISO (Master In Slave Out) and MOSI (Master Out Slave In). MOSI is sometimes called in master SDO(Serial Data Out) and MISO called as SDI(Serial Data In). MOSI is always driven by master and is always input in slaves. MISO is always input in master and it is three state signal in slaves. Only slave addressed with its representative CS signal asserted will drive MISO . SPI transfer has always read (MISO) and write (MOSI) signals an always operate as simultaneous full duplex data transfer. In case we have simple Write only devices like simple digital/analog converters (DAC) that have only MOSI signal, the master still samples MISO signal and reads meaningless data that should be discarded. Similarly with input only devices, master still transfers data out from MOSI signal but it is ignored or not connected to slave device.
Almost any type of device can be connected to the SPI bus, from simple analog-digital converters to ethernet adapters. Even SD cards have an “SPI mode,” which allows a developer to connect them to the SPI bus.
There are two steps you need to get your driver recognized by the Linux SPI system.
From Architecture point of view, bus driver plays the role of an abstraction layer to hide the details of the hardware hidden under a protocol on a specific device.
Therefore master driver does not need to know what peripheral controller connected, the only focus is on how to operate the controller to the sent the message packet. Protocol driver only needs to concentrate on communication and specific peripherals, without the need to understand how to send a message packet.
The format for message packets is defined in spi.h, under spi_message structure. To send data the protocol driver, simply insert spi_message structure's corresponding field and call spi_sync to initiate sending.
In the kernel header include/linux/spi/spi.h is a struct spi_board_info structure that should be populated for any statically registered spi device. You then add the device to the system using the spi_register_board_info() function.
Prospects:
Training Objective:
Pre-requisites:
Agenda:
The Duration of Training is:
The course is split into Seven modules:
spi_register_master
.