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.

ads1240 and msp430g2253 via spi.

Hello!

I need comminucation between ads1240 and msp430g2253 devices through spi.

I use 4 pin connection . I have written code to initialize spi on msp430.but when i try to transmit  command to ads and then receive response through spi, i have nothing.

can you correct me,may be i have use wrong process.

i have checked pin p1.5 with osciolloscope,but there were no watch signal.

void init_spi()
{
P1SEL |= BIT6 + BIT7 + BIT5; //SPI pin
P1SEL2 |= BIT6 + BIT7 + BIT5;
P2SEL |= BIT1;
P2SEL2 |= BIT1;

P1DIR |= BIT0; //P1.0 reset

UCB0CTL0 |= UCCKPL + UCMSB + UCMST + UCSYNC+UCMODE_1; //4 pin master mode sync
UCB0CTL1 |= UCSSEL_2; // SMCLK
UCB0BR0 |= 0x02; // bit rate?? /2
UCB0BR1 = 0; //
UCB0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
IE2 |= UCB0RXIE; // Enable USCI0 RX interrupt

P1OUT &= ~BIT0; // Now with SPI signals initialized,
P1OUT |= BIT0; // reset slave
}

void main(void)
{

unsigned char spic1;

WDTCTL = WDTPW + WDTHOLD; // Stop WDT



set_dco();
init_uart();
init_spi();
init_flash();

__delay_cycles(75); // Wait for slave to initialize

MST_Data = 0x01; // Initialize data values



while (1)
{

UCB0TXBUF = MST_Data;// Transmit read command

while (!(IFG2&UCB0RXIFG));//receive spi
spic1 = UCB0RXBUF;

while (!(IFG2&UCA0TXIFG)); //transmit uart
UCA0TXBUF = spic1;

}
}

**Attention** This is a public forum