SPI Question

Hi everyone,

I’m using the MSP430F2013 and trying to communicate with the FM25CL64 fram chip, using SPI. I wrote some code and I don’t know whether its correct.

What I want to do is to read the status register in the fram, and according to the spec, I send out the op code in the first 8 SCLK cycles and then I receive the contents in the next 8 cycles.

USICTL0 |= USIPE7 + USIPE6 + USIPE5 + USIMST + USIOE;

USICKCTL = USIDIV_1 + USISSEL_2;

USICTL0 &= ~USISWRST;

USISRL = 5; //read status register op code

USICNT = 8;

while (!(USIIFG & USICTL1));

USISRL = 0;

while (!(USIIFG & USICTL1));

out1 = USISRL; //contents of the status register???

Is this right? (I don’t think so…)