I am trying to write burst SPI transfer. This is my first spi code. It looks simple compared to other SPI burst transfers. Before loading to ez430 and hooking up the logic analyzer, I'd like to know if I have overlooked something or if something is not correct. The code below is just the SPI part, the initialization etc is not included. SPI clock is 100KHz. MSP430(spi master) runs at 1MHz. The code starts burst write, whenever there is USI interrupt, the data in shift reg is loaded to rxdata array.
nCS_LOW(); //Make Chip sel low
for (n=0; n<10; n++) //10 byte burst
{
USISRL=mydata[n]; // Load data to Shift Reg
USICNT=8; // Start SPI Tx
}
nCS_HIGH(); //end burst
}
// Reading part.
#pragma vector=USI_VECTOR
__interrupt void USI_interrupt(void)
{
USICTL&=~USIIFG; //Clear interrupt flag
rxdata[n]=USISRL; n=n+1;
}