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.

Problem activating uart port TI RTOS 2.15 cc1310 SMARTRF06

Other Parts Discussed in Thread: CC1310, SYSBIOS

Hi,

I'm newbie with TI environment and TI RTOS. I'm trying to modifying some examples to get used to it.

At moment I'm trying to use a uart port modifying the Ti example rfEasyLinkTx.This is a chunk of code of the funcion which runs in the uart task:

static void uartRx(UArg arg0, UArg arg1)
{

    UART_Handle uart;
    UART_Params uartParams;

    //Board_initUART();

    /* 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_UART0, &uartParams);

    if (uart == NULL)
    {
        System_abort("Error opening the UART");
    }

    while(1);
}

The task is running because I can see it in the ROV and I can reach the while(1) using a break point if I comment all the UART instructions out.

I tryed to initialise the uart - Board_initUART() - in the main before BIOS_start() and also inside the task function - uartRx - (always just once) but no luck at moment.

It seems that it is getting stuck at the instruction:

uart  = UART_open(Board_UART0, &uartParams);

If I try to follow it using the disassembly, I can follow it till the function UARTCC26XX_initHw(UART_Handle handle) where it calls UARTDisable(hwAttrs->baseAddr) and than it enters in an infinite loop.

Any good tips?

Thanks you

D

  • Dario,

    Have you tried using the TI-RTOS UART Echo example?  If not, that is probably a good first step.  You can find this with the Resource Explorer (TI-RTOS for CC13XX and CC26XX->CC1310F128->CC1310 Development Kit->TI Driver Examples->UART Examples->UART Echo).

    Looking at the UART driver source (in the release, in the directory tirtos_cc13xx_cc26xx_2_15_00_17\products\tidrivers_cc13xx_cc26xx_2_15_00_26\packages\ti\drivers\uart ), UARTDisable() is called from UARTCC26XX_open() when the I/O pin hasn’t been properly configured by the PIN driver.  You mention explicitly calling Board_initUART().  Are you calling Board_initGeneral() before this?  That is where the PIN driver gets initialized.  I suspect a missing call to Board_initGeneral() is the problem here...

    Regards,
    Scott

  • Hi Scott,

    Thanks for replying. I started from UART Echo and I tryed to import some code from UART Echo to rfEasyLinkTx. Attached you can see the whole file. A call to Board_initGeneral() is already there. Any other good tip? Thanks

    /*
    * ======== empty_min.c ========
    */
    /* XDCtools Header files */
    #include <stdlib.h>
    #include <xdc/std.h>
    #include <xdc/runtime/System.h>
    #include <xdc/runtime/Error.h>

    /* BIOS Header files */
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Task.h>
    #include <ti/sysbios/knl/Semaphore.h>
    #include <ti/sysbios/knl/Clock.h>

    /* TI-RTOS Header files */
    #include <ti/drivers/PIN.h>
    #include <ti/drivers/UART.h>


    /* Board Header files */
    #include "Board.h"

    #include <stdint.h>

    /* EasyLink API Header files */
    #include "easylink/EasyLink.h"



    #define UART_RX_STACK_SIZE 768
    #define UART_RX_STACK_PRIORITY 3

    #define RF_TX_TASK_STACK_SIZE 1024
    #define RF_TX_TASK_PRIORITY -1


    Task_Handle uartRxTaskHande;
    Task_Struct uartRxTask;
    Task_Params uartRxTaskParams;
    uint8_t uartRxTaskStack[UART_RX_STACK_SIZE];


    Task_Struct rfTxTask;
    Task_Params rfTxTaskParams;
    uint8_t rfTxTaskStack[RF_TX_TASK_STACK_SIZE];


    static PIN_Handle pinHandle;
    static PIN_State pinState;


    // Application LED pin configuration table: All LEDs board LEDs are off
    PIN_Config pinTable[] =
    {
    Board_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    Board_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    Board_LED3 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
    PIN_TERMINATE
    };



    static void uartRx(UArg arg0, UArg arg1)
    {
    static UART_Handle uart;
    static UART_Params uartParams;

    const char echoPrompt[] = "\fEchoing characters:\r\n";

    /* 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_UART0, &uartParams);

    if (uart == NULL)
    {
    System_abort("Error opening the UART");
    }

    UART_write(uart, echoPrompt, sizeof(echoPrompt));


    while(1);
    }

    void initRxUartTask(void)
    {
    Task_Params_init(&uartRxTaskParams);
    uartRxTaskParams.stackSize = UART_RX_STACK_SIZE;
    uartRxTaskParams.priority = UART_RX_STACK_PRIORITY;
    uartRxTaskParams.stack = &uartRxTask;

    uartRxTaskHande = Task_create(uartRx, &uartRxTaskParams, NULL);
    }


    int main(void)
    {
    /* Call board init functions. */
    Board_initGeneral();
    Board_initUART();

    pinHandle = PIN_open(&pinState, pinTable);

    if(!pinHandle)
    {
    System_abort("Error initializing board LED pins\n");
    }

    PIN_setOutputValue(pinHandle, Board_LED1, 1);
    PIN_setOutputValue(pinHandle, Board_LED3, 0);

    initRxUartTask();

    /* Start BIOS */
    BIOS_start();

    return (0);
    }
  • Hi,
    it seems that the structure PowerCC26XX_module.resourceCounts[resourceId] inside the function Power_setDependency(hwAttrs->powerMngrId) is not correctly initialised when the application calls UART_open(Board_UART0, &uartParams); Any idea?
  • If you run the UART Echo example as is, does it work for you?

    In your modified test project, in the Board.h file, do you see that Board_initGeneral() results in calls to both Power_init() and PIN_init()?  Like this:

    #define     Board_initGeneral() { \
        Power_init(); \
        if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) \
            {System_abort("Error with PIN_init\n"); \
        } \
    }

    Regarding PowerCC26XX_module.resourceCounts[] not being initialized – what values are you seeing in this array?

    Thanks,
    Scott

  • If you run the UART Echo example as is, does it work for you?

    Yes

    In your modified test project, in the Board.h file, do you see that Board_initGeneral() results in calls to both Power_init() and PIN_init()?  Like this:

    #define     Board_initGeneral() { \
        Power_init(); \
        if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) \
            {System_abort("Error with PIN_init\n"); \
        } \
    }

    Yes, is exacltly the same.


    Regarding PowerCC26XX_module.resourceCounts[] not being initialized – what values are you seeing in this array?

    The value is the same for all the fields in PowerCC26XX_module.resourceCounts[] and is 0xBE. When I run UART_echo some of them are 0 and some of them are 1. 

    Any idea?

    Thanks

  • OK, thanks.

    This array is statically initialized.  If you are seeing values of ‘0xBE’ it makes me wonder if there is some memory overlap or maybe some stack overwrite of this array.

    Are you seeing any build warnings?

    Can you bring up the ROV tool and scan for errors?

    Thanks,
    Scott

  • I'm not seeing any warnings when it compiles

    But there are these messages in "Scan for errors":

    mod tab inst field message
    ti.sysbios.knl.Task Basic (0x20000a74) priority Corrupted data: Task priority is greater than Task.numPriorities
    ti.sysbios.knl.Clock Module N/A N/A Caught exception in view init code: "C:/ti/xdctools_3_31_01_33_core/packages/xdc/rov/StructureDecoder.xs", line 518: java.lang.Exception: Target memory read failed at address: 0xbebebec6, length: 32This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.
    ti.sysbios.knl.Task Detailed (0x20000a74) priority Corrupted data: Task priority is greater than Task.numPriorities
    ti.sysbios.knl.Task Detailed (0x20000210) stackPeak Error: Problem fetching Task stack: JavaException: java.lang.Exception: Target memory read failed at address: 0x20000a78, length: 760This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

    How can I initialise it properly?

    Thanks

    D

  • OK, thanks.

    At what point did you scan for errors with ROV?  

    If you run to main(), and then scan for errors, are any indicated?

    If no, can you try running the program further, until you see what code causes the corruption?  Either by looking at the resource counts array, or for errors shown in ROV?

    Thanks,
    Scott

  • At the beginning in the main I can see this error:

    Error: Problem fetching Task stack: Error: fetchArray called with length 0.


    Than it runs with the same error till:

    uartRxTaskHande = Task_create(uartRx, &uartRxTaskParams, NULL);

    where I can see the errors I already posted.

    So... it seems that the creation of the task is causing some troubles.

    I tried to change the size of the stack to 512 and the priority to 1 but I still have the followings problems:

    tab inst field

    message

    ti.sysbios.knl.Task Basic (0x20000a74) priority Corrupted data: Task priority is greater than Task.numPriorities
    ti.sysbios.knl.Task Detailed (0x20000a74) priority Corrupted data: Task priority is greater than Task.numPriorities
    ti.sysbios.knl.Task Detailed (0x20000210) stackPeak Error: Problem fetching Task stack: JavaException: java.lang.Exception: Target memory read failed at address: 0x20000a78, length: 504This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

    Thanks

    D

  • Dario,

    Is it possible for you to zip and post your modified project to the forum so I can look at it?  That will really help to narrow this down.

    If you don’t want to do that, you can add me as a friend on the forum, and send it to me privately…

    Thanks,
    Scott