This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Clarification on SPI initialiZation

Other Parts Discussed in Thread: MSP430F1481

Hi,

      Is there any changes required in my SPI code , it is in four pin mode with external GPIO pin as chip select(so 3-pin)

     i am using msp430f1481, problem is that  with bitbanking method i was able to transmit data and receive with an external flash,but with

     inbuilt SPI some times it is and some times it is not, why actually happens this?Am i left any thing in SPI initialization?   

     below is my SPI initialization

    SPICLK is 1 MHz

     void SPI_Enable(void)
{
        unsigned volatile i;
       P5SEL |= 0x0E;                            // P5.1,2,3 SPI option select
        P5DIR |= 0x0A;
        P4DIR |= 0x08;                           //External pin  as chipselect             
        P4OUT &=~0x08;                            //Reset Slave
       U1CTL = CHAR + SYNC + MM + SWRST;         // 8-bit, SPI, Master
        U1TCTL = SSEL1 + STC;                      // Mode 0, SMCLK, 3-wire
       U1BR0 = 0x02;                            // SPICLK = SMCLK/2
      U1BR1 = 0x00;
      U1MCTL = 0x00;
      ME2 |= USPIE1;                            // Module enable
      U1CTL &= ~SWRST;                          // SPI enable
        for (i = 0xFFF; i > 0; i--);              // Time for slave to ready
      _BIS_SR(GIE);                         // Global interrupt   
}

Thanks & Regards

Kshatriya

**Attention** This is a public forum