Hello,
in my application I have a problem with the app_timer module respectively with a timer I have created.
I'm working on a nrf52832 ( Rev. 1 - build code QFAA-B00) and use the Nordic SDK in Version 14.2.0.
In my application i use several timers and all but one work as expected. The problem with this timer is that sometimes it fires constantly for a short period. At least it looks like this to me. Consequently the timeout handler is called again and again (up to 100 times) until it runs normally again. Since the other timers I use in my application work like expected I don't think there is a problem with the configuration or in the way the timer is used.
Below is a section of my code that shows how the timer is configured and how it is used. The timer is used to control a state machine and is configured to fire every 3000 ms. In the timeout handler the state variable of a statemachine is incremented by 1.
// Timer definition. APP_TIMER_DEF(m_my_timer_id); #define MY_TIMER_STEP_MS 3000 #define MY_TIMER_STEP_TIMEOUT APP_TIMER_TICKS(MY_TIMER_STEP_MS) [...] // Initializing timer. err_code = app_timer_create(&m_my_timer_id, APP_TIMER_MODE_REPEATED, my_timer_timeout_handler); APP_ERROR_CHECK(err_code); [...] // Timeout handler. static void my_timer_timeout_handler(void * p_context) { UNUSED_PARAMETER(p_context); state++; } [...] // Main code. switch (state) { case 0 : // Idle state. break; case 1 : err_code = app_timer_start(m_my_timer_id, MY_TIMER_STEP_TIMEOUT, NULL); APP_ERROR_CHECK(err_code); break; case 3 : [...] state++; break; case 5 : [...] state++; break; case 7 : [...] err_code = app_timer_stop(m_my_timer_id); APP_ERROR_CHECK(err_code); state = 0; break; default: break; }
Is there perhaps a problem with how I use the app_timer module?
Or is there probably a bug or a special feature that I don't know?
Any idea?
Thanks in advance.