Hi
I am trying to use nrf52 Application Timer. I followed the instructions in "Application Timer Tutorial" (devzone.nordicsemi.com/.../), but it seems I am missing something. (my code is attached below)
When I debug my code, I get to "RTC1_IRQHandler", which calls "nrf_drv_rtc_int_handler". I get to the line " m_handlersinstance_id;", but there my application crashes, because "m_handlers" var is not initiated.
what am I missing? Thanks Yaron
My code:
// General application timer settings.
#define APP_TIMER_PRESCALER 16 // Value of the RTC1 PRESCALER register.
#define APP_TIMER_MAX_TIMERS 2 // Maximum number of timers in this application.
#define APP_TIMER_OP_QUEUE_SIZE 3 // Size of timer operation queues.
static app_timer_id_t m_led_a_timer_id;
static void lfclk_request(void)
{
uint32_t err_code = nrf_drv_clock_init(NULL);
APP_ERROR_CHECK(err_code);
nrf_drv_clock_lfclk_request();
}
// Timeout handler for the repeated timer
static void timer_a_handler(void * p_context)
{
nrf_drv_gpiote_out_toggle(LED_1_PIN);
}
// Create timers
static void create_timers()
{
uint32_t err_code;
// Create timers
err_code = app_timer_create(&m_led_a_timer_id,
APP_TIMER_MODE_REPEATED,
timer_a_handler);
APP_ERROR_CHECK(err_code);
}
int main()
{
// Request LF clock.
lfclk_request();
// Initialize the application timer module.
APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, false);
create_timers();
uint32_t err_code = app_timer_start(m_led_a_timer_id, APP_TIMER_TICKS(200, APP_TIMER_PRESCALER), NULL);
APP_ERROR_CHECK(err_code);
while(1);
}