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.

Using multiple hardware UARTs with the driver

Other Parts Discussed in Thread: MSP430FR5969

I'm using MSP430FR5969 Launchpad, TI-RTOS 2.12 and CCS 6.1.

I'm trying to use 2 UARTs on the MSP430 with the TI-RTOS UART driver. It works for one of them when I pass Board_UART0 to the driver's UART_open() (Board_UART0 is #defined as MSP_EXP430FR5969LP_UARTA1, which is the only element in an enum of UART devices). Why does the enumeration of UARTs on the board only contain this one, even though I know this board has at least 2 hardware UARTs? Is there any workaround to use more than one UART?

  • Hi,

    To add another UART, you will need to add another UART entry to uartEUSCIAHWAttrs[] in MSP_EXP430FR5969LP.c:

    /* UART configuration structure */
    const UARTEUSCIA_HWAttrs uartEUSCIAHWAttrs[MSP_EXP430FR5969LP_UARTCOUNT] = {
        {
            EUSCI_A0_BASE,
            EUSCI_A_UART_CLOCKSOURCE_SMCLK,
            EUSCI_A_UART_LSB_FIRST,
            sizeof(uartEUSCIABaudrates)/sizeof(UARTEUSCIA_BaudrateConfig),
            uartEUSCIABaudrates
        },
        {
            EUSCI_A1_BASE,
            EUSCI_A_UART_CLOCKSOURCE_SMCLK,
            EUSCI_A_UART_LSB_FIRST,
            sizeof(uartEUSCIABaudrates)/sizeof(UARTEUSCIA_BaudrateConfig),
            uartEUSCIABaudrates
        },

    };

    Then add another entry in UARTConfig:

    const UART_Config UART_config[] = {
        {
            &UARTEUSCIA_fxnTable,
            &uartEUSCIAObjects[0],
            &uartEUSCIAHWAttrs[0]
        },
        {
            &UARTEUSCIA_fxnTable,
            &uartEUSCIAObjects[1],
            &uartEUSCIAHWAttrs[1]
        },

        {NULL, NULL, NULL}
    };

    In MSP_EXP430FR5969LP.h, add a new UART name:

    /*!
     *  @def    MSP_EXP430FR5969LP_UARTName
     *  @brief  Enum of UART names on the MSP_EXP430FR5969LP dev board
     */
    typedef enum MSP_EXP430FR5969LP_UARTName {
        MSP_EXP430FR5969LP_UARTA1 = 0,
        MSP_EXP430FR5969LP_UARTA0 = 1,
        MSP_EXP430FR5969LP_UARTCOUNT
    } MSP_EXP430FR5969LP_UARTName;

    And in Board.h,

    #define Board_UART1      MSP_EXP430FR5969LP_UARTA0

    The code I have added is in red.  Please let me know if you have problems with this (I haven't actually tried it out).

    Best regards,

        Janet

  • Your advice worked, when I also added pin multiplex options for the TX/RX pins (P2.5/P2.6) to the UART init function in MSP_EXP430FR5969LP.c

    (changes in red)

    /*

    *  ======== MSP_EXP430FR5969LP_initUART ========

    */

    void MSP_EXP430FR5969LP_initUART(void)

    {

       /* P4.4,5 = USCI_A1 TXD/RXD */

       GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2,

               GPIO_PIN0, GPIO_SECONDARY_MODULE_FUNCTION);

       GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P2,

               GPIO_PIN1, GPIO_SECONDARY_MODULE_FUNCTION);

       //ADDED:

       GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2,

               GPIO_PIN5, GPIO_SECONDARY_MODULE_FUNCTION);

       GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P2,

               GPIO_PIN6, GPIO_SECONDARY_MODULE_FUNCTION);

       /* Initialize the UART driver */

       UART_init();

    }

     

    Thanks!