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.

MSP430G2553: UART communication is getting disturb while using P2.3 pin as an input

Part Number: MSP430G2553


Hi TI,

         In our mspg2553 we are using using UART at pin p1.1 and p1.2 and p2.3 as an input pin. uart communication is working well, while input at gpio p2.3 is low but while it is high. uart communication is getting disturb. I mean communication is going slow and receiving invalid data. 

here is my code, please have a look and let me know if anything is wrong.

Uart Initialization:

 UCA0CTL1 |= UCSSEL_2;                     // SMCLK
    UCA0BR0 = 104;                            // 16MHz 9600
    UCA0BR1 = 0;                              // 16MHz 9600
    UCA0MCTL = UCBRS_0 + UCOS16 + UCBRF_3;    // Modulation UCBRSx = 0
    UCA0CTL1 &= ~UCSWRST;                   // **Initialize USCI state machine**
    IFG2 &= ~(UCA0RXIFG);
    IE2 |= UCA0RXIE;                          // Enable USCI_A0 RX interrupt

GPIO :

void initGPIO()
{
    P1DIR |= BIT0;  // DE_RE pin Mode as OUTPUT
    P2DIR |= BIT4;  // B_Led pin Mode as OUTPUT
    P2DIR |= BIT5;  // C_Led pin Mode as OUTPUT
    P2DIR |= BIT6;  // D_Led pin Mode as OUTPUT

    P2DIR |= (BIT1 + BIT2); //(P2.0-DoorLockOperator_A and P2.2  Fan operator)as output

    P2SEL &= ~(doorLockStatus_A);                    // i/o function selected, 0
    P2DIR &= ~(doorLockStatus_A);                    // P1.5 as input
    P2OUT &= ~(doorLockStatus_A);                    // select pull-down mode
    P2REN |= (doorLockStatus_A);                  // Enabling Pull Down Resister


    P1OUT &= ~BIT0; // DE_RE initially Low/receiving mode

    P2OUT &= ~BIT4;  // B_Led LOW Initially/OFF
    P2OUT &= ~BIT5;  // C_Led LOW Initially/OFF
    P2OUT &= ~BIT6;  // D_Led LOW Initially/OFF

    P2OUT &= ~BIT0; //DoorLockOperator_A LOW Initially/OFF
    P2OUT &= ~BIT1; //Optional LOW Initially/OFF
    P2OUT &= ~fanOperator; //FAN Operator LOW Initially/OFF

    P1SEL |= BIT3;  // ADC input pin P1.3

    P1SEL = BIT1 + BIT2;                      // P1.1 = RXD, P1.2=TXD
    P1SEL2 = BIT1 + BIT2;
}

where door lock pin is 

#define doorLockStatus_A  BIT3    // P2.3===>P2.0

apart from this i have one ADC pin as well, but i think that doesn't matter:

// Function containing ADC set-up
static void ConfigureADC()
{
ADC10CTL1 = INCH_3 + ADC10DIV_3; // Channel 3, ADC10CLK/3
ADC10CTL0 = SREF_0 + ADC10SHT_3 + ADC10ON + ADC10IE; // Vcc and Vss as reference, Sample and hold for 64 Clock cycles, ADC interrupt enable
ADC10AE0 |= BIT3; // ADC input enable P1.3
}

do let me know if anything is wrong.

thanks

sarju

  • Based on your description, my first guess is that the MCU is resetting. Try setting a breakpoint on the second line of main (after stopping the watchdog) to see.

    If you're using the G2ET Launchpad, don't forget to remove the P2.3 (LED) jumper on J8.

    For magic and superstition: try adding "P2SEL &= ~BIT7;" somewhere. P2.6 and P2.7 interact in non-obvious ways, but clearing (both of) the P2SEL bits seems to make them behave.

**Attention** This is a public forum