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.

connection error between MSP and Tera Term



I am just start with UART and I  write a simple UART code to connect between MSP430 launchpad and PC.

I adjust the jumper so the UART is in  HW mode. I write a code to send  "1A" and "A1" periodically. However, when I try to receive the signal, I got random number, such as "00 FF 00 00 00 FC FE 00 00 1D 0F 00 FF 00 1F 00 FF 00 03 10 FF"

Is there something wrong with my baud rate? Should I solder an outside oscillator to generate  baud rate = 9600? Or Is there any wrong with my Tera Term setting? Thank you very very much!

My Tera Term setting is Baud rate = 9600, data = 8bit, parity = none, stop = 1bit, flow control = non.

My code is:

#include <msp430.h>
int a,b;

int main(void)
{
  WDTCTL = WDTPW + WDTHOLD;                 // Stop watchdog timer
  P1OUT = 0x00;                             // P1.0/6 setup for LED output
  P1DIR = BIT0 + BIT6;
  P1SEL = BIT1 + BIT2 ;                     // P1.1 = RXD, P1.2=TXD
  P1SEL2 = BIT1 + BIT2;
  UCA0CTL1 |= UCSSEL_1;                     // CLK = ACLK
  UCA0BR0 = 0x03;                           // 32kHz/9600 = 3.41
  UCA0BR1 = 0x00;
  UCA0MCTL = UCBRS1 + UCBRS0;               // Modulation UCBRSx = 3
  UCA0CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**
  IE2 |= UCA0RXIE + UCA0TXIE;               // Enable USCI_A0 TX/RX interrupt

  __bis_SR_register(LPM3_bits + GIE);       // Enter LPM3 w/ interrupts enabled
}

// USCI A0/B0 Transmit ISR
#pragma vector=USCIAB0TX_VECTOR
__interrupt void USCI0TX_ISR(void)
{
  while (!(IFG2 & UCA0TXIFG));
  UCA0TXBUF = 0x1A;                       // Read, justify, and transmit
  b++;
  while (!(IFG2 & UCA0TXIFG));
  UCA0TXBUF = 0xA1;
  a++;
}

**Attention** This is a public forum