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.

MSP430FR2422: TS430RHL20

Part Number: MSP430FR2422


Sir, I need one more help. I have connected msp430fr2422 kit with CP210x USB to UART converter. But i am not able to transmit and recive the data through the cp210 converte.

Below the attachment of hard code. please rectify the problem.

 

WDTCTL = WDTPW | WDTHOLD;

 

   P2DIR = BIT3;

   P2OUT &= ~BIT3;

   PM5CTL0 &= ~LOCKLPM5;

 

   UARTA0_PortPinSelection();

   TimerA0_Configuration();

   UARTA0_Configuration();

 

     TimeStamp = LocalTime;

     PrintfTimeStamp = LocalTime;

   while(1)

   {

       TIMERA0_CLR;

       __bis_SR_register(LPM0_bits | GIE);

 

       if(LocalTime - TimeStamp >= 2000)

       {   int i;

           TerminalValue[0]= TvsVoltage;

           TerminalValue[1]= TvsCurrent;

 

         // Printf_USART2("Serial");

           for(i =0; i<2 ; i++)

           SendtheSequenceofbyte(TerminalValue[i]);

           TimeStamp = LocalTime;

       }

 

         __delay_cycles(500);

   }

}

 

void UARTA0_PortPinSelection(void)

{

       P2SEL1 &= ~BIT0;

       P2SEL0 |= BIT0;

       P2SEL1 &= ~ BIT1;

       P2SEL0 |= BIT1;

}

void UARTA0_Configuration(void)

{

   // Configure UART

     UCA0CTLW0 |= UCSWRST;                     // Put eUSCI in reset

     UCA0CTLW0 |= UCSSEL__ACLK;

     // Baud Rate calculation

     UCA0BR0 = 3;                             // 32768/9600 = 3.4

     UCA0MCTLW = 0x9200;                       // 1000000/115200 - INT(1000000/115200)=0.68

                                               // UCBRSx value = 0xD6 (See UG)

     UCA0BR1 = 0;

     UCA0CTLW0 &= ~UCSWRST;                   // Initialize eUSCI

     UCA0IE |= UCRXIE;                         // Enable USCI_A0 RX interrupt

     UCA0IFG &=~ UCRXIFG;

 

   // UCA0STATW |= UCLISTEN;                 // LOOP BACK

}

 

void TimerA0_Configuration(void)

{

       TA0CCTL0 |= CCIE;                             // TACCR0 interrupt enabled

       TA0CCR0 = 1000;

       TA0CTL = TASSEL__SMCLK | MC__UP | TACLR;     // SMCLK, UP mode

}

void SendtheSequenceofbyte(char dataptr)

{

 

                 UCA0TXBUF = (dataptr & (short unsigned int)0x01FF);

                 while(!(UCA0IFG & UCTXIFG));

 

}

  

 

#pragma vector = TIMER0_A0_VECTOR

__interrupt void Timer_A (void)

{

       LocalTime++;

 

       __bic_SR_register_on_exit(LPM0_bits);

}

 

#pragma vector=EUSCI_A0_VECTOR

__interrupt void EUSCI_A0_ISR(void)

{

   static int count;

       UCA0IFG &=~ UCRXIFG;           // Clear interrupt

 

       Data = (UCA0RXBUF & (short unsigned int )0x01FF);

       P2OUT ^= BIT3;

       if(flag ==0)

       {

           TempDta = (char)Data;

           flag =1;

       }

   if(flag ==1)

   {

       if(count < 6)

       {

           RXTemp[count]= TempDta;

           count++;

           flag =0;

       }

   }

       if(count >=6)

       {

           count=0;

           flag=0;

       }

     // __bic_SR_register_on_exit(LPM0_bits);

}

 

  • Hi Mutharagan,

    Looks like you are selecting port pins P2.0 & P2.1 for UART in UARTA0_PortPinSelection(). This requires setting USCIARMP = 1. Please see the register description in the User's Guide (https://www.ti.com/lit/pdf/slau445). This is part of register SYSCFG3. You will find it in section 1.16.1.4.

    Refer to the device datasheet (www.ti.com/.../msp430fr2422) section 6.10.7 Enhanced Universal Serial Communication Interface (eUSCI_A0, eUSCI_B0), Table 6-11. eUSCI Pin Configurations. To use eUSCI_A0 UART pins on P2.0 & P2.1, USCIARMP  needs to be set to 1. Otherwise, UART defaults to pins P1.4 & P1.5

    Srinivas

**Attention** This is a public forum