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.

LAUNCHXL-CC1312R1: Using both UARTS on CC1312R1 issue

Part Number: LAUNCHXL-CC1312R1
Other Parts Discussed in Thread: SYSCONFIG

Hello,

I am trying to use both UARTs available on CC1312R1, however, it does not work as expected.

UART0 is configured for the Display driver (for logging) and UART1 for communicating with an external device. These are the configs that I am using:


/*
 *  ============================= Display =============================
 */

#include <ti/display/Display.h>
#include <ti/display/DisplayUart.h>

#define CONFIG_Display_COUNT 1

#define Display_UARTBUFFERSIZE          1024
static char displayUARTBuffer[Display_UARTBUFFERSIZE];

DisplayUart_Object displayUartObject;

const DisplayUart_HWAttrs displayUartHWAttrs = {
    .uartIdx      = CC1312R1_LAUNCHXL_UART0,
    .baudRate     = 2000000,
    .mutexTimeout = (unsigned int)(-1),
    .strBuf       = displayUARTBuffer,
    .strBufLen    = Display_UARTBUFFERSIZE
};

const Display_Config Display_config[CONFIG_Display_COUNT] = {
    /* CONFIG_Display_0 */
    /* XDS110 UART */
    {
        .fxnTablePtr = &DisplayUartMin_fxnTable,
        .object      = &displayUartObject,
        .hwAttrs     = &displayUartHWAttrs
    },
};

const uint_least8_t Display_count = CONFIG_Display_COUNT;
/*
 *  =============================== UART ===============================
 */
#include <ti/drivers/UART.h>
#include <ti/drivers/uart/UARTCC26X2.h>

#include <ti/drivers/uart/UARTCC26XX.h>
#include <ti/drivers/Power.h>
#include <ti/drivers/power/PowerCC26X2.h>
#include <ti/devices/cc13x2_cc26x2/inc/hw_memmap.h>
#include <ti/devices/cc13x2_cc26x2/inc/hw_ints.h>


UARTCC26X2_Object uartCC26X2Objects[CC1312R1_LAUNCHXL_UARTCOUNT];

uint8_t uartCC26X2RingBuffer[CC1312R1_LAUNCHXL_UARTCOUNT][32];

const UARTCC26X2_HWAttrs uartCC26X2HWAttrs[CC1312R1_LAUNCHXL_UARTCOUNT] = {
    {
        .baseAddr       = UART0_BASE,
        .intNum         = INT_UART0_COMB,
        .intPriority    = ~0,
        .swiPriority    = 0,
        .flowControl    = UARTCC26X2_FLOWCTRL_NONE,
        .txPin          = IOID_16,
        .rxPin          = PIN_UNASSIGNED,
        .ctsPin         = PIN_UNASSIGNED,
        .rtsPin         = PIN_UNASSIGNED,
        .ringBufPtr     = uartCC26X2RingBuffer[CC1312R1_LAUNCHXL_UART0],
        .ringBufSize    = sizeof(uartCC26X2RingBuffer[CC1312R1_LAUNCHXL_UART0]),
        .txIntFifoThr   = UARTCC26X2_FIFO_THRESHOLD_1_8,
        .rxIntFifoThr   = UARTCC26X2_FIFO_THRESHOLD_4_8,
        .errorFxn       = NULL
    },

    {
        .baseAddr       = UART1_BASE,
        .intNum         = INT_UART1_COMB,
        .intPriority    = ~0,
        .swiPriority    = 0,
        .flowControl    = UARTCC26X2_FLOWCTRL_HARDWARE,
        .txPin          = IOID_19,
        .rxPin          = IOID_18,
        .ctsPin         = IOID_22,
        .rtsPin         = IOID_28,
        .ringBufPtr     = uartCC26X2RingBuffer[CC1312R1_LAUNCHXL_UART1],
        .ringBufSize    = sizeof(uartCC26X2RingBuffer[CC1312R1_LAUNCHXL_UART1]),
        .txIntFifoThr   = UARTCC26X2_FIFO_THRESHOLD_1_8,
        .rxIntFifoThr   = UARTCC26X2_FIFO_THRESHOLD_4_8,
        .errorFxn       = NULL
    }
};

const UART_Config UART_config[CC1312R1_LAUNCHXL_UARTCOUNT] = {
    {
        .fxnTablePtr = &UARTCC26X2_fxnTable,
        .object      = &uartCC26X2Objects[CC1312R1_LAUNCHXL_UART0],
        .hwAttrs     = &uartCC26X2HWAttrs[CC1312R1_LAUNCHXL_UART0]
    },
    {
        .fxnTablePtr = &UARTCC26X2_fxnTable,
        .object      = &uartCC26X2Objects[CC1312R1_LAUNCHXL_UART1],
        .hwAttrs     = &uartCC26X2HWAttrs[CC1312R1_LAUNCHXL_UART1]
    }
};

const uint_least8_t UART_count = CC1312R1_LAUNCHXL_UARTCOUNT;

For initializing the display driver:

Display_Handle display;

Display_init();
display = Display_open(Display_Type_UART, NULL);
if (display) {
    LOG_ERR("UART Display driver initialized");
}

While for the UART1 the configs are as follows:

pSkyComs.baudRate = 9600;     
pSkyComs.readMode = UART_MODE_CALLBACK;        
pSkyComs.writeMode = UART_MODE_CALLBACK;       
pSkyComs.readCallback = UartRxCallbackFxn;    
pSkyComs.writeCallback = UartTxCallbackFxn;     
pSkyComs.readDataMode = UART_DATA_TEXT;         //Data is processed See:readReturnMode
pSkyComs.writeDataMode = UART_DATA_BINARY;      
pSkyComs.readReturnMode = UART_RETURN_NEWLINE;  //when read, return on '\n' or buffer full
pSkyComs.readEcho = UART_ECHO_OFF;
pSkyComs.parityType = UART_PAR_NONE;
pSkyComs.dataLength = UART_LEN_8;
pSkyComs.stopBits = UART_STOP_ONE;

The issue that I am facing is the following:

When Display_printf() is enabled together with the UART1, the program crashes after a while. This behavior is seen when I have enabled multiple Display_printf() statements for debugging and logging.

However, I need both UARTs to communicate with an external device as well as bale to debug the code? Since TI's SDK does not have any example on the usage of both UARTS, is there any configuration that 

I am missing or not set properly for both UART drivers to work in harmony. Please note I need to use 

#include <ti/drivers/uart/UARTCC26X2.h>

in order for the newline character which is expected by the external device for communicating properly. 

Any suggestions or samples to get this up and running?

Thanks

-Raj

...

  • Please provide information regarding what SDK version you are using, which example from the SDK you are using as a starting point, and how you have configured both the display driver and the UART through sysconfig (attached you sysConfig settings or share screenshots of how you have configured these peripherals).

    BR

    Siri