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.

UART communication

Other Parts Discussed in Thread: MSP430F5528

Hi,

     I have written a simple code to transmit a byte using UART of MSP430F5528, But when i run the code and open terminal to view the byte send it is full of garbage values appearing continuously. Below i the code , where am i going wrong??

#include <msp430.h>
#include <msp430f5528.h>
#include <stdio.h>


void main (void)
{

	WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT

	P4SEL |= 0x03;
	UCA1CTL1 |= UCSWRST;
	UCA1CTL0 = 0x00;
	UCA1CTL1 = 0x08;
	UCA1BR0 = 0x6D;
	UCA1BR1 = 0;
	UCA1MCTL = 0x04;

	UCA1CTL1 &= ~UCSWRST;
/////////////sending bytes///////////

	while (!(UCA1IFG & UCTXIFG)); // USART0 TX buffer ready?
	 UCA1TXBUF = 0x41;
	 while (!(UCA1IFG & UCTXIFG)); // USART0 TX buffer ready?
	 UCA1TXBUF = 0x42;
}

  • What happens after the last statement? You shoud have an infinite loop.

    If values appear continuously, then this is not something caused by this program, which sends at most two bytes. There might be something wrong with your secret circuit.
  • > UCA1CTL1 = 0x08;

    According to SLAU208O Table 36-8, this sets UCBDORM and UCSSEL_0. I've never tried this combination, but I suspect it doesn't do what you want. (This is another argument for using names, not magic constants.)

    What were you trying to do here?

**Attention** This is a public forum