I'm using the MSP430 as a SPI slave running at 25MHz. The MSP430 communicates with an embedded linux device at 1.5MHz. The communication code works but there is a nasty bug the comes up randomly.
Normally, sometime after the 8th clock cycle coming from the master, the RX interrupt of the slaves fires. The code reads the RX buffer. After a short period, the TX buffer fires and depending what was read on the RX buffer, the code stuffs the TX buffer with the next byte to send.
The thing I can't seem to figure out is, randomly the TX ISR fires before the RX buffer so there is a byte shift in the protocol. Once this happens it doesn't seem to switch back until the msp430 is reset.
I can do many transactions without issue, but then the byte shift happens. I'd appcriate any advice.
thanks,