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.

MSP430F1612: UART0 Configuration not working

Part Number: MSP430F1612
Other Parts Discussed in Thread: DRV8842EVM

Hello,

I am try to configure UART0 on the DRV8842EVM board, which has a MSP430F1612.

I can see the characters on the P3.5/URXD0 pin.

The RXBUF never changes and it never triggers the interrupt.

P3SEL = 0x30; // P3.5=TX(RS232 MOSI), P3.4=RX(RS232 MISO)

// Config UART
U0CTL = SWRST; // Leave SWRST high during config
U0CTL = CHAR | SWRST; // 8-N-1 UART, SWRST
U0TCTL = 0x30; // SMCLK = 8 MHz
// U0BR0 = 0xA1; // 417 = 0x01A1, 8MHz / 417 = 19184.65
// U0BR1 = 0x01;
U0BR0 = 0x08; // 8MHz / 8 = 1MHz for FT232R USB XCVR
U0BR1 = 0x00;
ME1 = URXE0 | UTXE0; // Enable receive and transmit
IE1 = URXIE0; // Enable Rx interrupt only (for now)
U0CTL &= ~SWRST; // Clear SWRST

Please advise.

Thanks,

Emmett

  • I think something is wrong with the baud rate.

    I intended it to be SMCLK/8 = 8MHz/8 = 1MHz.

    I started sending TX bytes and it looks like it's 100kHz.

    Does this have something to do with U0MCTL?

    I have U0MCTL = 0.

    Thanks,

    Emmett

  • Hi Emmett,

    First I would double check your UART baud rate settings.

    You can use this calculator to come up with correct values:

    https://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSP430BaudRateConverter/index.html

    Regarding interrupts, do you have the global interrupt enabled GIE = 1?

  • Hi Dennis,

    Thanks for your reply.

    I do enable GIE a little further down.

    I ran that calculator and it looks like I have those baud settings, but the baud rate on the TX looks like 100kHz instead of 1MHz.

    I don't see anything about overSampling wrt baud rate generation.

    Thanks,

    Emmett

    // Config UART
    U0CTL = SWRST; // Leave SWRST high during config
    U0CTL = CHAR | SWRST; // 8-N-1 UART, SWRST
    U0TCTL = 0x30; // SMCLK = 8 MHz
    // U0BR0 = 0xA1; // 417 = 0x01A1, 8MHz / 417 = 19184.65
    // U0BR1 = 0x01;
    U0BR0 = 0x08; // 8MHz / 8 = 1MHz for FT232R USB XCVR
    U0BR1 = 0x00;
    U0MCTL = 0x00; // Modulation Control bits
    ME1 = URXE0 | UTXE0; // Enable receive and transmit
    U0CTL &= ~SWRST; // Clear SWRST
    IE1 = URXIE0; // Enable Rx interrupt only (for now)

    // Config Timer B for PWM (DRV8842EVM)
    TBCTL = 0x01D2; // ACLK /8, Up mode, TBIFG interrupt enabled
    __bis_SR_register(GIE); // enable non-maskable interrupts

  • Hi Emmett,

    Try configuring the UART for 115200 and measure the bit rate frequency.

  • Hi Emmett,

    It's been a few days since I have heard from you so I’m assuming you were able to resolve your issue.
    I will mark this posting as RESOLVED. If this isn’t the case, please click the "This did NOT resolve my issue" button and reply to this thread with more information.
    If this thread locks, please click the "Ask a related question" button and in the new thread describe the current status of your issue and any additional details you may have to assist us in helping to solve your issues.

  • I should be able to try that tomorrow. 

    Thanks,

    Emmett

  • Hi Emmett,

    It's been a few days since I have heard from you so I’m assuming you were able to resolve your issue.
    I will mark this posting as RESOLVED. If this isn’t the case, please click the "This did NOT resolve my issue" button and reply to this thread with more information.
    If this thread locks, please click the "Ask a related question" button and in the new thread describe the current status of your issue and any additional details you may have to assist us in helping to solve your issues.

**Attention** This is a public forum