Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Setting up the app_timer with Keil and NRF52810

Hello,

My goals is to start two functions every second. So I made a function that starts those two functions and am now trying to use the app_timer library to let this happen. Thus far I've set it up like this:

void InitTimer()
{
	app_timer_init();	//Initialize the timer
	APP_TIMER_DEF(TIM_POL);//Create a timer ID
	app_timer_create(&TIM_POL, APP_TIMER_MODE_REPEATED, StartStatemachines);//Create the timer
	app_timer_start(TIM_POL, APP_TIMER_TICKS(POLLING_RATE),0);//Start the timer with polling rate
}

Where POLLING_RATE = 1000

After calling InitTimer, the program never seems to enter 'StartStatemachines' when debugging the program and putting a breakpoint inside that function.

Is there something I am missing?

Parents
  • Hi,

    The RTC used by app timer will not run unless the 32KHz clock source has been started beforehand. Do you know if you if that clock source it's running in your app? The Softdevice will start the clock during initialization if you are working on a BLE example.

    Also, you should check the return value from  app_timer_create() and app_timer_start() as we do in our examples to make sure they return NRF_SUCCESS. 

  • I have turned on "nrfx_rtc" and "nrf_drv_rtc" and the "RTC1" instance for both and set the frequency to "32768" because I have no proper clue which one to use. I have also set the "nrfx_timer", "nrf_drv_timer" and "app_timer" running at the same frequency because still I don't know which one I really have to use. But still no succes.

Reply Children
Related