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.

CC2650 with GPTimer

Other Parts Discussed in Thread: CC2650

Hi,

i am using an external Hall sensor to give an INT on the CC2650 with an magnet.

I receive the interrupts and my question is what is the unit of the returnet value from the interrupt:

void timerCallback(GPTimerCC26XX_Handle handle, GPTimerCC26XX_IntMask interruptMask)
{
timerBuf[timerBufIndex++] = GPTimerCC26XX_getValue(handle);

if(timerBufIndex == 10)
{
//GPTimerCC26XX_stop(handle);
timerBufIndex=0;
}
}

The Timer is triggert  for a positive edge: GPTimerCC26XX_POS_EDGE

So if i understood it right, the Timer will give an Interrupt for every positive Edge.

And the time between them would be given in return on the callback function.

Is this right?

Is the returned value in micro seconds?

  • GPTimerCC26XX_getValue returns tick numbers when the interrupt happens.


    If you want to get time in between each interrupt, you have to check (the starting value(tick) you assign - the current time tick)/48000000.
    since 1 tick = 1/48000000 second(GPTimer is running off sclk_hf). Assuming GPTimer is configured as down counter

    You can see the comment in GPTimerCC26XX.h

    * @brief Function to retrieve the current value of timer
    * This returns the value of the timer in all modes except for
    * input edge count and input edge time mode.
    * In edge count mode, this register contains the number of edges that
    * have occurred. In input edge time, this register contains the
    * timer value at which the last edge event took place.

  • Hi Christin,

    i was able to measure the Time with a PWM as interrupt source.

    But for me 16Bit is too short when the timer runs with 48MHz.

    The biggest time that it can measure is 2^16/48000000 = 1,36ms

    am i correct?

    I think i will use the GPT_MODE_EDGE_COUNT_UP instead and then get a clock with constant period like 100ms to check how many times did a Positive edge interrupt occurs in this interval.

    Wenn will the 32Bit timer availale?
    Can i change the clock source from this timer to use RTC source?
  • In the driver, when 16Bit mode is selected, the prescaler is also used a timer extension which give you additional 8 bits. Will that be enough for you?

    32bit timer is only available for Oneshot/Periodic modes.

    You can't use RTC as GPtimer source but you can switch the sclk_hf source to run off XOSCHF which will give you better accuracy if that's what your want.
  • Hi Christin,

    thanks for your answer.

    I am using the count mode and i get an internal clock every second to read the amount of events that has been happened.

    Thats enougth for my application and it gives me good results.

    I could do it probably with the timer extention too.


    Regards,

    Michael