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.

TI-RTOS UART example issues

Other Parts Discussed in Thread: MSP430F5438A, MSP430F5529

Hello,

I am trying to use TI-RTOS and its UART drivers to control all UART peripherals on the MSP430F5438A. I have successfully configured the TI-RTOS UART example to run on the MCU, using the default USCI A1 port. However, when changing it to other ports such as A0 (by configuring the UARTUSCIA_HWAttrs structure and the initUART function), the task hangs on Hwi57 (which contains a while(1) infinite loop) once the UART_write function is called. ROV reports no errors right before its call.

I do not attempt to setup interrupt 57 myself. The example is properly configured and it is working with its default A1 port.
Could it be that I am missing some other configuration ?

Thank you for your help,
Cristian

  • Hi Cristian,
    Can you tell me what version of TI-RTOS you are using an attach your modified board .c file?
    Thanks,
    Janet
  • Hi Janet,

    I am using TI-RTOS version 2.16. I have attached the board.c file.0044.MSP_EXP430F5529LP.c I did not change the MSP430F5529LP functions and macros names.
    I should add that the A0 uart port works using bare metal code. Similarly, the I2C example does not work and the SDSPI FatFs demo only works on ports A0, A1, B0, B1, while the code does not even generate SCK signal on A2, A3, B2, B3.

    But, back to the UART example, I suspect it is a driver problem. To port TI-RTOS on the MSP430F5438A, I followed this tutorial: . I added the MCU to the DEVLIST in the tirtos.mak, compiled the drivers, imported the 5529LP example and changed its device and target general properties (in the main and RTSC tabs). The project still links to "roducts/msp430_driverlib_2_21_00_08a/driverlib/MSP430F5xx_6xx/ccs/MSP430F5529.lib". There is no MSP430F5438A.lib even after the driver compilation.

    What other changes would you suggest making ? Does the board.c file look ok ? Since it is the uart demo, I only changed the UART section.
    Thank you for your help !

    Cristian

  • Hi Christian,

    It looks like you need to rebuild the driverlib with the command

    gmake -f tirtos.mak build-ccs-msp430-driverlib

    Unfortunately, in TI-RTOS 2.16, there are some bugs in the makefiles that affect Windows builds.  I am attaching two makefiles that you can replace the files you have here:

        tirtos_msp43x_2_16_01_14/products/msp430_driverlib_2_21_00_08a/driverlib\MSP430F5xx_6xx/Makefile

        tirtos_msp43x_2_16_01_14\products\msp430_driverlib_2_21_00_08a\makedefs

    (Please backup the original ones).

    7776.Makefile.txt

    8233.makedefs.txt

    Best regards,

        Janet

  • Hi Janet,

    I rebuilt the drivers using build-ccs-msp430-driverlib. Indeed, the MSP430F5438A.lib is now generated, and I have added it in the file search path of the linking properties. However the uart example behaves the same, hanging on hw57 with anything but A1.
    I am developing on Linux, so the makefiles were ok.

    Cristian
  • Hi Cristian,

    I can get the UART echo example working with USCI A1 with a change to the port and pins in the board file.  I used this:

        GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P5,
            GPIO_PIN6 | GPIO_PIN7);

    To use A0, you need to change the interrupt in the .cfg file.  I think it is 57:

    halHwi.create(57, "&UARTUSCIA_hwiIntFxn", hwiParams);


    However, I still haven't got it to work yet, but I'm no longer stuck at the Hwi interrupt 57 handler.

    I'll look into this some more tomorrow.

    Best regards,

        Janet

  • Hi Janet,

    I tried your suggestion and it worked ! 

    The UART is now functional on both A0 and A1 ports. Here are the working configurations, should they be of need to others:

    .cfg file:

    var hwiParams0 = new halHwi.Params();
    hwiParams0.arg = 0;
    halHwi.create(57, "&UARTUSCIA_hwiIntFxn", hwiParams0);
    
    var hwiParams1 = new halHwi.Params();
    hwiParams1.arg = 1;
    halHwi.create(46, "&UARTUSCIA_hwiIntFxn", hwiParams1);

    board.c file:

    const UARTUSCIA_HWAttrs uartUSCIAHWAttrs[MSP_EXP430F5529LP_UARTCOUNT] = {
        {
            .baseAddr = USCI_A0_BASE,
            .clockSource = USCI_A_UART_CLOCKSOURCE_SMCLK,
            .bitOrder = USCI_A_UART_LSB_FIRST,
            .numBaudrateEntries = sizeof(uartUSCIABaudrates)/sizeof(UARTUSCIA_BaudrateConfig),
            .baudrateLUT = uartUSCIABaudrates
        },
    	{
    		.baseAddr = USCI_A1_BASE,
    		.clockSource = USCI_A_UART_CLOCKSOURCE_SMCLK,
    		.bitOrder = USCI_A_UART_LSB_FIRST,
    		.numBaudrateEntries = sizeof(uartUSCIABaudrates)/sizeof(UARTUSCIA_BaudrateConfig),
    		.baudrateLUT = uartUSCIABaudrates
    	},
    };
    
    const UART_Config UART_config[] = {
        {
            .fxnTablePtr = &UARTUSCIA_fxnTable,
            .object = &uartUSCIAObjects[0],
            .hwAttrs = &uartUSCIAHWAttrs[0]
        },
    	{
    		.fxnTablePtr = &UARTUSCIA_fxnTable,
    		.object = &uartUSCIAObjects[1],
    		.hwAttrs = &uartUSCIAHWAttrs[1]
    	},
        {NULL, NULL, NULL}
    };
    
    void MSP_EXP430F5529LP_initUART(void)
    {
        /* P4.4,5 = USCI_A1 TXD/RXD */
        GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P3,
            GPIO_PIN4 | GPIO_PIN5);
    
        GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P5,
                GPIO_PIN7 | GPIO_PIN6);
    
        /* Initialize the UART driver */
        UART_init();
    }

    board.h file:

    typedef enum MSP_EXP430F5529LP_UARTName {
        MSP_EXP430F5529LP_UARTA0 = 0,
    	MSP_EXP430F5529LP_UARTA1,
    
        MSP_EXP430F5529LP_UARTCOUNT
    } MSP_EXP430F5529LP_UARTName;

    Board.h file:

    #define Board_UART0                 MSP_EXP430F5529LP_UARTA0
    #define Board_UART1                 MSP_EXP430F5529LP_UARTA1

    Thank you so much for your help !
    Now I will see to porting the I2C and FatFs SDSPI examples. The SDSPI one seems to work only on A0, A1, B0, B1 but it does not hang on an Hwi with the other USCIs. I will create another thread if things don't go well :).

    Cristian