Hi, I have problem with timer in nrf52810. My TIMER2 counts very slow. I declared it as NRF_DRV_TIMER_INSTANCE(2); and config struct is:
.frequency = NRF_TIMER_FREQ_16MHz,
.mode = NRF_TIMER_MODE_TIMER,
.bit_width = NRF_TIMER_BIT_WIDTH_32,
.interrupt_priority = TIMER_DEFAULT_CONFIG_IRQ_PRIORITY,
.p_context = NULL
and
nrf_drv_timer_init(&timer2, &timer2_cfg, TimerHandler);
nrf_drv_timer_extended_compare(&timer2,
NRF_TIMER_CC_CHANNEL0,
1,
NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK,
true);
and in interrupt handler
void TimerHandler(nrf_timer_event_t event_type, void * p_context)
{
if ((var++ % 1000) == 0)
nrf_gpio_pin_toggle(6);
}
Frequency which i see in oscilloscope is 46.72 Hz. BLE and RTC is turned on.
But frequency should be 8 kHz. My SDK is nRF5 SDK v14.2.0, softdevice s112. TIMER_DEFAULT_CONFIG_IRQ_PRIORITY is 3 for this example.