LAUNCHXL-F28069M: SPI Communication

Expert 1325 points

Replies: 3

Views: 81

Part Number: LAUNCHXL-F28069M

Hello,

I am trying to communicate between two LAUNCHXL-F28069M  boards using SPI communication. One board is master and other is slave. I have successfully sent data from master to slave ( data is like this 11, 22, 33, 44 or any other integer or character). I have seen the received data on slave side and trying to re-transmit that data to the master. While re-transmitting I am facing problem that the data is received as 44, 11, 22, 33  instead of 11, 22, 33, 44.  Why my last value is coming first in re-transmission. I have checked the whole code, but I did not get any significant reason behind this. Please tell me what could be the reason. I have simulated this in matlab (using simulink and embedded coder support package) . Is it something related to SPI protocol ?

Regard, 

Nisha

3 Replies

  • Hi Nisha,

    Can you please clarify some. Is the slave:

    1. receiving the data incorrectly or...

    2. receiving the correct data but transmitting the incorrect data

    How many bits have you configured the master and slave to transmit? I'd suggest checking the SPI configuration on the slave side and the portion of your code where the received data is written to the transmit buffer.

    Best,

    Kevin

  • In reply to Kevin Allen18:

    Kevin,

    I am facing the second case, receiving the correct data but transmitting the incorrect data. 

    I am transmitting 4 data sets having Uint16 datatype (total transmitting 64 bit ). The flow is explained below. 

    Master transmit (correct data) -> Slave receive (correct data) -> Slave transmitting same data to master (data is correct but last value comes first) -> Master receiving data (data is correct but last value comes first). 

    11  22  333  4444 (master transmit) -> 11  22  333  4444 (slave receive) -> 4444  11  22  333 (slave transmit to master) -> 4444  11  22  333 (master receive)

    Regards,

    Nisha

  • In reply to NISHA GOSAVI:

    Hi Nisha,

    OK I see. Can you share some code snippets for your slave SPI initialization and slave transmitter code? i.e. code that handles filling the TX buffer on the slave side.

    Best,

    Kevin