SPRUI33H November 2015 – June 2024 TMS320F280040-Q1 , TMS320F280040C-Q1 , TMS320F280041 , TMS320F280041-Q1 , TMS320F280041C , TMS320F280041C-Q1 , TMS320F280045 , TMS320F280048-Q1 , TMS320F280048C-Q1 , TMS320F280049 , TMS320F280049-Q1 , TMS320F280049C , TMS320F280049C-Q1
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 22-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 22-9 and Figure 22-10 illustrate 3-wire master and slave mode.
Table 22-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 |