This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

app timer current consumption

Hello,

I would like to use app timer based on RTC1 in order to wake up the MCU every X sec. The app timer seems to work correctly when the MCU is working. I use the following code to initialize it :

void init_timer()
{
APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);
//APP_TIMER_TICKS(1, APP_TIMER_PRESCALER);
APP_TIMER_DEF(Avid_timer_id);
uint32_t err_code;

// Create timers
err_code = app_timer_create(&Avid_timer_id,
APP_TIMER_MODE_REPEATED,
Avid_timer_handler);
APP_ERROR_CHECK(err_code);

// Start timers
err_code = app_timer_start(Avid_timer_id, APP_TIMER_TICKS(1, APP_TIMER_PRESCALER), NULL);
APP_ERROR_CHECK(err_code);

Avid_ticks = ctr_tick;
Avidflag_PC.my_flag.app_timer_enable = 1;

}

With this the handler is called every 1 ms.

When I am in power down down mode without app timer (using app_timer_stop_all(); to stop it) the average current consumption is around 30µA. 

When I am in power down mode with app timer, the average current consumption is around 110 µA. 

Do you know what is wrong in my software and cause this high current consumption?

For information, I use the following code to enter in low power mode

static void power_manage(void)
{
//Used to stop interrupt flag of the floating co processor
__set_FPSCR(__get_FPSCR() & ~(0x0000009F));
(void) __get_FPSCR();
NVIC_ClearPendingIRQ(FPU_IRQn);

//Enter in low power mode
uint32_t err_code = sd_app_evt_wait();
APP_ERROR_CHECK(err_code);
}

By advanced, thank you for your help.

BR.

Parents
  • Hello,

    Thanks for your reply.

    To measure the current I have a board that can measure nA, so the issue is not due to the precision of the measure, I used it for severals other projects without any problem.

    30µA is due to the rest of the board (the average current is 20µA due to the nrf52 plus 10 µA consumed by the rest of the board).

    Effectively increasing the ticks the current decrease:

    - 1 tick/ms => 90µA in sleep mode

    - 1 tick/10ms => 14µA in sleep mode

    - 1 tick/100ms => 6.5µA in sleep mode

    - App timer off => 5.3µA in sleep mode

    Thank you for your help.

    BR

  • In addition to the sleep current being lower for longer period app ticks, the latency will be better too. 

    If you use a soft device, the app ticks are not as high a priority as the SD ISR's so if you use a small period for the tick, each tick can be off by upwards of a msec depending on SD activity.  Whereas with a 100msec tick the same is true that it can be off by about 1 msec.

    So, longer period for tick, means less latency and a more accurate tick time.  Most of the examples use 100msec tick time.

Reply
  • In addition to the sleep current being lower for longer period app ticks, the latency will be better too. 

    If you use a soft device, the app ticks are not as high a priority as the SD ISR's so if you use a small period for the tick, each tick can be off by upwards of a msec depending on SD activity.  Whereas with a 100msec tick the same is true that it can be off by about 1 msec.

    So, longer period for tick, means less latency and a more accurate tick time.  Most of the examples use 100msec tick time.

Children
No Data
Related