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/CC1352P: Crashes during Task_create

Part Number: CC1352P
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

OK, we finally have our app building without errors after porting from simplelink_cc13x2_sdk_2_30_00_45 to simplelink_cc13x2_26x2_sdk_2_40_00_81.

It was previously running fine, but now its locking up on the first call to Task_create(). (we have multiple tasks)

Task_Params_init(&taskParams);
taskParams.stackSize = taskInfo->stacksize;
taskParams.stack = malloc(taskInfo->stacksize);
taskParams.priority = taskInfo->priority;
taskParams.arg0 = (UArg)tss;
tss->taskId = taskid;
tss->taskHandle = Task_create((Task_FuncPtr)taskInfo->threadStart, &taskParams, Error_IGNORE);  <---DOES NOT RETURN

Is there an easy way to debug these crashes?  From a disassembly view I see that it is hitting "ti_sysbios_family_arm_m3_Hwi_excHandler__I" and going into some sort of while(1) loop (see image below) .

We had a similar issue in the previous SDK, which used ICALL and we found that we needed to change ICALL_MAX_NUM_TASKS from 2 to 6.

Is there something similar now that requires that we increase the number of tasks allowed?

Thanks,

- Bill

  • Hi Bill,

    For clarification, are you using Task_create or Task_construct? Can you provide an example of the code you are trying to implement which causes the crash? You can further enable debug settings by using app_debug.cfg from source\ti\zstack\rtos of the SDK installation path. You may also want to turn off optimizations for further insight.

    Regards,
    Ryan
  • Hi Ryan,

    Not sure if you saw my update to the original post where I added this snippet of code showing how we're calling the Task_create. 

    Task_Params_init(&taskParams);
    taskParams.stackSize = taskInfo->stacksize;
    taskParams.stack = malloc(taskInfo->stacksize);
    taskParams.priority = taskInfo->priority;
    taskParams.arg0 = (UArg)tss;
    tss->taskId = taskid;
    tss->taskHandle = Task_create((Task_FuncPtr)taskInfo->threadStart, &taskParams, Error_IGNORE);

    This is being done inside taskFxn() in main.c We've already turned off optimization (that's usually the first thing we do).

    Besides increasing the number of allowed tasks (ICALL_MAX_NUM_TASKS), we had also increased the heap0 size in the BIOS setting of app.cfg.  In this SDK version when we do the same thing we get this warning:

    BIOS.heapSize and Memory.defaultHeapInstance have both been set.  BIOS.heapSize ignored.  Using Memory.defaultHeapInstance.

    How should we be increasing the heap?

    I will try the app_debug.cfg, but what should I be looking for? Would using the ROV provide any insight? (I don't know how to use this tool, I've only read a little about it)

    Thanks for the help.

    - Bill

  • Hi Bill,

    Can you please provide me with the constants and variables so that I can re-create the issue? I would recommend moving this code from taskFxn() to main(), renaming taskParams as this is typically used for the application task (at least in the examples), and using Task_construct instead of Task_create. Here is how zc_ota_server creates another task for the NPI:

    void NPITask_createTask(void)
    {
    memset(&npiTaskStack, 0xDD, sizeof(npiTaskStack));

    // Configure and create the NPI task.
    Task_Params npiTaskParams;
    Task_Params_init(&npiTaskParams);
    npiTaskParams.stack = npiTaskStack;
    npiTaskParams.stackSize = NPITASK_STACK_SIZE;
    npiTaskParams.priority = NPITASK_PRIORITY;

    Task_construct(&npiTaskStruct, NPITask_Fxn, &npiTaskParams, NULL);
    }

    http://dev.ti.com/tirex/content/simplelink_cc26x2_sdk_2_30_00_34/docs/zstack/html/tirtos/config.html?highlight=heap#creating-vs-constructing 

    The Heap Configuration in app.cfg has been reworked due to the deprecation of ICALL, HEAPMGR_CONFIG = 0x80 is set by default for auto-sizing (so you shouldn't need to alter it) but you can try using 0x00 instead for static as defined by HEAPMGR_SIZE.

    And yes, using app_debug.cfg enables the ROV for heap management: dev.ti.com/.../zigbee-index.html

    Regards,
    Ryan

  • Hi Ryan,

    I was able to track down the problem.  It wasn't directly related to the Task_create(), but with OsalPort_registerTask() which was called during the task initialization.  The problem here was that the passed in semHandle was NULL.  

    MyTask_ZstackId = OsalPort_registerTask(Task_self(), MyTaskTss->semHandle, &MyTask_events);

    Totally our fault, but still frustrating that the failure is a while(1) loop with no info available on what the actual problem was.

    We have run into similar issues several times now (it's a steep learning curve).  Is something available to better troubleshoot these types of issues?

    Thanks,

    - Bill

  • Hi Bill,

    I'm glad to hear that you were able to resolve the issue, this is unfortunately no clear or recommended path for debugging a HWI exception handler as further explained by Severin in this E2E post: e2e.ti.com/.../2564438

    Regards,
    Ryan