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 using MSP430 eZ430-RF2500



I have a MSP430 eZ430-RF2500  kit. I am unable to perform simple UART communication on it. I hav e tried all the programs given in slac123 but unable to show any received information from the MSP to the computer (PC).  I am not able to figure out what the problem is, can anyone reply with some sample programs on UART that work on the kit.

one of the sample programs that i have tried is :

#include  "msp430x22x4.h"

const char string1[] = { "Hello World\r\n" };
  unsigned int i;

void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
  P1DIR = 0xFF;                             // All P1.x outputs
  P1OUT = 0;                                // All P1.x reset
  P2DIR = 0xFF;                             // All P2.x outputs
  P2OUT = 0;                                // All P2.x reset
  P3SEL = 0x30;                             // P3.4,5 = USCI_A0 TXD/RXD
  P3DIR = 0xFF;                             // All P3.x outputs
  P3OUT = 0;                                // All P3.x reset
  P4DIR = 0xFF;                             // All P4.x outputs
  P4OUT = 0;                                // All P4.x reset
  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;                          // Enable USCI_A0 RX interrupt

  __bis_SR_register(LPM3_bits + GIE);       // Enter LPM3 w/ int until Byte RXed
}

#pragma vector=USCIAB0TX_VECTOR
__interrupt void USCI0TX_ISR(void)
{
  UCA0TXBUF = string1[i++];                 // TX next character

  if (i == sizeof string1 - 1)              // TX over?
    IE2 &= ~UCA0TXIE;                       // Disable USCI_A0 TX interrupt
}

#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCI0RX_ISR(void)
{
  if (UCA0RXBUF == 'u')                     // 'u' received?
  {
    i = 0;
    IE2 |= UCA0TXIE;                        // Enable USCI_A0 TX interrupt
    UCA0TXBUF = string1[i++];
  }
}

The main problem is that it does not work on MSP430 eZ430-RF2500

  • I am having the same problem too. Could it be because of Win 7 ???

  • John,

    Do you see any movement on the pin? Also, just as a few FYI points, you are missing some paranthesis around the sizeof command. It should read sizeof(string1) -1;

    Also, in this case sizeof(string1) -1, isnt going to give you the results that you think it will. It is going to return the size of the type, in this case it would return the size of a char.

    You need to use strlen to determin the length of the string.

    -Jason

     

  • Hi,

    john sudeep said:
    The main problem is that it does not work on MSP430 eZ430-RF2500

    What does not work? "It does not work" is a general comment that it does not help too much to give you an answer.

    A transmission/reception process involves two concepts, TX'd and RX'd. What of them does not work? TX'd, RX'd, no one? With a simple blinking LED or breakpoint is easy to know what part is/is not working.

    "Divide and conquer"

    By other hand,

    john sudeep said:
    if (i == sizeof string1 - 1)              // TX over?

    With this line I suppose you are checking if the string is over, all string as "here your string" in C ends with a null character '\0'. It is easier a condition like

    if(string[i] == '\0') // Take care with the index

**Attention** This is a public forum