SPRUHM9H October 2014 – May 2024 TMS320F28075 , TMS320F28075-Q1 , TMS320F28076
SPI 3-wire mode allows for SPI communication over three pins instead of the normal four pins.
In master mode, if the TRIWIRE bit is set, enabling 3-wire SPI mode, SPISIMOx becomes the bi-directional SPIMOMIx (SPI master out, master in) pin, and SPISOMIx is no longer used by the SPI. In slave mode, if the TRIWIRE bit is set, SPISOMIx becomes the bi-directional SPISISOx (SPI slave in, slave out) pin, and SPISIMOx is no longer used by the SPI.
Table 17-4 indicates the pin function differences between 3-wire and 4-wire SPI mode for a master and slave SPI.
4-wire SPI | 3-wire SPI (Master) | 3-wire SPI (Slave) |
---|---|---|
SPICLKx | SPICLKx | SPICLKx |
SPISTEx | SPISTEx | SPISTEx |
SPISIMOx | SPIMOMIx | Free |
SPISOMIx | Free | SPISISOx |
Because in 3-wire mode, the receive and transmit paths within the SPI are connected, any data transmitted by the SPI module is also received. The application software must take care to perform a dummy read to clear the SPI data register of the additional received data.
The TALK bit plays an important role in 3-wire SPI mode. The bit must be set to transmit data and cleared prior to reading data. In master mode, to initiate a read, the application software must write dummy data to the SPI data register (SPIDAT or SPIRXBUF) while the TALK bit is cleared (no data is transmitted out the SPIMOMI pin) before reading from the data register.
Figure 17-9 and Figure 17-10 illustrate 3-wire master and slave mode.
Table 17-5 indicates how data is received or transmitted in the various SPI modes while the TALK bit is set or cleared.
Pin Mode | SPIPRI[TRIWIRE] | SPICTL[TALK] | SPISIMO | SPISOMI |
---|---|---|---|---|
Master Mode | ||||
4-wire | 0 | X | TX | RX |
3-pin mode | 1 | 0 | RX | Disconnect from SPI |
1 | TX/RX | |||
Slave Mode | ||||
4-wire | 0 | X | RX | TX |
3-pin mode | 1 | 0 | Disconnect from SPI | RX |
1 | TX/RX |