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.

Issue with RS-232 data transmission on MSP430FG4618/f2013 board

Hi friend's i have tested the RS-232 cable with DVM which pass  the continuity test of the RS-232 cable. And also i short the cable pin RX and TX and then type something which then echoed and displayed in the hyper terminal, that means the RS-232 cable is good. Now i short the pin5 and pin6 of H4 which is actually P2.4 and P2.5 pin of the MSP430FG4618, in the pin access of MSP430FG4618/F2013 experimenter's board which are UCA0TXD and UCA0RXD respectively and at the same time i do not run the program only power on the board and type something which again displayed in the hyper terminal of my PC, that means the isolated RS-232 Communication part is OK. But whenever i run the program of "echo" of TI code which actually short the pins(RX and TX) via software didn't work. It displays nothing. I am now confusing what i have to do, i did some short of testing what i know and also i explain details here. If there is some testing of hardware and software is missing please reply me and give me a good solution of this mess because i stuck it for some days.

here is the TI code of "echo"....

=======================================================

//******************************************************************************
//   MSP430xG46x Demo - USCI_A0, Ultra-Low Pwr UART 9600 Echo ISR, 32kHz ACLK
//
//   Description: Echo a received character, RX ISR used. Normal mode is LPM3,
//   USCI_A0 RX interrupt triggers TX Echo.
//   ACLK = BRCLK = LFXT1 = 32768, MCLK = SMCLK = DCO~1048k
//   Baud rate divider with 32768hz XTAL @9600 = 32768Hz/9600 = 3.41 (0003h 03h )
//   //* An external watch crystal is required on XIN XOUT for ACLK *//   
//
//
//                MSP430xG461x
//             -----------------
//         /|\|              XIN|-
//          | |                 | 32kHz
//          --|RST          XOUT|-
//            |                 |
//            |     P4.7/UCA0RXD|------------>
//            |                 | 9600 - 8N1
//            |     P4.6/UCA0TXD|<------------
//
//   K. Quiring/ M. Mitchell
//   Texas Instruments Inc.
//   October 2006
//   Built with CCE Version: 3.2.0 and IAR Embedded Workbench Version: 3.41A
//******************************************************************************
#include  "msp430xG46x.h"

void main(void)
{
  volatile unsigned int i;

  WDTCTL = WDTPW+WDTHOLD;                   // Stop WDT
  FLL_CTL0 |= XCAP14PF;                     // Configure load caps

  do
  {
  IFG1 &= ~OFIFG;                           // Clear OSCFault flag
  for (i = 0x47FF; i > 0; i--);             // Time for flag to set
  }
  while ((IFG1 & OFIFG));                   // OSCFault flag still set?

 //P2SEL |=0x30;                              // P2.4,5 = USCI_A0 RXD/TXD
  P4SEL |= 0x0C0;                           // P4.7,6 = USCI_A0 RXD/TXD
  UCA0CTL1 |= UCSSEL_1;                     // CLK = ACLK
  UCA0BR0 = 0x03;                           // 32k/9600 - 3.41
  UCA0BR1 = 0x00;                           //
  UCA0MCTL = 0x06;                          // Modulation
  UCA0CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**
  IE2 |= UCA0RXIE;                          // Enable USCI_A0 RX interrupt

  _BIS_SR(LPM0_bits + GIE);                 // Enter LPM0, interrupts enabled
}

//  Echo back RXed character, confirm TX buffer is ready first
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCIA0RX_ISR (void)
{
  while(!(IFG2&UCA0TXIFG));
  UCA0TXBUF = UCA0RXBUF;                    // TX -> RXed character
}
=============================================================

And here is the schematic of the board. I circled two portion of the schematic with green line which are tested by me.

  • Hi friend's the problem is solved partially.In TI code they only give the P4SEL |= 0x0C0; but when it doesn't work,i see the pin diagram properly,and  i found that there are another two pins which are also used for RXD(P2.4) and TXD(P2.5). then i write it on that program. After add the P2SEL |= 0x030; in the TI code, then also i found it doesn't work. then i add it( P2SEL |= 0x030;) in my own program which work properly. I think there may be some mistakes in TI code.

    Here is the TI code below which is not work after i add the port2(in blue color)

    ============================================================ 

    //******************************************************************************
    //   MSP430xG46x Demo - USCI_A0, Ultra-Low Pwr UART 9600 Echo ISR, 32kHz ACLK
    //
    //   Description: Echo a received character, RX ISR used. Normal mode is LPM3,
    //   USCI_A0 RX interrupt triggers TX Echo.
    //   ACLK = BRCLK = LFXT1 = 32768, MCLK = SMCLK = DCO~1048k
    //   Baud rate divider with 32768hz XTAL @9600 = 32768Hz/9600 = 3.41 (0003h 03h )
    //   //* An external watch crystal is required on XIN XOUT for ACLK *//   
    //
    //
    //                MSP430xG461x
    //             -----------------
    //         /|\|              XIN|-
    //          | |                 | 32kHz
    //          --|RST          XOUT|-
    //            |                 |
    //            |     P4.7/UCA0RXD|------------>
    //            |                 | 9600 - 8N1
    //            |     P4.6/UCA0TXD|<------------
    //
    //   K. Quiring/ M. Mitchell
    //   Texas Instruments Inc.
    //   October 2006
    //   Built with CCE Version: 3.2.0 and IAR Embedded Workbench Version: 3.41A
    //******************************************************************************
    #include  "msp430xG46x.h"

    void main(void)
    {
      volatile unsigned int i;

      WDTCTL = WDTPW+WDTHOLD;                   // Stop WDT
      FLL_CTL0 |= XCAP14PF;                     // Configure load caps

      do
      {
      IFG1 &= ~OFIFG;                           // Clear OSCFault flag
      for (i = 0x47FF; i > 0; i--);             // Time for flag to set
      }
      while ((IFG1 & OFIFG));                   // OSCFault flag still set?

      //P4SEL |= 0x0C0;                           // P4.7,6 = USCI_A0 RXD/TXD

      P2SEL |= 0x030;
      UCA0CTL1 |= UCSSEL_1;                     // CLK = ACLK
      UCA0BR0 = 0x03;                           // 32k/9600 - 3.41
      UCA0BR1 = 0x00;                           //
      UCA0MCTL = 0x06;                          // Modulation
      UCA0CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**
      IE2 |= UCA0RXIE;                          // Enable USCI_A0 RX interrupt

      _BIS_SR(LPM0_bits + GIE);                 // Enter LPM0, interrupts enabled
    }

    //  Echo back RXed character, confirm TX buffer is ready first
    #pragma vector=USCIAB0RX_VECTOR
    __interrupt void USCIA0RX_ISR (void)
    {
      while(!(IFG2&UCA0TXIFG));
      UCA0TXBUF = UCA0RXBUF;                    // TX -> RXed character
    }
    ===========================================================

    And here in below is my code based on that. Which works properly.

    ===========================================================

    #include  <msp430xG46x.h>

    void main(void)
    {
      //volatile unsigned int i;
      //volatile unsigned char temp[]="HELLO";
      WDTCTL = WDTPW+WDTHOLD;                   // Stop WDT
      FLL_CTL0 |= XCAP14PF;                     // Configure load caps

      do
      {
      IFG1 &= ~OFIFG;                           // Clear OSCFault flag
      //for (i = 0; i <=0x47FF; i++);             // Time for flag to set
      _delay_cycles(50000);
      }
      while ((IFG1 & OFIFG));                   // OSCFault flag still set?
        P2SEL |= 0x30;                         // P2.4,5 = USCI_A0   RXD/TXD
     
      //P4SEL |= 0x0C0;                         // P4.7,6 = USCI_A0 RXD/TXD
      UCA0CTL1 |= UCSSEL_1;                     // CLK = ACLK
      UCA0BR0 = 0x03;                           // 32k/9600 - 13.65
      UCA0BR1 = 0x00;                           //
      UCA0MCTL = 0x06;                          // Modulation
      UCA0CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**

     while(1)
     {
         //for(i = 0; i<=5; i++)
       // UCA0TXBUF = temp[i];
        _delay_cycles(1000);
         UCA0TXBUF = 0x41;
     }
     }
    ===========================================================

    I want to know that if i want to show a single character it gives me proper value but when i want to write a "HELLOWORD" in my above program it shows me garbage value though it take less than 13 bit.Please reply