Hi,
In my application I need an interrupt every 8us that I use as basetime, so I add a nrf timer to my code in the following way:
in the prj.conf
CONFIG_NRFX_TIMER1=y CONFIG_NRFX_TIMER2=y
In the application:
#include <nrfx_timer.h> #include <irq.h> static const nrfx_timer_t mIrTimer = NRFX_TIMER_INSTANCE(2); static volatile uint64_t mIrTimerCounter = 0; static void irTimerHandler (nrf_timer_event_t event_type, void *p_context) { mIrTimerCounter += 8; } static bool startIrTimer (void) { nrfx_err_t errCode; nrfx_timer_config_t tmrConfig = NRFX_TIMER_DEFAULT_CONFIG; tmrConfig.frequency = NRF_TIMER_FREQ_125kHz; tmrConfig.mode = NRF_TIMER_MODE_TIMER; tmrConfig.bit_width = NRF_TIMER_BIT_WIDTH_32; //tmrConfig.interrupt_priority = NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY; errCode = nrfx_timer_init(&mIrTimer,&tmrConfig,irTimerHandler); if (errCode != NRFX_SUCCESS) { return false; } // Interrupt every 10us //nrfx_timer_extended_compare(&mIrTimer,NRF_TIMER_CC_CHANNEL1,10,NRF_TIMER_SHORT_COMPARE1_CLEAR_MASK, true); IRQ_CONNECT(TIMER2_IRQn,2,nrfx_timer_2_irq_handler, NULL,0); nrfx_timer_clear(&mIrTimer); nrfx_timer_enable(&mIrTimer); return true; }
I call the function startIrTimer() and the function return without any error, but the callback is never called. Where is it the problem?
Best
Marco