I am usung an MSP430F2112 that is a slave to a third party device.
The master clock = 400KHz; Reset and Idle state for the clock and data pins is logic low; data is to be sampled on the rising edge of the clock. data is 8-bit words; bytes are transmitted MSB first; messages may be sent back-to-back (continuous clock).
The data packet is always 28 bytes with no crc or total number of bytes sent so this make it difficult to error/fragment check etc.
The master sends SPI data packets 8 times per second so I am counting on NO continuous clock back to back transmissions.
What woud be the best way to receive the SPI data packets?
1. Set SPI_Byte_count = 0, start 10mSec timer
2. Check every time period (every 10mSec?) for an idle time and if found re-sync reset SPI_Byte_count reset timer
3. On SPI receive interrupt SPI_Byte_count++; save data if required; if SPI_Byte_count = 28 reset SPI_Byte_count , reset 10mSec timer
Is there a way to test if the SPI comms are in and idle state? Which control registers would these be?
Could I use this reliably as end of SPI packet detection?
Thanks.