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.

RTOS/MSP430F5529: Trying to use two UARTs in the same program

Part Number: MSP430F5529

Tool/software: TI-RTOS

Using CCS 6.1.3 and TI-RTOS for MSP43x 2.20.0.06 with a 5529 Launchpad.

In the booster pack connection diagram, pins 3.4 and 3.3 are marked "UART RX" and "UART TX" respectively. I'm trying to get these pins to work as a UART to communicate to another microcontroller while using the standard UART to talk over the USB connection to the Launchpad. I'd also like to use TI-RTOS functions since I don't have much experience with low level microprocessor programming.

I've looked at forum question e2e.ti.com/.../421987 and attempted to use it as a model. The code in the forum question doesn't look quite the same as the code in my *5529.c and *5529.h, but I tried to do something analogous. I've also looked at e2e.ti.com/.../581883 but couldn't figure out how to make it apply. The code in *5529.c is different and if I paste the code from the forum question in it doesn't compile.

These are the changes I've made to my *5529.c and *5529.h files:

const UARTUSCIA_HWAttrs uartUSCIAHWAttrs[MSP_EXP430F5529LP_UARTCOUNT] = {
	    {
	        .baseAddr = USCI_A1_BASE,
	        .clockSource = USCI_A_UART_CLOCKSOURCE_SMCLK,
	        .bitOrder = USCI_A_UART_LSB_FIRST,
	        .numBaudrateEntries = sizeof(uartUSCIABaudrates)/sizeof(UARTUSCIA_BaudrateConfig),
	        .baudrateLUT = uartUSCIABaudrates
	    },
	    {
	        .baseAddr = USCI_A0_BASE,
	        .clockSource = USCI_A_UART_CLOCKSOURCE_SMCLK,
	        .bitOrder = USCI_A_UART_LSB_FIRST,
	        .numBaudrateEntries = sizeof(uartUSCIABaudrates)/sizeof(UARTUSCIA_BaudrateConfig),
	        .baudrateLUT = uartUSCIABaudrates
	    }, /* JDL second UART see e2e.ti.com/.../421987 */
};

const UART_Config UART_config[] = {
	    {
	        .fxnTablePtr = &UARTUSCIA_fxnTable,
	        .object = &uartUSCIAObjects[0],
	        .hwAttrs = &uartUSCIAHWAttrs[0]
	    },
	    {
	        .fxnTablePtr = &UARTUSCIA_fxnTable,
	        .object = &uartUSCIAObjects[1],
	        .hwAttrs = &uartUSCIAHWAttrs[1]
	    }, /* JDL second UART see e2e.ti.com/.../421987 */
    {NULL, NULL, NULL}
};

and here (this is the part that looks different from the other questions):

void MSP_EXP430F5529LP_initUART(void)
{
    /* P4.4,5 = USCI_A1 TXD/RXD */
    GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P4,
        GPIO_PIN4 | GPIO_PIN5);

    /* P3.3,4 = USCI_A0 TXD/RXD */
    GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P3,
        GPIO_PIN3 | GPIO_PIN4);
    /* JDL second UART see e2e.ti.com/.../421987 */

    /* Initialize the UART driver */
    UART_init();
}

In *5529.h:

typedef enum MSP_EXP430F5529LP_UARTName {
    MSP_EXP430F5529LP_UARTA1 = 0,
    MSP_EXP430F5529LP_UARTA0 = 1, /* JDL 2nd UART */
    MSP_EXP430F5529LP_UARTCOUNT
} MSP_EXP430F5529LP_UARTName;

In Board.h:

#define Board_UART0                 MSP_EXP430F5529LP_UARTA1
#define Board_UART1                 MSP_EXP430F5529LP_UARTA0	/* JDL 2nd UART e2e.ti.com/.../

I'm sure I'm doing something hilariously wrong, or missed a comma somewhere. 

When I run my code (shown below) Board_UART0 opens and work fine, but Board_UART1 returns a null pointer.

    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readReturnMode = UART_RETURN_NEWLINE;   // string is read until it reaches a newline
    uartParams.readEcho = UART_ECHO_OFF;
    uartParams.baudRate = 9600;
    uartPC = UART_open(Board_UART0, &uartParams);
    uartParams.baudRate = 38400;  // to collector board
    uartCB = UART_open(Board_UART1, &uartParams);

I attached my project (I hope that works how I expect it to). Any clues on how to get that second UART to work in TI-RTOS?

6507.uart_problem_project.zip