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.

CCS/CC430F6137: Uart communication code is not working

Part Number: CC430F6137

Tool/software: Code Composer Studio

Dear Sir, My Project is using cc430f6137 ic, I am doing uart code for cc430x613x_uscia0_uart_04.c, my concept is, whenever receive any char at a time transmit only 't' character using interrupt. but here transmit only received data. testing using HC-05 bluetooth and mobile default app. this bluetooth is working well another microcontroller. what mistake for my code, please send soon.

#include <msp430.h>

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

PMAPPWD = 0x02D52; // Get write-access to port mapping regs 
P1MAP5 = PM_UCA0RXD; // Map UCA0RXD output to P1.5 
P1MAP6 = PM_UCA0TXD; // Map UCA0TXD output to P1.6 
PMAPPWD = 0; // Lock port mapping registers 

P1DIR |= BIT6; // Set P1.6 as TX output
P1SEL |= BIT5 + BIT6; // Select P1.5 & P1.6 to UART function

UCA0CTL1 |= UCSWRST; // **Put state machine in reset**
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 6; // 1MHz 9600 (see User's Guide)
UCA0BR1 = 0; // 1MHz 9600
UCA0MCTL = UCBRS_0 + UCBRF_13 + UCOS16; // Modln UCBRSx=0, UCBRFx=0,
// over sampling
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
UCA0IE |= UCRXIE; // Enable USCI_A0 RX interrupt

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

// Echo back RXed character, confirm TX buffer is ready first
#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
{
switch(__even_in_range(UCA0IV,4))
{
case 0:break; // Vector 0 - no interrupt
case 2: // Vector 2 - RXIFG
while (!(UCA0IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
UCA0TXBUF = 't';
// UCA0TXBUF = UCA0RXBUF; // TX -> RXed character
break;
case 4:break; // Vector 4 - TXIFG
default: break;
}
}

and also how to transmit string. Kindly waiting for your reply sir,

  • Hi Sivanathi,
    were you able to debug your code and verify if the data reception works fine? Please be specific if the transmission or the reception is not working. Besides, can you check the connection to UART pins Rx and Tx?
    How are you verifying if the UART communication is working or not?

    Thanks for sharing more details,
    Best regards,
    Britta
  • Hi Sivanathi,

    as I didn't hear back from you I assume that the issue has been solved.
    Please note that I am going to close this thread. Please reply back to re-open it in case you need further assistance.

    Thanks and best regards,
    Britta