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.
I have 2 C2000 controllers that communicate with each other with SPI.
How do I know in the slave device that I received a complete message and not 2 halve messages? It looks like that the information of the rising edge of CS is lost in the hardware. So how do I know that I received the end of the message?
Thanks.
evs,
I am not sure what you mean "the information of the rising edge of CS is lost in the hardware"
This depends on your hardware connection. If you are using the CS (SPISTE) line, the slave will only receive data while the CS is active. If the master is toggling this appropriately for your communication link and assuming that the signals are not noisy, the slave will receive the data properly. One option on the slave side is to have a FIFO interrupt based on the number of data words transmitted. if you expect 4 words in a message, the slave could have an interrupt after 4 words.
Alternately, you might add a handshake or error checking mechanism in your protocol to detect if the slave did not receive data properly. Something you could do is send a header plus data, and then dummy data from the master. The slave can detect a proper header, receive the data, and then during the dummy data transmitted from the master, the slave could provide and ACK to the master.
The SPI protocol provides the hardware for data to move between devices, you must provide the payloads based on your application requirements.
-Mark
evs,
Have these posts helped to answer your questions? If so, please provide your solution and verify an answer.
Thanks,
Mark