MSP430-449STK2 UART problem

Hi,

I just got a MSP430-449STK2 development board and I am using the IAR IDE for download and debug.

My application requires a UART connection with a PC and for that I want to use the on-board RS232 connector (I think that it is connected to UART1 - according to the schematics). I am using an example program from TI (fet440_uart01_02400.c) which I converted to work with UART 1 instead of UART0. I intend to use the 32K crystal since I need a very low baudrate.

Everything looks very simple but unfortunatly it does not work. I receive no data nor the PC side.

I need some help here.

Thanks

Moshe

Most likely, I think, the problem is caused by one or more of the things you did or you did not do.

Maybe this will give more information -

This is the code I am using:

#include <msp430x44x.h>

void main(void)

{

WDTCTL = WDTPW + WDTHOLD; // Stop WDT

FLL_CTL0 |= XCAP18PF; // Configure load caps

P4SEL |= 0x03; // P4.0,1 = USART1 TXD/RXD

ME2 |= UTXE1 + URXE1; // Enable USART1 TXD/RXD

UCTL1 |= CHAR; // 8-bit character

UTCTL1 |= SSEL0; // UCLK = ACLK

UBR01 = 0x0D; // 32k/2400 - 13.65

UBR11 = 0x00;

UMCTL1 = 0x6B; // Modulation

UCTL1 &= ~SWRST; // Initialize USART state machine

IE2 |= URXIE1; // Enable USART1 RX interrupt

// Mainloop

for (;:wink:

{

_BIS_SR(LPM3_bits + GIE); // Enter LPM3 w/interrupt

while (!(IFG2 & UTXIFG1)); // USART1 TX buffer ready?

TXBUF1 = RXBUF1; // RXBUF1 to TXBUF1

}

}

// UART0 RX ISR will for exit from LPM3 in Mainloop

#pragma vector=UART1RX_VECTOR

__interrupt void usart1_rx (void)

{

_BIC_SR_IRQ(LPM3_bits); // Clear LPM3 bits from 0(SR)

}

I tried several versions of the code but none was workink.

Does anyone have a working code for that platform?

Thanks

Moshe

I do not have F449 and cannot test your code. A few suggestions:

  1. Make sure your TXD at pin 2 of your DB9 is connected to PC’s RXD at pin 2 of PC’s DB9. Your RXD at pin 3 of your DB9 should go to PC’s TXD at pin 3 of PC’s DB9. And pin 5 of your DB9 should go to pin 5 of PC’s DB9 for the common ground.

  2. Make sure that the PC program does not need DSR, CTS, RI, and CD signals. Also, it should use 2400 b/s etc.

  3. I think your code is correct. But I would add a line," P4DIR |= 0x01;" near the beginning of main just to make sure TXD1 is an output. I would also delete the line, " while (!(IFG2 & UTXIFG1));" inside the mainloop just to make sure it would not get stuck there.

  4. To help debug, I would add a lines, " P1DIR |= 0x28; P1SEL |= 0x20;" near the beginning of main. And add a line, " P1OUT ^= 0x08;" inside the mainloop. Install the LED_J jumper, the LED should toggle when you receive a byte. You should also see 32768Hz squarewave at P1.5 (ACLK).