The TMS320F28335 provides one Serial Peripheral Interface (SPI) module. The device can operate in SPI-Master or in SPI-Slave mode. For the configuration of the SPI-module, user needs to create an instance of SPIInterface and assign the GPIOs of SPI-module to it (see table below).
User can also configure the length in bit to be sent and received by one message via SPI. The max. length is 16 bit.
To address different slaves, user has to configure different GPIOs as outputs and connect these pins to slave-select pins of slave. When starting communication with a slave, the respective GPIO output signal for this slave needs to be set to low. After communication, the respective GPIO output signal for this slave needs to be set to high again. The Slave-Select pin of SPI-Master is not connected in this case.
When communicating to a slave, master sends data via SIMO to the slave and equal amount of databits is sent back from slave to master via SOMI.
For data communication, there are 3 possibilities:
1) Master sends valid data to slave and gets back valid data from slave (valid communication in both ways)
2) Master sends dummy data to slave and gets back valid data from slave (valid communication from slave to master)
3) Master sends valid data to slave and gets back dummy data from slave (valid communication from master to slave)
--> Master only gets back data from slave (valid or not), when Master sends data to slave (valid or not)
Pin | |
---|---|
Slave In Master Out (SIMO) | GPIO16 |
Slave Out Master In (SOMI) | GPIO17 |
Clock | GPIO18 |
Slave-Select | GPIO19 |
Configuration as SPI-Master without interrupt
Configuration as SPI-Master with interrupt
Configuration as SPI-Slave without interrupt
Configuration as SPI-Slave with interrupt