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 GPTimer Power consumption

Other Parts Discussed in Thread: CC2650

Hi,

if i start my GPTimer that counts a negative egde interrupt as count source, the power consumption increases 1mA.

Why does the timer consumes so much evcen when no interrups ocurred?

Here is my timer configuration:

/* Set up GPTimer 0B in edge time capture mode */
GPTimerCC26XX_Params timerParams;
GPTimerCC26XX_Params_init(&timerParams);
timerParams.mode = GPT_MODE_EDGE_COUNT_UP;//GPT_MODE_EDGE_COUNT_UP;//GPT_MODE_EDGE_TIME_UP;
timerParams.width = GPT_CONFIG_16BIT;


hTimer = GPTimerCC26XX_open(CC2650_GPTIMER0B, &timerParams);

// GPTimerCC26XX_Edge edge=
GPTimerCC26XX_setCaptureEdge(hTimer,GPTimerCC26XX_NEG_EDGE);
/* Register interrupt when capture happens */
//GPTimerCC26XX_registerInterrupt(hTimer, timerCallback, GPT_INT_CAPTURE);//GPT_INT_MATCH

/* Open pin handle and route pin to timer */
hA1171Pin_INT = PIN_open(&pinState, BoardA1171_INT_Table);
GPTimerCC26XX_PinMux pinMux = GPTimerCC26XX_getPinMux(hTimer);
PINCC26XX_setMux(hA1171Pin_INT, PIN_ID(Board_A1171_INT), pinMux);

after that i go an start the timer:

GPTimerCC26XX_start(hTimer);

Inside the GPTimerCC26XX.c in the "...._start(...)" function i have comment out the threadsafeconstrain function:

/* Set constraint to disallow standby while running */
// GPTimerCC26XXThreadsafeConstraintSet(handle);

and also on the "..._stop(...)" function:

/* Clear constraint to allow standby again */
// GPTimerCC26XXThreadsafeConstraintClr(handle);

Now it consumes 1mA less current while the timer activated and it seems like the timer is working like before too.

This is how the function looks like:

/*!
* @brief Set Standby constraint while using timer to avoid TI RTOS
* going into standby when timer is running. As constraints are
* counting, store constraint status and access atomically and only
* once per timer resource.
*/
static inline void GPTimerCC26XXThreadsafeConstraintSet(GPTimerCC26XX_Handle handle)
{
GPTimerCC26XX_Object *object = handle->object;

uint32_t key = Hwi_disable();
/* Only set if not already set */
if (object->powerConstraint[handle->timerPart])
{
Hwi_restore(key);
return;
}
object->powerConstraint[handle->timerPart] = true;
Hwi_restore(key);
Power_setConstraint(PowerCC26XX_SB_DISALLOW );
}

When activated it will consume 1mA more current. Why? 

  • GPTimer runs on the 48MHz clk, therefore a higher current consumption is inevitable. You should not comment out the // GPTimerCC26XXThreadsafeConstraintSet(handle); and GPTimerCC26XXThreadsafeConstraintClr(handle); ass there might be hardware fault if you tried to access the timer when the device is in standby.

    If you don't need high timer resolution, then I will recommend you to use SW timer instead

  • Hi Christin,

    the timer is only activated if the device is connected and the timer will be closed if device is disconected. While in connection the device is in normal mode, does it still goes to standby mode while connected?

    What do you mean about SW timer? Using a clock as source and check every second how many interrupts on the GPIO pin has been fired?
    I can set the GPIO as input interrupt and on the callback function i can use a global variable to count up when interrupt gets fired.
    The clock could be used to check this global variable every second and reset it to zero.
    Is this what you mean?
  • The device is supposed to go into standby in between each connection event(please checkout this app note for more information :www.ti.com/.../swra478a.pdf ), but if the timer is running, then it should not enter standby.That's why GPTimerCC26XXThreadsafeConstraintSet is called in the GPTimerCC26XX_start.

    If your IO interrupt does not happen really quick(often), then yes, you can just use interrupt and make a counter for it. It would best to do as little as possible in the HW interrupt so that it will not mess up the BLE connection timing(so preferably, post the semaphore in the callback would be the best).
  • Hallo Michael,

    I also tried to comment out these functions (GPTimerCC26XXThreadsafeConstraintSet / GPTimerCC26XXThreadsafeConstraintClr) to solve another problem (BLE connection breaks). The effect was the timer stop working - so better leave it as it is.

    I measue ~ 1.8mA when timer runs, but I use the GPT_MODE_EDGE_TIME_UP mode, here the timer runs with 48MHz and the whole system is not suspended. In your case, the timer just count edges and You see the systems current in running mode.

    A question by the way: Did'nt You got problems with a bluetooth connection after calling GPTimerCC26XX_stop?
    What RTOS version / BLE stack version do you use?


    Regards from Calw / Germany
  • Hi Thomas,


    i am using the latest BLE Stack 2.2 and the GPTimer Driver from here:

    The based project is simple_peripheral. No i dindt had no problem on bluetooth connection.

    Maybe is because my GPTimer didnt get a lot of Edges to count. I will recomend you to leave it like it was.

    For me i dont need the GPTimer really, i did a simple clock that triggers every 1s and check a global variable that counts up a interrup event.

    I get the same results and on connnection it consumes 0.6 mA average current.

    Regards,


    Michael - Germany too