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.

Timer Create

Other Parts Discussed in Thread: CC2650, SYSBIOS

hello

How to create a timer with other than Timer_ANY Identifier ? And how to select specific hardware timer ?

I'm using CC2650

  • WeirdWizard said:

    How to create a timer with other than Timer_ANY Identifier ? And how to select specific hardware timer ?

    I'm using CC2650

    This response to a different Forum post might prove informative for you:

    For the CC26xx case:
    • ti.sysbios.family.arm.m3.Timer manages the single SysTick timer
    • ti.sysbios.family.arm.cc26xx.Timer manages the single RTC timer
    • ti.sysbios.family.arm.lm4.Timer manages the GP timers

    The TI-RTOS configuration GUI in CCS will not offer some of the above mentioned support.  You can insert configuration code manually into your .cfg file by clicking the 'cfg Script" tab for the TI-RTOS configuration GUI.  And as is demonstrated in the Forum post I point to above, you can always create things manually during runtime in you C code.

    Regards,

    - Rob

  • when creating timer:
    timer2 = Timer_create(2, 0, &timerParams, &eb);

    Does it take A, B or both timers ??
  • WeirdWizard said:
    when creating timer:
    timer2 = Timer_create(2, 0, &timerParams, &eb);

    Does it take A, B or both timers ??

    I see references to Timer A registers in <SYS/BIOS>/packages/ti/sysbios/family/arm/lm4/Timer.c (and no references to Timer B registers), so you will get Timer A.

    Regards,

    - Rob

  • I've looked at bios_6_46_00_23\packages\ti\sysbios\family\arm\cc26xx\Timer.c

    and it looks like CC26xx uses RTC for its timer so my question is what Timer ID is used for if we have only one RTC ?

  • WeirdWizard said:
    I've looked at bios_6_46_00_23\packages\ti\sysbios\family\arm\cc26xx\Timer.c

    My previous response was regarding the GP timers that are supported by ti.sysbios.family.arm.lm4.Timer module.  With that module you can specify a timer number and you will get the A side of that timer.

    When you call timer2 = Timer_create(2, 0, &timerParams, &eb);, the particular Timer module being used is determined by which module-specific Timer.h header file that you're #including.  If you #include <ti/sysbios/family/arm/lm4/Timer.h> then you will be creating a Timer from that module.  If you're #including <ti/sysbios/family/arm/cc26xx/Timer.h> then you're creating a Timer from the ti.sysbios.family.arm.cc26xx.Timer module (and the timerId parameter should be 0 or Timer_ANY).

    If you want to use more than one of the specific Timer modules in your C code, you can do that too.  That is achieved by using the "long names" of the module APIs:

        #define ti_sysbios_family_arm_lm4_Timer__nolocalnames
        #include <ti/sysbios/family/arm/lm4/Timer.h>
        ...
        timer2 = ti_sysbios_family_arm_lm4_Timer_create(2, 0, &timerParams, &eb);
    and you would do the same for the other type of Timer.  BTW, when doing this it's important to have the above #define be above the #include.

    WeirdWizard said:
    and it looks like CC26xx uses RTC for its timer so my question is what Timer ID is used for if we have only one RTC ?

    For the RTC the timerId should be 0 (or Timer_ANY), else you will get an error.  It does seem to be unnecessary, but timerId is inherited from the interface.

    Regards,

    - Rob