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.

MSP430 received data from CC2541 error

Dear all,

I used Serial_BLE_Bridge on CC2541 BoosterPack and a simple code below on MSP430F5529_LaunchPad.

I changed the include files in Serial_BLE_Bridge project from "simpleGATTprofile.c/.h" to "simpleGATTprofile_Bridge.c/.h" so that it can received 20 bytes.

The MCU will transmit the data from BLE (through USCI_A0 UART)  to PC (through USCI_A1 UART).

But the received data on terminal, just "AB", "AD", "data[0]", ... "data[LEN]. The third byte should be "LEN" but it dose not appeared.

What's the problem I meet?

Thanks.

KJ

// KJ-0001
// MCU to BLE UART: USCI_A0 / 1MHz / 115200 / 8 / N / 1
// MCU to PC UART: USCI_A1 / 1MHz / 115200 / 8 / N / 1

#include <msp430.h>

int main(void)
{
	WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT

	P3SEL |= BIT3+BIT4;                       // P3.3,4 = USCI_A0 TXD/RXD
	UCA0CTL1 |= UCSWRST;                      // **Put state machine in reset**
	UCA0CTL1 |= UCSSEL_2;                     // SMCLK
	UCA0BR0 = 9;                              // 1MHz 115200 (see User's Guide)
	UCA0BR1 = 0;                              // 1MHz 115200
	UCA0MCTL |= UCBRS_1 + UCBRF_0;            // Modulation UCBRSx=1, UCBRFx=0
	UCA0CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**
	UCA0IE |= UCRXIE;                         // Enable USCI_A0 RX interrupt

	P4SEL |= BIT4+BIT5;                       // P4.4,5 = USCI_A1 TXD/RXD
	UCA1CTL1 |= UCSWRST;                      // **Put state machine in reset**
	UCA1CTL1 |= UCSSEL_2;                     // SMCLK
	UCA1BR0 = 9;                              // 1MHz 115200 (see User's Guide)
	UCA1BR1 = 0;                              // 1MHz 115200
	UCA1MCTL |= UCBRS_1 + UCBRF_0;            // Modulation UCBRSx=1, UCBRFx=0
	UCA1CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**
	UCA1IE |= UCRXIE;                         // Enable USCI_A1 RX interrupt

	__bis_SR_register(LPM0_bits + GIE);       // Enter LPM0, interrupts enabled
	__no_operation();                         // For debugger

}


// When received from UCA0RXBUF, trans. to UCA1TXBUF
#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
{
	switch(__even_in_range(UCA0IV,4))
	{
		case 0x00:								// Vector 0: No interrupts
			break;
		case 0x02:								// Vector 2: Data received: UCRXIFG;
			UCA1TXBUF = UCA0RXBUF;		//KJ: for Debug
			break;
		case 0x04:								// Vector 4: Transmit buffer empty: UCTXIFG
			break;
		default:
			break;
	}
}

**Attention** This is a public forum