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.

CC2652RB: Dual UART Problem

Part Number: CC2652RB

Hi,

I am try to init both UARTS of CC2652RB. 

But only one of the INIT is ok, when one is opened the other won't open. I think there is some kind of conflict but can't figure out.

Here are the codes, init structures etc.

void UART0_init(int first)
{

    volatile int x=0;
       UART_Params uartParams;

       /* 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.readMode = UART_MODE_CALLBACK;
       uartParams.readCallback = &UART0_readCallback;
       uartParams.baudRate = 115200;
       uartParams.writeMode = UART_MODE_CALLBACK;
       uartParams.writeCallback = &UART0_writeCallback;
       h_uart_0 = UART_open(CONFIG_UART_0, &uartParams);

       if (h_uart_0 == NULL)
       {
          System_abort("Error opening the UART0");
          x=1;
       }

      UART_read(h_uart_0, input, 1); //activate a read 

}


void UART1_init(void)
{
    volatile int x=0;
    UART_Params uartParams1;

    /* Create a UART with data processing off. */
    UART_Params_init(&uartParams1);
    uartParams1.writeDataMode = UART_DATA_BINARY;
    uartParams1.readDataMode = UART_DATA_BINARY;
    uartParams1.readReturnMode = UART_RETURN_FULL;
    uartParams1.readEcho = UART_ECHO_OFF;
    uartParams1.readMode = UART_MODE_CALLBACK;
    uartParams1.readCallback = &UART1_readCallback;
    uartParams1.baudRate = 115200;
    uartParams1.writeMode = UART_MODE_CALLBACK;
    uartParams1.writeCallback = &UART1_writeCallback;
    h_uart_1 = UART_open(CONFIG_UART_1, &uartParams1);

    if (h_uart_1 == NULL)
    {
       System_abort("Error opening the UART 1");
       x=1;
    }


   UART_read(h_uart_1, inputx, 1); //activate a read 

}


Here is the code generated for the structs from SYSCFG, there is no PIN conflict or device conflict.

//ti_drivers_config.c
#define CONFIG_UART_COUNT 2

UARTCC26XX_Object uartCC26XXObjects[CONFIG_UART_COUNT];

static unsigned char uartCC26XXRingBuffer0[32];
static unsigned char uartCC26XXRingBuffer1[32];

static const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CONFIG_UART_COUNT] = {
  {
    .baseAddr           = UART0_BASE,
    .intNum             = INT_UART0_COMB,
    .intPriority        = (~0),
    .swiPriority        = 0,
    .powerMngrId        = PowerCC26XX_PERIPH_UART0,
    .ringBufPtr         = uartCC26XXRingBuffer0,
    .ringBufSize        = sizeof(uartCC26XXRingBuffer0),
    .rxPin              = IOID_2,
    .txPin              = IOID_3,
    .ctsPin             = PIN_UNASSIGNED,
    .rtsPin             = PIN_UNASSIGNED,
    .txIntFifoThr       = UARTCC26XX_FIFO_THRESHOLD_1_8,
    .rxIntFifoThr       = UARTCC26XX_FIFO_THRESHOLD_4_8,
    .errorFxn           = NULL
  },
  {
    .baseAddr           = UART1_BASE,
    .intNum             = INT_UART1_COMB,
    .intPriority        = (~0),
    .swiPriority        = 0,
    .powerMngrId        = PowerCC26X2_PERIPH_UART1,
    .ringBufPtr         = uartCC26XXRingBuffer1,
    .ringBufSize        = sizeof(uartCC26XXRingBuffer1),
    .rxPin              = IOID_12,
    .txPin              = IOID_13,
    .ctsPin             = PIN_UNASSIGNED,
    .rtsPin             = PIN_UNASSIGNED,
    .txIntFifoThr       = UARTCC26XX_FIFO_THRESHOLD_1_8,
    .rxIntFifoThr       = UARTCC26XX_FIFO_THRESHOLD_4_8,
    .errorFxn           = NULL
  },
};

const UART_Config UART_config[CONFIG_UART_COUNT] = {
    {   /* CONFIG_UART_0 */
        .fxnTablePtr = &UARTCC26XX_fxnTable,
        .object      = &uartCC26XXObjects[0],
        .hwAttrs     = &uartCC26XXHWAttrs[0]
    },
    {   /* CONFIG_UART_1 */
        .fxnTablePtr = &UARTCC26XX_fxnTable,
        .object      = &uartCC26XXObjects[1],
        .hwAttrs     = &uartCC26XXHWAttrs[1]
    },
};

const uint_least8_t UART_count = CONFIG_UART_COUNT;

  • Hello Umit,

    Which SDK and example are you using?

    Have you tried to debug in UART_open to verify if for example PIN_open fails?

    You can copy the UART driver files to your project to make debug easier. Copy:

    source\ti\drivers\uart\UARTCC26X2.c

    source\ti\drivers\uart\UARTCC26X2.h

    source\ti\drivers\UART.c

    source\ti\drivers\UART.h