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/MSP430FR5994: Need to use multiple uarts with Launchpad

Part Number: MSP430FR5994


Tool/software: TI-RTOS

I am tryuing to use uart0 as intended and to add the use of uartA3, P6.0,6.1 to communicate with another processor.  I searched this forum and found an example for another pocessor that added in the additional uart.  The esxample is old and some adjustments had to be mad.  I did them and found that uartA0 still works but uartA3 does not.  The error appears to be an unimitialized variable somewhere in the heirarchy.  To simplify things I tried to convert the uartecho example from UARTA) to UART A3.  When I do this I get a message on program load that states "Received exception from ROV server: Target memory read failed at address 0xffffffff length 128. This read is at an INVALID addreess according to the application map..  The application is likely either uninitialized or corrupt."

I believe that I have missed something in the conversion but cannot find it.

I am using CCSV7 and tirtos_msp43x_2_20_00_06.  All the changes were made to the base uartecho example which does work.

The changes I made are below.  Any help would be appreciuated.  Thanks

msp430fr5994.h

#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
#define EUSCI_A3_VECTOR ".int24" /* 0xFFC0 */
#else
#define EUSCI_A3_VECTOR (24 * 1u) /* 0xFFC0 */
#endif


#ifdef __ASM_HEADER__ /* Begin #defines for assembler */
#define EUSCI_A0_VECTOR ".int48" /* 0xFFF0 */
#else
#define EUSCI_A0_VECTOR (48 * 1u) /* 0xFFF0 */
#endif

Board.h

#define Board_UART3 MSP_EXP430FR5994_UARTA3

uartechoA3B.c

/* Create a UART with data processing off. */
UART_Params_init(&uartParams);
uartParams.writeDataMode = UART_DATA_BINARY;
uartParams.readDataMode = UART_DATA_BINARY;
uartParams.readReturnMode = UART_RETURN_FULL;
uartParams.readEcho = UART_ECHO_OFF;
uartParams.baudRate = 9600;
uart = UART_open(Board_UART3, &uartParams);


uartechoA3B.cfg

var hwiParams = new halHwi.Params();

hwiParams.arg = 0;
halHwi.create(24, "&UARTEUSCIA_hwiIntFxn", hwiParams);

MSP_EXP430FR5994.c

/*
* =============================== UART ===============================
*/
/* Place into subsections to allow the TI linker to remove items properly */
#if defined(__TI_COMPILER_VERSION__)
#pragma DATA_SECTION(UART_config, ".const:UART_config")
#pragma DATA_SECTION(uartEUSCIAHWAttrs, ".const:uartEUSCIAHWAttrs")
#endif

#include <ti/drivers/UART.h>
#include <ti/drivers/uart/UARTEUSCIA.h>

UARTEUSCIA_Object uartEUSCIAObjects[MSP_EXP430FR5994_UARTCOUNT];

/*
* The baudrate dividers were determined by using the MSP430 baudrate
* calculator
* software-dl.ti.com/.../index.html
*/
const UARTEUSCIA_BaudrateConfig uartEUSCIABaudrates[] = {
/* {baudrate, input clock, prescalar, UCBRFx, UCBRSx, oversampling} */
{
.outputBaudrate = 115200,
.inputClockFreq = 8000000,
.prescalar = 4,
.hwRegUCBRFx = 5,
.hwRegUCBRSx = 85,
.oversampling = 1
},
{9600, 8000000, 52, 1, 0, 1},
{9600, 32768, 3, 0, 3, 0},
};

const UARTEUSCIA_HWAttrs uartEUSCIAHWAttrs[MSP_EXP430FR5994_UARTCOUNT] = {
{
.baseAddr = EUSCI_A3_BASE,
.clockSource = EUSCI_A_UART_CLOCKSOURCE_SMCLK,
.bitOrder = EUSCI_A_UART_LSB_FIRST,
.numBaudrateEntries = sizeof(uartEUSCIABaudrates)/sizeof(UARTEUSCIA_BaudrateConfig),
.baudrateLUT = uartEUSCIABaudrates
},
};

const UART_Config UART_config[] = {
{
.fxnTablePtr = &UARTEUSCIA_fxnTable,
.object = &uartEUSCIAObjects[0],
.hwAttrs = &uartEUSCIAHWAttrs[0]
},
{NULL, NULL, NULL}
};

/*
* ======== MSP_EXP430FR5994_initUART ========
*/
void MSP_EXP430FR5994_initUART(void)
{
/* P6.0,1 = EUSCI_A3 TXD/RXD */
GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P6,
GPIO_PIN0, GPIO_SECONDARY_MODULE_FUNCTION);
GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P6,
GPIO_PIN1, GPIO_SECONDARY_MODULE_FUNCTION);

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


MSP_EXP430FR5994.h

typedef enum MSP_EXP430FR5994_UARTName {
MSP_EXP430FR5994_UARTA3 = 0,

MSP_EXP430FR5994_UARTCOUNT
} MSP_EXP430FR5994_UARTName;

  • Hi Frank,

    Do you think you could share your project so I can take a better look at this?

    Thanks,
    Gerardo
  • Frank,

    I think I have an idea why your UART may not be working, on your MSP_EXP430FR5994_initUART when you call GPIO_setAsPeripheralModuleFunctionOutputPin() you should set the mode to GPIO_PRIMARY_MODULE_FUNCTION for P6.0 & P6.1, as such:

    GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P6,
        GPIO_PIN0, GPIO_PRIMARY_MODULE_FUNCTION);
    GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P6,
        GPIO_PIN1, GPIO_PRIMARY_MODULE_FUNCTION);

    Thanks,
    Gerardo

  • Gerado,

    Thanks for your quick response. Unfortunately, even though selecting the PRIMARY function certainly needed to be done there must be something else as well as I still get the same error message in ROV on program load and initialization.

    I have zipped up the project and at5518.uartecho_MSP_EXP430FR5994_TIA3B.ziptached it as you requested in your previous reply.

  • Frank,

    Did you modify msp430fr5994.h?

    Thanks,
    Gerardo
  • No, I do not believe so.  If I did it was inadvertent.  I did have the file open as that is where I find the interrupt numbers.  As a check can you send me a clean copy? I can then check mine against it with winmerge.  The file date on msp430fr5994.h in C:\ti\ccsv7\ccs_base\msp430\include is the same as all the others, 11/23/2016 so I expect that no changes were made.

    Thanks

    Frank

  • Frank,

    That should be OK then. I suggest starting from the UART echo example again and doing the following.  Import the UART echo example and make sure it builds. Then do the following modifications:

    Change on MSP_EXP430FR5994.c

    const UARTEUSCIA_HWAttrs uartEUSCIAHWAttrs[MSP_EXP430FR5994_UARTCOUNT] = {
        {
            .baseAddr = EUSCI_A3_BASE,
            .clockSource = EUSCI_A_UART_CLOCKSOURCE_SMCLK,
            .bitOrder = EUSCI_A_UART_LSB_FIRST,
            .numBaudrateEntries = sizeof(uartEUSCIABaudrates)/sizeof(UARTEUSCIA_BaudrateConfig),
            .baudrateLUT = uartEUSCIABaudrates
        },
    };

    and

    void MSP_EXP430FR5994_initUART(void)
    {
        /* P2.0,1 = EUSCI_A0 TXD/RXD */
        GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P6,
            GPIO_PIN0, GPIO_PRIMARY_MODULE_FUNCTION);
        GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P6,
            GPIO_PIN1, GPIO_PRIMARY_MODULE_FUNCTION);
    
        /* Initialize the UART driver */
        UART_init();
    }

    Change on MSP_EXP430FR5994.h

    typedef enum MSP_EXP430FR5994_UARTName {
        MSP_EXP430FR5994_UARTA3 = 0,
    
        MSP_EXP430FR5994_UARTCOUNT
    } MSP_EXP430FR5994_UARTName;

    Change on Board.h

    #define Board_UART3                 MSP_EXP430FR5994_UARTA3

    Change on uartecho.cfg

    halHwi.create(24, "&UARTEUSCIA_hwiIntFxn", hwiParams);

    Change on uartecho.c

    uart = UART_open(Board_UART3, &uartParams);

    That's what I did to get UART 3 to echo.

    Let me know if that works,
    Gerardo

  • Gerado,

    This works.  Thank you very much.  I investigated what might have been wrong with my previous program, still don't know as I had made all of the changes above and it still failed.  I have done a number of hardware software/ projects and my experience tells me that it is almost  never the hardware.  In thus case mixed results.  Something was wrong with P6 1 and 0 on the board that I was using.  The last piece that had to fall into place was using a fresh board.  Thar being said, the version that I checked against yours still fails, yours doesn't.  I will use this as the basis for the code that I really need to write.

    Thanks again.

    Frank

  • Frank,

    Yea I tried to import your program and I was having some issues with it that's why I decided to start from the example again. I did diff your files to what I had and it was almost the same so at the moment I can't really explain what was wrong there. But I'm glad you have a working project now.

    Thanks,
    Gerardo