Professional Documents
Culture Documents
What was SPI (Serial Peripheral
Interface)Bus?
SPI specifies four signals:
± clock (SCLK): Clock, is generated by the master and input to all slaves.
± master data output, slave data input (MOSI); carries data from master to slave.
± master data input, slave data output (MISO); carries data from slave back to master.
± slave select (ÇSS): Chip select-bar, A slave device is selected when the master asserts its ÇSS signal.
Each device has a separate chip-select signal, so that the µP can address the
appropriate part by the relevant CS-bar signal.
The SPI-bus is well suited to data-rates to 20Mbps. Some devices (e.g., RTCs like
the MAX6901) have a 3-wire interface, where the data-line is bi-directional. This
interface is similar to SPI.
There is a MASTER and a SLAVE mode. The MASTER device provides the clock
signal and determines the state of the chip select lines, i.e. it activates the SLAVE it
wants to communicate with. CS and SCKL are therefore outputs. The SLAVE device
receives the clock and chip select from the MASTER, CS and SCKL are therefore
inputs. This means there is one master, while the number of slaves is only limited
by the number of chip selects.
The SPI requires two control lines (CS and SCLK) and two data lines (SDI and SDO).
Motorola names these lines MOSI (Master-Out-Slave-In) and MISO (Master-In-
Slave-Out). The chip select line is named SS (Slave-Select).
Because there is no official specification, what exactly SPI is and what not, it is
necessary to consult the data sheets of the components one wants to use.
SPI can also achieve significantly higher data rates than I2C.
What was SPI (Serial Peripheral
Interface)Bus?
The master begins the communication by issuing the start condition (S). The
master continues by sending a unique 7-bit slave device address, with the most
significant bit (MSB) first. The eighth bit after the start, read/not-write (),
specifies whether the slave is now to receive (0) or to transmit (1). This is
followed by an ACK bit issued by the receiver, acknowledging receipt of the
previous byte. Then the transmitter (slave or master, as indicated by the bit)
transmits a byte of data starting with the MSB. At the end of the byte, the
receiver (whether master or slave) issues a new ACK bit. This 9-bit pattern is
repeated if more bytes need to be transmitted.
In a write transaction (slave receiving), when the master is done transmitting all
of the data bytes it wants to send, it monitors the last ACK and then issues the
stop condition (P). In a read transaction (slave transmitting), the master does
not acknowledge the final byte it receives. This tells the slave that its
transmission is done. The master then issues the stop condition.
|
Terminology for bus transfer
0 ( ( )
)* ( )
/ ) 2 ,
)
0
) *
)
2
)
3
2
/
)
0
)
))
)
,
2
*# $,
)
)4
)4) /
0 +
32
,
,*2( 5
3
)2
)' 1|6"
)1|7"()/ /
!|"#!
If you want to modify the reload register values before the next DMA auto initialization, set TCINT=1 in the
channel¶s primary control register and LAST IE=1 in the channels¶ secondary control register to enable last frame
condition interrupt. the interrupt service routine can modify the reload register values before the next auto
initialization.
!|"#!