SPRUI30H November 2015 – May 2024 DRA745 , DRA746 , DRA750 , DRA756
The synchronous SPI protocol allows a master device to initiate serial data transfers to a slave device. A slave select line (SPIEN[x]) allows selection of an individual slave SPI device. Slave devices that are not selected do not interfere with SPI bus activities.
McSPI offers the flexibility to modify the following parameters to adapt to the device features:
McSPI supports any SPI word ranging from 4 bits to 32 bits long (the MCSPI_CHxCONF[11:7] WL bit field).
SPI word length can be changed between transmissions to allow the master device to communicate with peripheral slaves that have different requirements.
The polarity of the SPI enable signals is programmable (the MCSPI_CHxCONF[6] EPOL bit). SPIEN[x] signals can be active high or low.
Assertion of the SPIEN[x] signals is programmable and can be done manually or automatically. The manual assertion mode is available in single master mode only. SPIEN[x] can be kept active between words with the MCSPI_CHxCONF[20] FORCE bit.
Two consecutive words for two different slave devices can go along with active SPIEN[x] signals with different polarity.
In start-bit mode a start-bit is added before the SPI word length to indicate how the next SPI word must be handled. The start-bit is enabled by setting the MCSPI_CHxCONF[23] SBE bit to 1. The MCSPI_CHxCONF[24] SBPOL bit defines the polarity of the start-bit.
In master mode, the baud rate of the SPI serial clock is programmable using the 48-MHz reference clock (from the power, reset, and clock managment [PRCM] module). Table 24-198 lists the SPICLK bit rates obtained for data transfer when programming the clock divider (the MCSPI_CHxCONF[5:2] CLKD bit field).
Divider | Clock Rate |
---|---|
1 | 48 MHz(1) |
2 | 24 MHz(1) |
4 | 12 MHz |
8 | 6 MHz |
16 | 3 MHz |
32 | 1.5 MHz |
64 | 750 kHz |
128 | 375 kHz |
256 | ~187 kHz |
512 | ~93.7 kHz |
1024 | ~46.8 kHz |
2048 | ~23.4 kHz |
4096 | ~11.7 kHz |
The polarity (the MCSPI_CHxCONF[1] POL bit) and the phase (the MCSPI_CHxCONF[0] PHA bit) of the SPI serial clock (SPICLK) are configurable to offer four combinations. Software selects the right combination, depending on the device. See Table 24-199 and Figure 24-75.
Polarity (POL) | Phase (PHA) | SPI Mode | Description |
---|---|---|---|
0 | 0 | Mode 0 | SPICLK is inactive low and sampling occurs at the rising edge. |
0 | 1 | Mode 1 | SPICLK is inactive low and sampling occurs at the falling edge. |
1 | 0 | Mode 2 | SPICLK is inactive high and sampling occurs at the falling edge. |
1 | 1 | Mode 3 | SPICLK is inactive high and sampling occurs at the rising edge. |