Hi,
I am trying to modify a C code based on MSP430G2221 to a new system based on MSP430G2553. The main difference is the SPI interface since MSP430G2221 is using the USI and MSP430G2553 which we are now applying has USCI. Further, we are using the TI radio chip CC115L in both systems.
I have modified the code for USI
USISRL = inbyte; // Load byte to send in USI shift register
USICNT |= 8; // Start to send 8 bits. USIIFG cleared
while(!(USICTL1 & USIIFG)); // Wait for all SPI bits to be sent
return USISRL; // Copy rx SPI byte from Chipcon
To the USCI:
uint8_t temp;
// Send 'inbyte'
UCB0TXBUF = inbyte;
while((IFG2 & UCB0RXIFG) == 0);
temp = UCB0RXBUF; // Read RX and throw away to prevent overrun error.
// Receive byte
while (UCB0STAT & UCBUSY);
UCB0TXBUF = 0; // Write data is a don't care.
while((IFG2 & UCB0RXIFG) == 0);
return UCB0RXBUF;
The compiler shows no error, but if I run my program, its always hanging in the lines where I use while((IFG2 & UCB0RXIFG) == 0);
I have then commented these commands out. But then its hanging somewhere else where it hasn't complained before.
Thanks!