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.

MSP430F5529 launchpad UART RX flag not set

Other Parts Discussed in Thread: MSPWARE

Im trying to communicate with my EXP430F5529 LP over backchannel UART (UCA1). The transmission from MSP to PC is working fine - it gets displayed in the Putty terminal. However, when I write a character in Putty, the UCRXIFG gets never set (when I halt the program with debugger, I can see it is stuck inside USCI_A_UART_receiveData polling for the UCRXIFG flag) - see the source code below.

SMCLK set to 1MHz, baudrate 9600

Im using MSPWare 1.90 Driverlib. Here is my source code:

void initClocks(uint32_t mclkFreq)
{
    // Assign the REFO as the FLL reference clock
     UCS_clockSignalInit(
	   UCS_FLLREF,
	   UCS_REFOCLK_SELECT,
	   UCS_CLOCK_DIVIDER_1);

    // Assign the REFO as the source for ACLK
    UCS_clockSignalInit(
	   UCS_ACLK,
	   UCS_REFOCLK_SELECT,
	   UCS_CLOCK_DIVIDER_1);

    UCS_initFLLSettle(
        mclkFreq/1000,
        mclkFreq/32768);

    //use REFO for FLL and ACLK
    UCSCTL3 = (UCSCTL3 & ~(SELREF_7)) | (SELREF__REFOCLK);
    UCSCTL4 = (UCSCTL4 & ~(SELA_7)) | (SELA__REFOCLK);

}

void transmitBytes(uint8_t* bytes,uint8_t size)
{
  for (uint8_t i = 0;i < size;++i)
  {
    USCI_A_UART_transmitData(USCI_A1_BASE,bytes[i]);
  }
}

int main( void )
{
    // Stop watchdog timer to prevent time out reset
   WDTCTL = WDTPW + WDTHOLD;
      
   // Set clock to 1MHz          
   initClocks(1000000);
   
   // Set LED and blink
   setupLEDs();
   blinkLED1(2);
   
   // Setup pins
   GPIO_setAsPeripheralModuleFunctionInputPin(
                GPIO_PORT_P4,
                GPIO_PIN4 + GPIO_PIN5
                );
   
   // Initialize UART (baudrate 9600)
   USCI_A_UART_initAdvance(USCI_A1_BASE,USCI_A_UART_CLOCKSOURCE_SMCLK,
                           104,0,1, USCI_A_UART_NO_PARITY,
                           USCI_A_UART_LSB_FIRST,USCI_A_UART_ONE_STOP_BIT, USCI_A_UART_MODE,
                           USCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION);
                           
     
   USCI_A_UART_enable(USCI_A1_BASE);
      
   uint8_t hello[6] = {'M','S','P','4','3','0'};
   transmitBytes(hello,6);

   while (1)
   {
      // Wait for incoming byte
      uint8_t recv = USCI_A_UART_receiveData(USCI_A1_BASE);
      blinkLED2(2);  // Blink led when data is received
     
      // Perform the received command
      if (recv == 'A')
      {
        blinkLED1(5);
      } 
      else if (recv == 'B')
      {
        blinkLED2(5);
      }
      else if (recv == 'C')
      {
        uint8_t hello[6] = {'H','E','L','L','O','!'};
        transmitBytes(hello,6);
      }
      else if (recv == 'Q')
      {
        break;
      }
   }
   
   // Close UART peripheral
   USCI_A_UART_disable(USCI_A1_BASE);
  
  
   return 0;
}

Im running Windows 7 with IAR. Of course, I set 9600 baudrate, stop bits, no parity, etc. in putty accordingly.

Also the RXD and TXD jumpers on my LaunchPad are in place.

Thanks for any hints!

  • Hi, Lukas,

    If there is no jumpers for RTS and CTS on the LaunchPad, please select "none" for flow control in the Putty.

    Thanks,

    Yang

  • Hi, thanks for your answer, but I have it set to "none" already. I have also tried to put CTS and RTS jumpers and set the flow control in Putty, but still the RXIFG doesn't get set when I type into the terminal.

  • Since your code to transmit from the launchpad works, have you tried using "listen" mode on the USCI to loop the transmitted data back into the receive input?

  • Hi Lukas,

    I see no problem with your code and it should work generally.

    I would suggest to look at other aspects of the system.

    You may try to make a loopback as suggested above, but it is worth to check first on the scope if you are indeed physically getting some RX data from the onboard ezFET (which acts also as USB->UART convertor on the Launchpad). You can access it easily on the RXD jumper or directly on the P4.5 pin. Have a look also on the RX bit timing, just in case, as you use only REFO as a clk ref.

    Let us know if you were able to resolve the problem. Alternatively, if you can provide your contact (email) we can come to you directly and help to make you up and running faster.

    Best regards,
    Roman.

  • Hello Roman,


    thanks alot for trying it out, at least I know the problem isn't in my code. I will put it on the scope as soon as I get to the office and let you know.


    Best regards,

    Lukas

  • Hi Roman,

    so I managed to put the launchpad on scope, and realized that there was some really weird bug: When I first started putty to listen on my COM port and then started debugging in IAR, there was absolutely no signal coming from PC to the Launchpad when I typed anything to the terminal.

    However, when I first started the debug session in IAR and then opened up putty everything worked just fine.

    I don't know what the reason of this bug might be, but at least it works for now!


    Thanks for your reply anyway.

    Best regards,

    Lukas

  • Probably a problem with the COM port usage on your PC.
    What if you only start PUTTY and not IAR? Maybe IAR is ‘stealing’ the COM port from PUTTY when starting up, then releasing it again. Might be related to the way the backchannel UART is integrated into the debugger connection.

**Attention** This is a public forum