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.

MSP430F6779 with TI-RTOS baud rate 115200 or 9600 with different MCLK

Other Parts Discussed in Thread: MSP430F6779

I am using MSP430F6779 with TI-RTOS and CCS 6.0 compiler. I try to run baud rate 115200 or 9600 with MCLK 23986000, the closest one to 24Mhz. The problem I run into is that UART_open always return "Error opening the UART". If I trace the code using CCS debug, I find that driver implementation function findBaudDividerIndex which search the following table can not find any entry because cpuFreq is 819200. But I have already have the following line in my .cfg file.  Can you help me how to set cpuFreq to other value so UART_open will not return any error?

Thanks.

BIOS.customCCOpts = "-vmspx --near_data=none --code_model=large --data_model=restricted -q --advice:power=1  --program_level_compile -g";
BIOS.cpuFreq.lo = 23986000;

const UARTEUSCIA_BaudrateConfig uartEUSCIABaudrates[] = {
    /* baudrate, input clock, prescalar, UCBRFx, UCBRSx, oversampling */
    {115200, 23986000, 13,   0, 0x21, 1},
    {57600, 23986000, 26,   0, 0x55, 1},
    {9600, 23986000, 156,   2, 0x6b, 1},
    {9600,   32768,   3,   0, 3, 0},
};

//////////////////UARTEUSCIA.C////////////////////////////////////////////////////////

static int32_t findBaudDividerIndex(UARTEUSCIA_BaudrateConfig const *table,
                                    uint32_t tableSize,
                                    uint32_t baudrate,
                                    uint32_t clockFreq)
{
    int32_t  index;

    Assert_isTrue((tableSize != 0) && (table != NULL), NULL);

    for (index = 0; index < tableSize; index++) {
        if ((table[index].outputBaudrate == baudrate) &&
            (table[index].inputClockFreq == clockFreq)) {
            return (index);
        }
    }
    return (-1);
}

  • Hi lin-00,

          In your UARTEUSCIA_HWAttrs in your MSP430F6779.c, you specify the clock source of the UART peripheral (SMCLK or ACLK). Setting BIOS.cpuFreq.lo doesn't affect SMCLK or ACLK. The MSP430 family has the ClockFreq's module that you can use to set SMCLK and ACLK. For example in your cfg file, the lines below will set SMCLK to x:

    var ClockFreqs = xdc.useModule('ti.sysbios.family.msp430.ClockFreqs');
    ClockFreqs.SMCLK = x;
    

    Also, the baud rate look up table value should come from the devices datasheet. I took a look at the datasheet of your device and the values you have in your code don't seem to match. You can get the right values from table 34-4 of the datasheet

    Let me know if you have other questions

    Moses