-
Notifications
You must be signed in to change notification settings - Fork 4
Serial Peripheral Interface
The Serial Peripheral Interface is a simple and efficient interface based on a hardware multiplexed shift register. The interface consists of the clock, DATA_IN, DATA_OUT and chip select line. Data transferred from Host to Device is referred to as DATA_OUT, whereas DATA_IN refers to data transferred from Device to Host. In the case of the maXTouch device, an interrupt line is also used. SPI can operate in either full duplex or half duplex mode. The maXTouch touch controller operations in half duplex mode.
Within the Linux kernel a “Controller Driver” abstracts the controller hardware in the Host microprocessor. This driver controls the transfer of messages through the software queue, manages the behavior of the I/O assigned for use with the maXTouch device, and handles timing for the SPI interface which includes the clock frequency, setup and hold times of the chip select signal, and delays between message transfers.
There are four modes of operation that are defined depending on the state of two mode bits within the SPI hardware controller for sampling data.
The CPOL bit indicates the initial clock polarity. CPOL= 0 means the clock idle state is low. CPOL = 1 means the clock idle state is high.
CPHA controls the clock phase using in sampling the data. CPHA = 0 indicates the Host will sample data on rising edge, while data is shifted out from the Host on the falling edge. CPHA = 1 indicates the Host will sample data on the falling edge of clock, while data is shifted out from the Host on the rising edge of clock.