Application Timer not firing interrupt

Hi 

I'm trying to get the application timer working  on nrf52840 SDK version 17.02

I have followed the below link 

devzone.nordicsemi.com/.../application-timer-tutorial 

But I see that the app timer interrupt handler never gets called.

Here is the code snippet. I don't see any errors during timer create and start routines.

Any help would be appreciated.

Thanks,

Chitra 

static void adv_timeout_handler(void *p_context) {
UNUSED_PARAMETER(p_context);

NRF_LOG_INFO("In  adv_timeout_handler");

}

static void timers_init(void)
{

// while(nrf_drv_clock_lfclk_is_running());
ret_code_t err_code = app_timer_init();
APP_ERROR_CHECK(err_code);
NRF_LOG_INFO("app_timer_init error %d.", err_code);

#if 1
err_code = app_timer_create(&m_timer_id,
APP_TIMER_MODE_REPEATED,
adv_timeout_handler);
APP_ERROR_CHECK(err_code);
NRF_LOG_INFO("app_timer_create error %d.", err_code);

}

void application_timer_start(void)
{

ret_code_t err_code;

err_code = app_timer_start(m_timer_id, APP_TIMER_TICKS(500), NULL);
APP_ERROR_CHECK(err_code);
NRF_LOG_INFO("app_timer_start error %d.", err_code);

}

main()

{

 ret_code_t err_code = nrf_drv_clock_init();
  APP_ERROR_CHECK(err_code);
  nrf_drv_clock_lfclk_request(NULL);

  timers_init();

  ble_stack_init();

  nrf_pwr_mgmt_init();

 application_timer_start();

 while (true)
 {

  nrf_pwr_mgmt_run();

  }

}

Parents Reply
  • If you are using the scheduler you should also include app_sched_execute() in your infinite main()-loop, for instance you can look at the HID mouse example that use app_timer with scheduler:

    /**@brief Function for handling the idle state (main loop).
     *
     * @details If there is no pending log operation, then sleep until next the next event occurs.
     */
    static void idle_state_handle(void)
    {
        app_sched_execute();
        if (NRF_LOG_PROCESS() == false)
        {
            nrf_pwr_mgmt_run();
        }
    }

Children
Related