I am having issues with the SPI port. I will try to explain what I
am trying to do.
I have two MSP430 experimenter boards. They are connected to each other's UCB0 SPI port (see hardware block diagram). I have written code to perform the
following. When the Slave detects a button has been pressed (interrupt
driven) it generates an SPI packet (spi_packet.h) and then pulls the
Chip Select line high. The Master detects the Chip Select high line
(interrupt driven) and starts to read the SPI packet from the slave.
After receiving the entire SPI packet, it decodes it and turns an LED on
or off depending on the parameter sent in the packet.
Now I will try to explain my problem.
The Slave devices uses a circular buffer to store the SPI packets it is
going to send to the Master. So ever time a button is pressed a SPI
packet is pushed into the circular buffer. Currently each SPI packet is 5
bytes long. Each SPI packet has a 2 byte header (0xDEAD). The Master
performs a while((rx_byte = spi_read()) != 0xDE); on the first byte. For
some reason the Slave device is receiving an SPI receive interrupt
right after I press "go" in the debugger. This screws everything up as I
have not received an interrupt from the Master. I clear the SPI receive
interrupt flag (IE2 |= (UCB0RXIE);) during SPI initialization
(spi_init()).
Any thoughts on why this may be occurring?
Thanks in advance for your assistance.