Other Parts Discussed in Thread: MSP430G2231
Tool/software: Code Composer Studio
Hi !
I want to use the SPI communication between MSP430G2553 and MSP430G2231. I find some examples but I don't understand them...
I used that on MSP430G2553 :
void initSPI(void)
{
P1SEL |= (BIT6 + BIT7); // P1.1 = RXD, P1.2=TXD
P1SEL2 |= (BIT6 + BIT7); // P1.1 = RXD, P1.2=TXD
UCB0CTL1 |= UCSSEL_2; // SMCLK
UCB0BR0 = 104; // 1MHz, 9600
UCB0BR1 = 0; // 1MHz, 9600
UCB0CTL0 = 0 | (UCMSB | UCMST);
UCB0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
}
void main(void)
{
// ...
initSPI();
P1OUT &= ~BIT6; //CS select
for (j = 'a'; j <= 'm'; j++) {
while (!(IFG2 & UCB0TXIFG)) ; //attente buffer
UCB0TXBUF = j; // envoi de value
while (!(IFG2 & UCB0RXIFG)) ; //receptionUSCI_A0 ?
recept = UCB0RXBUF;
}
P1OUT |= BIT6; //CS unselect
// ...
]
When I connect the bit 6 and 7, it works. But it don't works when I connect :
MSP430G2553 BIT6 BIT7
| |
V V
MSP430G2231 BIT6 BIT7
Could you help me to use SPI communication please ?
Thanks.