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.

MSP430F5529: UART Interfacing

Part Number: MSP430F5529
Other Parts Discussed in Thread: MSP-EXP430F5529LP

Hello  everyone,

I tried to interface Uart with msp430f5529, but I have not got any output in the serial monitor.I have pasted my code below .Kindly look into this problem.

#include <msp430.h>

void uart_string(char *p);

int main(void)

{

  WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT

  P3SEL = BIT4+BIT3;                        // P3.4,5 = USCI_A0 TXD/RXD

  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 ;

                                            // over sampling

  UCA0CTL1 &=~UCSWRST;                     // **Initialize USCI state machine**

 

  uart_string("Edgate Technologies India");

}

void uart_string(char *p)

{

while(*p)

{

UCA0TXBUF=*p;

while(UCA0STAT&UCBUSY);

p++;

}

}

#include <msp430.h>void uart_string(char *p);int main(void){  WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT  P4SEL = BIT4+BIT5;                        // P3.4,5 = USCI_A0 TXD/RXD  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  uart_string("Edgate Technologies India");}
void uart_string(char *p) {
while(*p) { UCA0TXBUF=*p; while(UCA0STAT&UCBUSY);
p++;
}
}

  • By mistake I have pasted the wrong code .The new code is as follows-
    #include <msp430.h>
    void uart_string(char *p);
    int main(void)
    {
    WDTCTL = WDTPW + WDTHOLD; // Stop WDT
    P3SEL = BIT3+BIT4; // P3.4,5 = USCI_A0 TXD/RXD
    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 ;
    // over sampling
    UCA0CTL1 &=~UCSWRST; // **Initialize USCI state machine**

    uart_string("Edgate Technologies India");
    }

    void uart_string(char *p)
    {

    while(*p)
    {
    UCA0TXBUF=*p;
    while(UCA0STAT&UCBUSY);

    p++;

    }

    }
  • Hello Abhishek,

    You need to set UCBRF_13 and UCOS16 in the UCA0MCTL register or else you are not going to be transmitting at 9600 baud as expected. I recommend you review code example MSP430F55xx_uscia0_uart_04.c and further debug your program to make sure that UCA0TXBUF is getting populated with the expected characters.

    Regards,
    Ryan
  • I have done MSP430F55xx_uscia0_uart_04.c program but still i don't get any output. The program does not echo back.
    I have checked in Tera Term and Hyperterminal.
  • It goes to follow then that you have a hardware connection issue or are using the wrong USCI module in your code. If using the MSP-EXP430F5529LP then please note that the backchannel UART uses UCSI_A1 on P4.4/P4.5 and that the code example will have to be ported accordingly.

    Regards,
    Ryan
  • Sir I have connected P3.3 and P3.4 externally to the TXD and RXD pins present in the Emulator section. Now my code is running fine.

    Thank you sir

**Attention** This is a public forum