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.

MSP430 TI_RTOS UART_open with baudrate 19200

Other Parts Discussed in Thread: MSP430F5529, MSP430F5438A, SYSBIOS

Hi All,

I need to use the uart with baudrate 19200.

I saw the MSP_EXP430F5529LP.c the table

const UARTUSCIA_BaudrateConfig uartUSCIABaudrates[] = {
/* {baudrate, input clock, prescalar, UCBRFx, UCBRSx, oversampling} */
{
.outputBaudrate = 115200,
.inputClockFreq = 8192000,
.prescalar = 4,
.hwRegUCBRFx = 7,
.hwRegUCBRSx = 0,
.oversampling = 1
},
{9600, 8192000, 53, 5, 0, 1},
{9600, 32768, 3, 0, 3, 0},
};

where baudrate 19200 is missing.

I added the line for 19200 with the data from the application note regarding UART config.

{19200, 8192000, 26, 1, 0, 1},

but the uart is not working :-(

Someone works with different params?

Thanks

Fabio

  • Hi Fabio,

    This issue seems to be related to the relationship between your clock frequency settings for UART and the actual frequency of your ACLK/SMCLK frequency. The following threads may be helpful. Also, I'm moving your post into our TI-RTOS forum to make sure you get the best support here.

    Regards,

    James

    MSP Customer Applications

  • Our team here believes you may have used the wrong value for firstModReg. Its should be 11. This value yields the following for 19.2K:

    {19200, 8192000, 26, 11, 0, 1},

    We used this tool to determine these settings:

    software-dl.ti.com/.../index.html

    Alan
  • In the calculator, you'll have to select "Custom" for Clock and enter "8192000" instead of selecting "8M".

    Regards,

    James

    MSP Customer Applications

  • Thanks James and Alan

    I modified the table with your suggestions but the uart does not stil work.

    The registers configuration after the UART_open are as the following

    UCA0CTLW0 0x0080
    UCA0CTL0 0x00
    UCA0CTL1 0x80
    UCA0BRW 0x001A
    UCA0BR0 0x1A
    UCA0BR1 0x00
    UCA0MCTL 0xB1
    UCA0STAT 0x24
    UCA0RXBUF 0x6B
    UCA0TXBUF 0x00
    UCA0ABCTL 0x00
    UCA0IRCTL 0x0000
    UCA0IRTCTL 0x00
    UCA0IRRCTL 0x00
    UCA0ICTL 0x0300
    UCA0IE 0x00
    UCA0IFG 0x03
    UCA0IV 0x0000

    The CLK value are:

    System_printf("SMCLK=%ld [Hz]\n",UCS_getSMCLK());
    System_printf("ACLK=%ld [Hz]\n",UCS_getACLK());
    System_printf("MCLK=%ld [Hz]\n",UCS_getMCLK());

    SMCLK=3145728 [Hz]
    ACLK=3178496 [Hz]
    MCLK=3145728 [Hz]

    Any other suggestions?
    thanks
    Fabio
  • Just to be clear, your device is an MSP430F5529, correct?

    Do any other baudrates work?

    When you say it doesn't work, does the UART_open() call return a non-null handle successfully?


    Alan

  • Hi Alan,

    my device is the MSP430F5438A and Iàm developing on the evaluation board.

    But I started from a project created for the MSP430F5529 with TI-RTOS because I didn't found 

    a TI-RTOS project for my device.

    I made come modifications to adapt the my application ...

    System.extendedFormats = '%$L%$S%s%$F%f';

    // uart0
    hwiParams.arg = 0;
    halHwi.create(57, "&UARTUSCIA_hwiIntFxn", hwiParams);

    // uart3
    hwiParams.arg = 3;
    halHwi.create(44, "&UARTUSCIA_hwiIntFxn", hwiParams);

    // timer 0
    hwiParams.arg = 0;
    halHwi.create(54, "&ti_sysbios_family_msp430_Timer_periodicStub__E", hwiParams);

    Both UART work fine with baudrate 9600 applying the table 

    {9600, 8192000, 53, 5, 0, 1},

    Initially the UART_open() returned FAIL but after I had introduced the line 

    {19200, 8192000, 26, 11, 0, 1},

    in the 

    const UARTUSCIA_BaudrateConfig uartUSCIABaudrates[]

    the UART_open() works correctly .... but  the first 

    UART_write ( .... )

    does not work correctly as the UART was not working at right baudrate.

    Thanks

    Fabio

  • before the UART_open() call this is the printed value ..

    SMCLK=-1094844416 [Hz]
    ACLK=-1094811648 [Hz]
    MCLK=-1094844416 [Hz]


    ????
  • Hi,

    the UART works fine at 19200 with the {19200, 8192000, 26, 11, 0, 1}, parameters.

    We checked with oscilloscope ;-)

    But always the UART_write() fails ... but I think it is another problem.

    Thank a lot for yur support for the baudrate params calculations

    Fabio

  • I'm glad its working. I didn't know what to try next.

    Please mark this thread answered if its appropriate.

    Allan
  • I don't see any RESOLVED button ... anly Verify Answer or Suggest Answer :-(
  • Oops. "Verify Answer" is what I should have said.


    Alan