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.

CCS/CC1350: How to create a task for the GPTimer26XX.h example?

Part Number: CC1350

Tool/software: Code Composer Studio

I'm trying to use the example function for the timer driver, but I didn't understand a few things:

http://dev.ti.com/tirex/content/simplelink_cc13x0_sdk_1_30_00_06/docs/tidrivers/doxygen/html/_g_p_timer_c_c26_x_x_8h.html

void taskFxn(UArg a0, UArg a1) {
  GPTimerCC26XX_Params params;
  GPTimerCC26XX_Params_init(&params);
  params.width          = GPT_CONFIG_16BIT;
  params.mode           = GPT_MODE_PERIODIC_UP;
  params.debugStallMode = GPTimerCC26XX_DEBUG_STALL_OFF;
  hTimer = GPTimerCC26XX_open(CC2650_GPTIMER0A, &params);
  if(hTimer == NULL) {
    Log_error0("Failed to open GPTimer");
    Task_exit();
  }
  Types_FreqHz  freq;
  BIOS_getCpuFreq(&freq);
  GPTimerCC26XX_Value loadVal = freq.lo / 1000 - 1; //47999
  GPTimerCC26XX_setLoadValue(hTimer, loadVal);
  GPTimerCC26XX_registerInterrupt(hTimer, timerCallback, GPT_INT_TIMEOUT);
  GPTimerCC26XX_start(hTimer);
  while(1) {
    Task_sleep(BIOS_WAIT_FOREVER);
  }
}

What do reference arguments a0 and a1 account for?

And how do I create tasks that will use this function?

Thank you

  • Hello Larissa,

    Larissa Amaral said:
    What do reference arguments a0 and a1 account for?

    When you construct a task, you can pass two arguments to a task function. 
    In your example both arguments are not used.

    Larissa Amaral said:
    And how do I create tasks that will use this function?

    Analyse this example: dev.ti.com/.../
    to see how to create a task. 
    You may need to read TI-RTOS manual.

  • Thank you!

    I understood that I have to create some sort of Task_Init() function, but there are some parameters that I don't understand how to create:

    1. Task Stack size - how to determine it so there's no memory leak?
    2. Task priority - can I choose whatever I want?

    Perhaps it's better to study TI-RTOS properly, but if some guidance could be given on this I would appreciate it!
  • Larissa Amaral said:
    Perhaps it's better to study TI-RTOS properly, but if some guidance could be given on this I would appreciate it!

    Start with this: https://training.ti.com/ti-rtos-workshop-series-introduction

    Larissa Amaral said:
    1. Task Stack size - how to determine it so there's no memory leak?

    Memory leakage is related to a help. Stack usage can be monitored while debugging.

    Larissa Amaral said:
    2. Task priority - can I choose whatever I want?

    It depends on MCU/CPU architecture. Please refer to TI-RTOS guide.