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

app_timer_cnt_get() gives garbage unless one has a dummy repeated timer

I wasted a day with this issue. I could not understand why app_timer_cnt_get() was giving me garbage on the nRF51 DK  when running normally but when stepping through the debugger line by line, it did not. It turned out that I had to start an application timer that was periodic as follows:

err_code = app_timer_create(&m_app_dummy_timer_id, APP_TIMER_MODE_REPEATED, dummy);

err_code = app_timer_start(m_app_dummy_timer_id, CMD_SENSOR_TIME, NULL);

It's bad enough I have to make the dummy, but if I used APP_TIMER_ONE_SHOT it would not work. I only found out because I had started from an app that needed a periodic timer where the method worked. I made changes piece by piece, rebuilt and re-deployed and finally came across that it was the removal of the periodic time which I no longer needed.

This should be clearly documented. It cost me great frustration and lots of time.

It may be documented in later versions but I am working with SDK 12.3.0 with SoftDevice 130.

Related