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.

SPI communication between MSP430F5529 and MSP430F47197

Other Parts Discussed in Thread: MSP430F47197, MSP430F5529

Hi all,

We are working on the project, in which we use SD16A module of msp430f47197 to calculate analog voltage and current.

and after all calculation we want to transmit that values to msp430f5529 for the purpose of display.

The problem is when we start Communication it works for 5 or 6 seconds and then bytes get shifted by one every time.

this code is for msp430f47197 which is slave.

#pragma vector = USCIAB1RX_VECTOR
__interrupt void USCIAB1RX_ISR(void)
{
	if(a2 > 0 ) UCA1TXBUF = 1;
	if (flg == 0)
	{
		RX_Data[rx_count] = UCA1RXBUF;
		rx_count++;

		if(RX_Data[0] == '1' && RX_Data[1] == '3' && RX_Data[2] == '5' && RX_Data[3] == '7')	//..... Para for first 3 pages
		{
			flg = 0xff;
		}

		if(rx_count > 4 )
		{
			UCA1TXBUF = '&';
			rx_count = 0;
			a2 = 1;
		}
	}

	else
	{
		rx_count++;
		UCA1TXBUF = para_1[rx_count - 5];
		RX_Data[6] = UCA1RXBUF;

		if(rx_count == 85)
		{
			rx_count = 0;
			flg = 0;
			a2 = 0;
		}
	}
}

and this is for msp430f5529 which is master.

 

        case TA1IV_TA1CCR1:

        	TA1CCR1 += 3360; //400uS
        	spi_cnt++;
    		if(spi_cnt == 86)
    		{
    			//UCA1TXBUF = 0;
    			spi_cnt = 0;		//this stops further transmisson as all data transmitter till further start
    			TA1CCTL1 &= ~CCIE;
    		}
    		else
    		{
    			if(spi_cnt > 4 && spi_cnt <= 85)
    				{
    					UCA1TXBUF = spi_cnt;
    				}
    			else
    				{
    					UCA1TXBUF = password[spi_cnt];
    				}
    		}

in which master every 400uS send byte and receives in receive ISR

which is

#pragma vector = USCI_A1_VECTOR
__interrupt void USCI_A1_ISR(void)
{

switch(__even_in_range(UCA1IV,4))
{
case 0: break;

case 2:
if(UCA1RXBUF != '&')
{
if(spi_cnt > 5 && spi_cnt <= 85) v[spi_cnt-6] = UCA1RXBUF;
}
else
{
spi_cnt = 0; //this stops further transmission as all data transmitter till further start
TA1CCTL1 &= ~CCIE;
temp = UCA1RXBUF;
}

break; //RXIFG

case 4: break; //TXIFG
default: break;
}
}

one more thing we are using 3- wire communication means SIMO, SOMI and CLK no other pins are used.

Please help us, we are stuck  in it.

Any help is appreciated.

Thanks in advance.

**Attention** This is a public forum