Hello,
To get the highest precision, I would like to use nRF's hardware timers instead of Zephyr's timers.
To do so, I access nRF's timers configuration as follow:
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
timer_init(void)
{
IRQ_CONNECT(TIMER1_IRQn, 0, hc_meas_timer_handler, NULL, 0);
NRF_TIMER1->BITMODE = 32;
NRF_TIMER1->PRESCALER = 8;
NRF_TIMER1->MODE = TIMER_MODE_MODE_Timer;
NRF_TIMER1->CC[0] = 1250;
NRF_TIMER1->SHORTS = 0;
NRF_TIMER1->SHORTS = TIMER_SHORTS_COMPARE0_CLEAR_Enabled << TIMER_SHORTS_COMPARE0_CLEAR_Pos;
NRF_TIMER1->INTENSET = TIMER_INTENSET_COMPARE0_Enabled << TIMER_INTENSET_COMPARE0_Pos;
NRF_TIMER1->TASKS_START = 1;
}
Even if it seems to work, I'm still wondering if there is a way to ensure that this timer use external HFCLK as clock source at it is the more precise ?
Thank you,
Regards