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.

CC 2640 system crashes when a new task is added in main under simple ble central project.

Other Parts Discussed in Thread: CC2640

Hi,

In CC 2640 sample application project, we are using simple ble central project and trying to add a new task in main(), but when we compile the compilation works fine but after flashing it in cc2640 using smart RF, and  when we run the target the system crashes it goes to exit().

Please let me know what are the steps to be followed inorder to add a new task in main, I have followed the below steps but still the system crashes.

ICALL_MAX_NUM_TASKS=5 (modified from 3 to 5)
ICALL_MAX_NUM_ENTITIES=8 (modified from 6 to 8)

If any other paramertes need to modified please inform us.

 

  • Neil,

    It depends on what you are going to do with this task. If it is a task that will be registered with the stack to communicate with it then you need to modify these variables. For a standalone RTOS task (for example to handle button inputs, sensors etc) there is no need to modify these.

    When using SmartRF Flash Programmer 2, make sure you also flash the stack image (or merge the two hex files for the app and stack) before running.

    The below example sets up a new low-priority task in your system waking up every 100ms to execute.

    #include <ti/sysbios/knl/Task.h>
    #include <ti/sysbios/knl/Clock.h>
    #define STACK_SIZE 512
    Task_Struct myTask; // Must be global for TI RTOS ROV viewer plugin to find it.
    uint8_t taskStack[STACK_SIZE];
    
    void taskFxn(UArg a0, UArg a1) {
      while(1) {
        //Wake every 100ms
        Task_sleep(100 * 1000 / Clock_tickPeriod);
      }
    }
    
    int main(void) {
      Task_Params params;
      Task_Params_init(&params); 
    
      taskParams.stack = taskStack;
      taskParams.stackSize = sizeof(taskStack);
      taskParams.priority = 1;
      Task_construct(&myTask, taskFxn, &taskParams, NULL);
      //...
      
      BIOS_start();
    }


  • Hi,

    I am currently using simple ble central project, under main I am trying to add gaprole task for peripheral(GAPRole_createTask();) ,the compilation works fine but after flashing while running the system crashes.

    Do you have any inputs how to prevent crash.Thanks for your support.

    Regards,
    Neil
  • Hi Neil,

    Please see the PTM example on the BLE wiki: processors.wiki.ti.com/.../PTM_cc2640

    This should serve as an example for adding an ICall aware task to the system.

    Best wishes
  • Hi,

    Thanks for the example the problem is solved.

    Regards.