Hardware timer power consumption

Hi,

We are working on power optimization for our project which uses nRF5340 board. Upon testing we observed when starting hardware timer the base level of the current consummed increases around 800uA range. 
this is our observation,

when enabling hardware timer :


When not enabling hardware timer :


As seen in the image, the average current increases. The hardware timer is started for 1s period interval in our code.
This is how we have implimented HT in our code:

int platform_htimer_init(data_t *self)
{
    int error_stat = TIMER_OK;

    nrfx_err_t status;

    INOS_LOG_INF("TIMER  INITIALIZING.....");

    nrfx_timer_config_t config = NRFX_TIMER_DEFAULT_CONFIG;
    config.bit_width = NRF_TIMER_BIT_WIDTH_32;
    config.p_context = self;

    status = nrfx_timer_init(&timer_inst, &config, cb);

    if (status == NRFX_SUCCESS)
    {
        #if defined(__ZEPHYR__)
        IRQ_DIRECT_CONNECT(NRFX_IRQ_NUMBER_GET
                        (NRF_TIMER_INST_GET(TIMER_INST_IDX)),  IRQ_PRIO_LOWEST,
                                NRFX_TIMER_INST_HANDLER_GET(TIMER_INST_IDX), 0)
        #endif

        nrfx_timer_clear(&timer_inst);

        /* Creating variable desired_ticks to store the output of 
                                        nrfx_timer_ms_to_ticks function */ 
        uint32_t desired_ticks = nrfx_timer_ms_to_ticks(&timer_inst, 
                                                                self->ms_time);

        /*
        * Setting the timer channel NRF_TIMER_CC_CHANNEL0 in the extended 
        * compare mode to clear the timer and trigger an interrupt if   
        * internal counter register is equal to desired_ticks.
        */
        nrfx_timer_extended_compare(&timer_inst, NRF_TIMER_CC_CHANNEL0,
            desired_ticks,NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);

        self->init = TIMER_INITIALIZED;
    }

    return error_stat; 
}


int start_htimer(data_t *self)
{
    int error_stat = TIMER_OK;


    nrfx_timer_enable(&timer_inst);
    if (nrfx_timer_is_enabled(&timer_inst) == 0)
    {
        INOS_LOG_ERR_S(PLAT_TIMER_START_ERR_2);
        error_stat = TIMER_ERROR;
    }

    return error_stat; 
}



  1. What all things should we consider when implimenting hardware timer in low power application?
  2. From our testing we observed that the controller is not entering sleep mode when starting hardware timer, Can you conform the same?

note : In the above image, ble is enabled and advertizing during testing also some hardware modules are connected with the device.
          We tried to use softare timer, but it was not accurate for our application thus we switched to hardware timer.
          The SDK version we are using :v2.4.2
          Toolchain version : v2.4.2
        

Thanks in advance.

Parents Reply Children
No Data
Related