Using 430F1481 and try to use SPI 4 pin.
First i tried with the example code with 3 pin SPI and it works but
when i change to 4 pins the SPI goes totaly dead.
#include <msp430x14x.h>
#include <string.h>
#define SCK_HIGH P5OUT |=0x08 //clock out
#define SCK_LOW P5OUT &=~0x08
#define SIN_HIGH P5OUT |=0x02 //data out
#define SIN_LOW P5OUT &=~0x02
#define sout (P5IN & 0x04)/(0x04) // data in
#define CS_HIGH P4OUT |=0x08 // chip select high
#define CS_LOW P4OUT &=~0x08 // chip select low
void spi_init();
void main()
{
unsigned int i=0;
unsigned int Data=0;
Data =0x0FF;
spi_init();
while(1)
{
Data++;
while (!(IFG2 & UTXIFG1));
TXBUF1 = Data;
for(i = 0xEFFF; i > 0; i--);
}
}
void spi_init()
{
P5SEL |=0x0A;
P5DIR |= 0x0B; //Reset Slave
P5OUT &= ~0x01;
P4DIR |=0x08;
P4OUT |=0x00;
UCTL1 = CHAR + SYNC + MM + SWRST; // 8-bit, SPI, Master
UTCTL1 = CKPH + SSEL1; // Polarity, SMCLK, 3-wire
UBR01 = 0x02; // SPICLK = SMCLK/2
UBR11 = 0x00;
UMCTL1 = 0x00;
ME2 |= USPIE1; // Module enable
UCTL1 &= ~SWRST; // SPI enable
IE2 |= URXIE1 + UTXIE1; // RX and TX interrupt enable
}
rishi