# MSP430F5529 and 865lp SPI

**URL:** <https://forums.digi.com/t/msp430f5529-and-865lp-spi/15117>\
**Category:** XBee & XBee Gateway\
**Tags:** spi, xbee\
**Created:** [July 14, 2015, 10:47am UTC](https://forums.digi.com/t/msp430f5529-and-865lp-spi/15117 "2015-07-14T10:47:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![712ee1071](https://avatars.discourse-cdn.com/v4/letter/7/6bbea6/32.png) [@712ee1071](https://forums.digi.com/u/712ee1071)\
**Post date:** [July 14, 2015, 10:47am UTC](https://forums.digi.com/t/msp430f5529-and-865lp-spi/15117/1 "2015-07-14T10:47:05Z")

</div>

Hello everyone,  
I am trying send hello from one 865lp to another Xbee 865lp in API mode.While on development board there is no problem but while using msp430 there is no transmission of the hello message.I took the same API frame which I used on XCTU on the development board.Here is the code.  
Although the 865lp does transmit Node Identification Indicator which I can see on XCTU through the the other xbee connected.  
Please help me thanks.

#include

//unsigned char MST\_Data,SLV\_Data;  
//unsigned char temp;  
char MST\_Data[23];  
int start=0;  
//char response[400];  
volatile char c;  
int d;

int j=0;  
int main(void)  
{  
volatile unsigned int i;

WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer  
P3SEL |= BIT3+BIT4; // P3.3,4 option select  
P2SEL |= BIT7; // P2.7 option select

UCA0CTL1 |= UCSWRST; // **Put state machine in reset**  
UCA0CTL0 |= UCMST+UCSYNC+UCCKPH+UCMSB; // 3-pin, 8-bit SPI master  
// Clock polarity high, MSB  
UCA0CTL1 |= UCSSEL\_2; // SMCLK  
UCA0BR0 = 10; // /10  
UCA0BR1 = 0; //  
UCA0MCTL = 0; // No modulation  
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**  
UCA0IE |= UCRXIE; // Enable USCI\_A0 RX interrupt  
//////////////////////SERIAL PORT////////////////////////

P4SEL |= BIT4+BIT5; // P4.4,5 = USCI\_A1 TXD/RXD  
UCA1CTL1 |= UCSWRST; // **Put state machine in reset**  
UCA1CTL1 |= UCSSEL\_2; // SMCLK  
UCA1BR0 = 6; // 1MHz 9600 (see User’s Guide)  
UCA1BR1 = 0; // 1MHz 9600  
UCA1MCTL =UCBRS\_0 + UCBRF\_13 + UCOS16; // Modln UCBRSx=0, UCBRFx=0,  
UCA1CTL1 &= ~UCSWRST; // **Initialize USCI state machine**

P4DIR|=BIT1; //SSEL

```
 MST_Data[0] = 0x7E; // Initialize data values
 MST_Data[1] = 0x00; //
 MST_Data[2] = 0x13;
 MST_Data[3] = 0x10;
 MST_Data[4] = 0x01;
 MST_Data[5] = 0x00;
 MST_Data[6] = 0x13;
 MST_Data[7] = 0xA2;
 MST_Data[8] = 0x00;
 MST_Data[9] = 0x40;
 MST_Data[10]= 0xC8;
 MST_Data[11]= 0xDB;
 MST_Data[12]= 0xAA;
 MST_Data[13]= 0xFF;
 MST_Data[14]= 0xFE;
 MST_Data[15] = 0x00;
 MST_Data[16] = 0x00;
 MST_Data[17] = 0x68;
 MST_Data[18] = 0x65;
 MST_Data[19] = 0x6C;
 MST_Data[20]= 0x6C;
 MST_Data[21]= 0x6F;
 MST_Data[22]= 0x9B;

```

for(i=50;i\>0;i–); // Wait for slave to initialize  
//  
j=0;  
P4OUT&=~BIT1;  
while(j\<23){  
P4OUT&=~BIT1;  
while (!(UCA0IFG&UCTXIFG)); //MAIN SPI // USCI\_A0 TX buffer ready?  
UCA0TXBUF =MST\_Data[j]; // Transmit first character  
while (!(UCA1IFG&UCTXIFG)); //COM WINDOW  
UCA1TXBUF =MST\_Data[j];  
j++;  
if(j==23){  
j=0;  
while (!(UCA1IFG&UCTXIFG)); //COM WINDOW  
UCA1TXBUF =’  
';  
P4OUT|=BIT1;  
\_delay\_cycles(50000);  
}  
}  
\_\_bis\_SR\_register(LPM0\_bits + GIE); // CPU off, enable interrupts  
}

#if defined( **TI\_COMPILER\_VERSION** ) || defined( **IAR\_SYSTEMS\_ICC** )  
#pragma vector=USCI\_A0\_VECTOR  
\_\_interrupt void USCI\_A0\_ISR(void)  
#elif defined( **GNUC** )  
void **attribute** ((interrupt(USCI\_A0\_VECTOR))) USCI\_A0\_ISR (void)  
#else  
#error Compiler not supported!  
#endif  
{  
volatile unsigned int i;

switch(\_\_even\_in\_range(UCA0IV,4))  
{  
case 0: break; // Vector 0 - no interrupt  
case 2:

```
     break;
case 4: break; // Vector 4 - TXIFG
default: break;

```

}  
}

---

<div class="post-metadata">

**Author:** ![mvut](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.digi.com/mvut/32/31_2.png) [@mvut](https://forums.digi.com/u/mvut)\
**Post date:** [September 3, 2015, 1:34pm UTC](https://forums.digi.com/t/msp430f5529-and-865lp-spi/15117/2 "2015-09-03T13:34:08Z")

</div>

Did you check to make sure that you are achieving a 9600 bps data rate on your UART? Verified DI and DO lines are connected properly? What if you just run test wires from the UART of the processor to the radios DI and DO lines on the interface board? Does it work then?
