Hi All
I am facing one issue using app_timer.c, When I put the PRESCALER value as 327 and started timer as app_timer_start(timer_ID, 100, NULL);, It was giving only 920ms instead of 1s? why is this so?
Here is my code
#include <stdint.h>
#include "nrf.h"
#include "app_timer.h"
#include "app_error.h"
#include "nrf_gpio.h"
// Timer settings
#define APP_TIMER_PRESCALER 327
#define APP_TIMER_MAX_TIMERS 1
#define APP_TIMER_OP_QUEUE_SIZE 1
static app_timer_id_t timer_ID;
void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name)
{
}
void timeOut(void * p_context)
{
nrf_gpio_pin_toggle(4);
}
int main(void)
{
nrf_gpio_cfg_output(4);
// TIMER init
APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, false);
NRF_CLOCK->TASKS_LFCLKSTART = 1;
while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0);
app_timer_create(&timer_ID, APP_TIMER_MODE_REPEATED, timeOut);
app_timer_start(timer_ID, 100, NULL);
while(true)
{
}
}
Please help me on this, Mo