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/SIMPLELINK-CC13X2-26X2-SDK: Using two UARTs in two tasks

Part Number: SIMPLELINK-CC13X2-26X2-SDK

Tool/software: TI-RTOS

Hi,

this maybe a duplicated thread, not sure my last one post or not.

I have an issue for using two uarts in CC1312. there was no problem using them in one task, but after moving UART1 to a new task, they stop working. any clue?

thanks,

-Yue

  • Yue,

    Could you provide us with some code snippets on what you are doing? There should be no direct problems in doing what you say you are doing.
  • Sorry for my delayed reply, unfortunately, i cannot share the code - i don't work for FBI, not a spy neither. just company policy. but i create a 'clean' version. the following code worked...but if i just create another task, and move ' funcUsedUart1 ();'to another task, after starting up
    ' retval = funcUsedUart0 ();' stopped...

    Void
    taskFxn (UArg a0, UArg a1)
    {
    int32_t retval = 0;

    /* Run config file and calibration function. */
    retval = funcUsedUart0 ();

    if (retval != 0)
    {
    System_printf ("App not starting...\r\n");
    for (;;)

    Task_yield ();
    }
    }

    /* Kick off application - Forever loop */
    while (1)
    {
    funcUsedUart1 ();
    }
    }

    Void main ()
    {
    Task_Params taskParams;
    ... ...
    UART_init ();
    UART_Params_init (&uartParams);.
    uartParams.baudRate = 9600;

    uartParams.readTimeout
    = UART_READ_TIMEOUT_SECONDS
    * (MICROSECONDS_PER_SECOND / CLOCK_TICK_PERIOD);

    uartParams.readEcho = UART_ECHO_OFF;

    uartCfg = UART_open (Board_UART0, &uartParams);
    if (uartCfg == NULL)
    {
    while (1)
    {
    ;
    }
    }
    UartPrintf_init (uartCfg);

    UART_Params_init (&uartParams_1);

    uartParams_1.readTimeout =
    UART_1_READ_TIMEOUT_SECONDS
    * (MICROSECONDS_PER_SECOND / CLOCK_TICK_PERIOD);

    uartParams_1.baudRate = 9600;
    uartCfg_1 = UART_open (Board_UART1, &uartParams_1);

    /* Configure task. */
    Task_Params_init (&taskParams);
    taskParams.stack = myTaskStack;
    taskParams.stackSize = APP_TASK_STACK_SIZE;
    taskParams.priority = 1;
    Task_construct (&myTask, taskFxn, &taskParams, NULL);

    BIOS_start (); /* enable interrupts and start SYS/BIOS */
    }
  • Hi Yue,

    I would recommend to move all the "UART_open()" calls into the taskFxn. The reason is that it can lead to problem if you do these prior to starting the TI-RTOS as they do depend on TI-RTOS being initialized and running which it will not be until BIOS_start() is called.

    It is not impossible that this is part of your problem.
  • make sense! i will try that and let you know. this leads to another question, can i do the UART initialization in the task instead in the main()?
  • It should be no problem to UART initialization in the task instead in the main().