Hi, i'm experimenting RTC1 using the app_timer module (not using S110 soft device), and i find some problems onRTC prescaler. If i set values as stated in the datasheet, for example 327, i get the correct timeout (i want to achieve 5 secs, so i set 500 as timeout_ticks in app_timer_start). But if i set 32767, to have a tick each second, and 5 in app_timer_start, the timer doesn't work and i get the timeout message before one second. I think i'm doing something wrong... here is my code:
#include <stdint.h>
#include "nrf.h"
#include "simple_uart.h"
#include "pca10001.h"
#include "app_timer.h"
#include "app_error.h"
// Timer settings
#define APP_TIMER_PRESCALER 327
#define APP_TIMER_MAX_TIMERS 2
#define APP_TIMER_OP_QUEUE_SIZE 4
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)
{
simple_uart_putstring((const uint8_t *)" \n\rERROR!!!\r\n ");
}
void timeOut(void * p_context)
{
simple_uart_putstring((const uint8_t *)"Timeout!\r\n ");
}
int main(void)
{
// UART init
simple_uart_config(RTS_PIN_NUMBER, TX_PIN_NUMBER, CTS_PIN_NUMBER, RX_PIN_NUMBER, true);
simple_uart_putstring((const uint8_t *)"Timer start...\r\n ");
// 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_SINGLE_SHOT, timeOut);
app_timer_start(timer_ID, 500, NULL);
while(true)
{
}
}