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.

MSP430FR5739: Unable to get UART / Serial port working on eval board

Part Number: MSP430FR5739
Other Parts Discussed in Thread: MSP-EXP430FR5739

Hi,

I am new to MSP430 family and there is a learning curve for sure. My setup is a MSP430FR5739 on the evaluation board EXP-MSP430FR5739. It is connected to the PC using the USB connection, that also carry the CDC. 

I am trying to setup a UART connection (115200 bps, N,8,1) to my host PC, but it is not working as expected. The connection parameters are set from the SLAU272D, table 18-5. Intent was to use the third to last row since it has the lowest error percentages.

The transmit flag (UCA0IFG&UCTXIFG) never changes, and the byte never leaves the UART (as far as I can tell). Also, the LED never blinks when sending data to the CDC/Serial port on PC.

I have pasted the relevant code below.

int main(void)
{
     WDTCTL = WDTPW | WDTHOLD;	// stop watchdog timer
	
//Set clock speed
    CSCTL0_H = 0xA5; //Enable CS register access
    CSCTL1 |= DCOFSEL1 + DCORSEL; //Set DCO setting to 20MHz

    // Sets the MCLK source to DCOCLK,
    // the SMCLK source to DCOCLK,
    // and the ACLK source to VLOCLK
    CSCTL2 = SELM0 + SELM1 + SELS0 + SELS1 + SELA0;

    // Sets the MCLK clock divider to 0 to divide by 1,
    // the SMCLK clock divider to  0 to divide by 1,
    // and the ACLK clock divider to  0 to divide by 1,
    CSCTL3 &= 0x00;

    // Enables conditional module requests for
    // MCLK, SMCLK, and ACLK
    CSCTL6 |= MCLKREQEN + SMCLKREQEN + ACLKREQEN;

    Commanding_Initialize();

    uint8_t data[3];
    data[0] = 0x43;
    data[1] = 0x44;
    data[2] = 0x0A;

    while(1)
    {
        Commanding_Transmit(0x44, 3, data);
    }

return 0;
}

void Commanding_Initialize()
{
    P2DIR |= BIT0 | BIT1; //RX + TX Pins

    PJDIR |= BIT1 | BIT2; //LED

    UCA0CTL0 = UCSWRST; // Reset UART registers
    UCA0CTL0 |= (UCSSEL1 | UCSSEL0); // Set UCSSELx to 11b  (SMCLK)

    UCA0BRW = 10; //UCAxBRW = 10
    UCA0MCTLW_L = 0xD0 | UCOS16; //BRFx = 13 + Enable oversampling
    UCA0MCTLW_H = 0xAD; //BRS = 0xAD

    UCA0CTL1 &= ~UCSWRST; // release from reset
    UCA0IE |= UCTXIE | UCRXIE; // Enable RX interrupt
}

void Commanding_Transmit(uint8_t command, uint8_t length, uint8_t* data)
{
    //Transmit command id
    UCA0TXBUF = command;

    while (!(UCA0IFG&UCTXIFG)); //Wait for buffer to be ready

    uint8_t i = 0;

    //Transmit data
    for(i = 0; i < length; i++)
    {
        UCA0TXBUF = data[i];
        while (!(UCA0IFG&UCTXIFG)); //Wait for buffer to be ready
    }

    PJOUT ^= BIT2;
}

#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
{
    switch(__even_in_range(UCA0IV,0x08))
    {
        case 0:break; // Vector 0 - no interrupt
        case 2: // Vector 2 - RXIFG
        {
            uint8_t rxChr = 0;
            rxChr = UCA0RXBUF;

            PJOUT ^= BIT1;
            break;
        }
        case 4:break; // Vector 4 - TXIFG

        default: break;
    }
}

Any help is appreciated.

**Attention** This is a public forum