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/CC2650: Timer is not starting it's execution

Part Number: CC2650
Other Parts Discussed in Thread: SYSBIOS,

Tool/software: TI-RTOS

Hello!

I have a slightly problem with the timer. I tried to configure it but it seems it doesn't call the function associated. I need to use one shot. Below is a snippit about the code I used. I tried also a breakpoint into the callback but it doesn't even enter there.
What am I doing wrong?

#include <ti/sysbios/family/arm/cc26xx/Timer.h>

static Timer_Handle timerHandle;
static Timer_Params timerParams;

void timerCallback(UArg arg){
    UART_write(uart, "a", 1);
//    System_printf("timerCallback");
//    System_flush();
    Timer_start(timerHandle); //restart the timer
}
Timer_Params_init(&timerParams);
timerParams.periodType=Timer_PeriodType_MICROSECS;
timerParams.period=1000000; // 1s 

timerParams.arg=1;
timerHandle = Timer_create(Timer_ANY, timerCallback, &timerParams, NULL);
//    timerHandle = Timer_create(Timer_ANY, &timerCallback, &timerParams, NULL); 
if (timerHandle == NULL){
    System_printf("Error");
    System_flush();
    while(1);
}
Timer_start(timerHandle);

Thank you very much!

  • Hello Mihai,
    The Timer module you are including from TI RTOS is used as a timing based for TI RTOS. The implementation for CC26XX uses only the 32kHz RTC as its timing base and by trying to use it you might / will cause the TI RTOS scheduler to misbehave. Use instead the Clock module. There is an clock example code in the TI kernel examples. And you can see how a clock (periodicClock) is implemented in simple_peripheral.c.
  • Well it does not increment the period but the ticks are incremented, but if it was used by RTOS should't it fail to create the handler?
    If I use the clock module could I set it to specific seconds and not clock ticks?
    Thank you!
  • Hello Mihai,
    You simply convert clock ticks to seconds. The variable Clock_tickPeriod (#include <ti/sysbios/knl/Clock.h>) is configured in the project .cfg file and is the period of each tick in micro seconds (us).

    xdc_UInt32 one_second = 1000000/Clock_tickPeriod ;

    Please refer to the TI-RTOS clock example project:
    C:\ti\tirtos_cc13xx_cc26xx_2_21_01_08\examples\TI\CC2650_LAUNCHXL\clock

    and the module ti.sysbios.knl.Clock documentation (simply press F1 in CCS and search for clock).

    Tips:
    Refer to Util_constructClock used in the BLE examples.