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.

unable to configure baud rate and modulation on uca3 uart port on msp430bt5190

Hello,


I am  trying to increase the baud rate on uca3 from 9600 to 115200. Here is the current code that I have for the 9600 configuration( which works fine ):

unsigned divider = 104;
unsigned char fM = 1;
unsigned char sM = 0;

    /* Place UCA3 in Reset to be configured */
    UCA3CTL1 = UCSWRST;

    /* Configure */
    UCA3CTL1 = UCSSEL1;
    UCA3BR0 = divider & 0xFF;
    UCA3BR1 = divider >> 8;
    UCA3MCTL = ( (fM & 0xF) << 4 |(sM & 0x7) << 1);

    /* Take UCA3 out of reset */
    UCA3CTL1 &= ~UCSWRST;

I attempted to increase the baud rate to 115200. from the baud rate calculator i got the following settings:

    UCA3CTL1 |= UCSSEL1;
    UCA3BR0 = 0x08;
    UCA3BR1 = 0x00;
    UCA3MCTL = UCBRS_0 + UCBRF_0;

but i am unable to send character streams to the usca3 ports and trigger the appropriate interrupts. can you confirm that my settings are right for the 115200? if not what should they be and how can I figure them out in the future. specifically, how would i go about calculating the modulation for the baud rate and setting the UCAxMCTL register?

thanks.

  • I just wanted to make a edit that the clock that I am trying to select with UCSSEL1, which is the SMCLK that oscillates at 1MHz, and I would like to be able to calculate the modulation value for UCAxMTL, is there a procedure to do so for baud rates like 4800, 115200?

  • Hi Michael,

    The User's Guide (slau208n) has a table showing the register settings for different baudrates and different clock sources, and it includes the error associated with each settings.

    You can also try this wiki: processors.wiki.ti.com/.../USCI_UART_Baud_Rate_Gen_Mode_Selection

    It seems like your configuration is incorrect right now since you need UCxBRS=6 and UCxBRF=0, but please take in consideration that the error @115,200 and with 1Mhz source clock is quite high.
    Once you configure the registers, I recommend you to check the frequency with an oscilloscope, just to check if the MSP430 is the one with the problem or not.

    Regards,
    Luis R
  • Indeed, the error is quite high, but only critical for RX. TX should work well.
    However, the clock likely isn't exactly 1MHz.
    Without a crystal as reference for the FLL, the reference clock has some tolerance. Also, 1MHz isn't an exact multiple of 32768Hz (even if REFO would be exact). And finally, the DCO most likely can't produce exact 1MHz, which means that its output frequency is slightly off and will circle around 1MHz by FLL adjustment.
    All this may result in a baudrate that is to far off to communicate with the other side 8especially since the other side also won't be 100% exact).
    With my own 5438 and 115200Bd on default clock setup, it often works but sometimes doesn't. Maybe depending on ambient temperature.
    Using a crystal (32768Hz, or even a 16MHz crystal), the connection has become 100% reliable.
    It might also be sufficient to increase DCO frequency to 2 or 4MHz. It will significantly reduce the bit clock modulation error, even though the DCO itself won't be come more precise.

**Attention** This is a public forum