This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/RM48L952: Confusion regarding SPI functions

Part Number: RM48L952

Tool/software: Code Composer Studio

Hello,

I am currently working on a CCS project which connects SPI ports 1 and 2 via wire and uses the two ports to communicate. However, I am running into some confusion regarding some of the functions used in the spi_Master_Slave example code. There are two functions I have questions about: (1) spiSendAndGetData() and (2) spiTransmitAndReceiveData(). The example code uses spiSendAndGetData() for SPI1 and spiTransmitAndReceiveData() for SPI2. In my main I have:

So let's look at spiSendAndGetData. My initial understanding of this function was that it was taking the data in TX_Data_Slave and sending it to RX_Data_Slave over SPI, but when I run the debug my buffers end up looking like so:

My intuition tells me that this is right because, in the long run, I want the data from the slave to go to the master. The functions make me think that the data from TX_Data_Master should have gone to RX_Data_Master, which would mean that the TX_Data_Master and RX_Data_Master arrays should contain the same values instead of what I currently have. Is this incorrect? Or is the code functioning as expected and am I just misunderstanding something vital regarding the functionality of the code?

  • The code is operating as expected. In the example SPI2 is the slave. The data in TX_Data_Slave is transmitted by the slave to the master. The data that SPI2 receives from the master is stored in RX_Data_Slave. The data transmitted by the master is received by the slave and at the same time the data transmitted by the slave is received by the master.