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

Timers wont work after time

I have a strange behavior with the Timers. For my project I use a Raytac module with a nRF52 Chip on it. Softdevice is not flashed. Project is based on SDK 11.0

When I flash the module for first time with my code, then all works. After a few days it wont get in the timer handlers anymore. Even when I erase the chip and flash it again, the timers wont work anymore.

But when I debugg it, the initialization will success.

I have to flash a new module. And then the timers will work again. But the new module will have the same behavior after a few days.

Here is the part of the Timer in my code:

#define APP_TIMER_PRESCALER             15    			// Value of the RTC1 PRESCALER register.
#define APP_TIMER_OP_QUEUE_SIZE         20     			// Size of timer operation queues.
APP_TIMER_DEF(m_polling_timer_id);
APP_TIMER_DEF(dailyplan_timer);

static void lfclk_request(void)
{
  uint32_t err_code = nrf_drv_clock_init();
  APP_ERROR_CHECK(err_code);
  nrf_drv_clock_lfclk_request(NULL);
}

static void polling_timer_handler(void * p_context)
{

}


static void create_timers()
{   
    uint32_t err_code;

	err_code = app_timer_create(&m_polling_timer_id,
                            APP_TIMER_MODE_REPEATED,
                            polling_timer_handler);


	err_code = app_timer_create(&dailyplan_timer,
                            APP_TIMER_MODE_REPEATED,
                            dailyplan_timer_handler);
															

    APP_ERROR_CHECK(err_code);
}

int main(void)
{
  lfclk_request();
  APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);
  create_timers();
  app_timer_start(m_polling_timer_id, APP_TIMER_TICKS(20, APP_TIMER_PRESCALER), NULL);
  app_timer_start(dailyplan_timer, APP_TIMER_TICKS(30000, APP_TIMER_PRESCALER), NULL);
}

How is that possible? The rest of the code will still work. So the hardware seems to be good. The Uart communication will also work. But what can be the reason, that it wont get into the timers handler anymore?

And how is that possible, that at the beginning it work, and then after a few days it wont work anymore.

And also unclear, why it wont work after reflashing the chip again?

Related