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

app_timer handler not performed in a simple demo

Hi,

For understanding the app_timer lib, I created a piece of very simple code with SDK 12.3.0 and S132 present, but got some problem with it.

My intention is to start a single shoot timer, and start it again when it got expired and toggle a LED at the same time, but it's been found that the handler has never been performed.

here is the code:

#include <stdint.h>
#include "nrf_gpio.h"
#include "nrf_gpiote.h"
#include "sdk_config.h"
//#include "nrf_ud_gpiote.h"
#include "SystemConfig.h"
    #include "app_timer.h"

#define APP_TIMER_OP_QUEUE_SIZE	4

APP_TIMER_DEF(m_led_timer_id);

    void led_timer_handler(void *p_context)

{
		app_timer_start(m_led_timer_id, APP_TIMER_TICKS(200, APP_TIMER_PRESCALER), NULL);

		nrf_gpio_pin_toggle(LED2_PIN);
	
}


int main(void)
{
	
	APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);

ret_code_t err_code = app_timer_create(&m_led_timer_id,
													APP_TIMER_MODE_SINGLE_SHOT,
													led_timer_handler);

APP_ERROR_CHECK(err_code);

nrf_gpio_cfg_output(LED2_PIN);


//GPIOTE_init();

err_code = app_timer_start(m_led_timer_id, APP_TIMER_TICKS(200, APP_TIMER_PRESCALER), NULL);

APP_ERROR_CHECK(err_code);	

	while (true) {

	}

}

I'm wondering if I've missed anything?

Any comments are appreciated!!!

Related