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

High current consumption when using timer

I have a custom beacon application that is mostly idle. Before adding a timer, the current consumption was 3.2uA. After adding the timer, the current consumption jumped to over 400uA. The timer is used to start the advertising once or twice a day. What am I missing to get the current down to something reasonable? Here's my timer setup:

    nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
    timer_cfg.bit_width = NRF_TIMER_BIT_WIDTH_32;
    timer_cfg.frequency = NRF_TIMER_FREQ_31250Hz;
    err_code = nrf_drv_timer_init(&m_timer, &timer_cfg, timer_handler);
    APP_ERROR_CHECK(err_code);

    uint32_t cycle_time_sec = *(uint32_t *)ADVERTISING_CYCLE_ADDRESS;
	ticks = nrf_drv_timer_ms_to_ticks(&m_timer, BATTERY_TIMER * cycle_time_sec);

    /* setup m_timer for compare event */
    nrfx_timer_extended_compare(&m_timer,
				 NRF_TIMER_CC_CHANNEL0,
				 ticks,
				 NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK,
				 true);

    nrf_drv_timer_enable(&m_timer);

Parents
  • Hello,

    If you use TIMER0 (or any of the TIMERs), you will use both the timer peripheral and the HFXTAL. I suggest you try utilizing the app_timer for these kind of timers. The app_timer will use the RTC (Real Time Counter, which is the Low frequency timer). This is more power efficient. 

    Look at the implementation in e.g. the ble_app_hrs example for how to use the app_timer. 

    Best regards,

    Edvin

Reply
  • Hello,

    If you use TIMER0 (or any of the TIMERs), you will use both the timer peripheral and the HFXTAL. I suggest you try utilizing the app_timer for these kind of timers. The app_timer will use the RTC (Real Time Counter, which is the Low frequency timer). This is more power efficient. 

    Look at the implementation in e.g. the ble_app_hrs example for how to use the app_timer. 

    Best regards,

    Edvin

Children
Related