hello professors,
I'm using two g2553 chips to achieve the communication between each other. I connected p1.5(UCB0CLK), p1.6(SOMI), p1.7(SIMO), VCC, and GND to each other, and the initialization function of SPI is as followed:
Master chip:
void Init_USCI_spi()
{
P1SEL |= BIT5 + BIT6 + BIT7; //configure ports
P2SEL |= BIT5 + BIT6 + BIT7;
UCB0CTL1 |= UCSWRST; //enable, usci logic held in reset state
UCB0CTL1 |= UCSSEL_2; //SMCLK
UCB0CTL0 |= UCCKPL + UCMST + UCMODE_0 + UCSYNC + UCMSB; //3-pin spi master, slave mode
UCB0BR0 |= 0x02;
UCB0BR1 = 0;
UCB0CTL1 &= ~UCSWRST;
IE2 |= UCB0TXIE;
//IE2 |= UCB0RXIE;
}
Slave chip:
void Init_USCI_spi()
{
P1SEL |= BIT5 + BIT6 + BIT7; //configure ports
P2SEL |= BIT5 + BIT6 + BIT7;
UCB0CTL1 |= UCSWRST; //enable, usci logic held in reset state
UCB0CTL1 |= UCSSEL_2; //SMCLK
UCB0CTL0 |= UCCKPL + UCMODE_0 + UCSYNC + UCMSB; //3-pin spi master, slave mode
UCB0BR0 |= 0x02;
UCB0BR1 = 0;
UCB0CTL1 &= ~UCSWRST;
//IE2 |= UCB0TXIE;
IE2 |= UCB0RXIE;
}
However, the slave cannot receive the data from the master, I have no idea ahout the problem, is my code correct? really thank you for giving me the suggestion, thanks for your time
Best regards