Hello everyone, I combined work with a timer and an example from ble_app_aurt pca10040 s132, the problem is that the timer does not work evenly, yes, I know about the low priority of the timer, but this does not explain why delays of 182μs can last for several seconds!

static void timer_init()
{
NVIC_SetPriority(TIMER1_IRQn, 2);
NRF_TIMER2->MODE = TIMER_MODE_MODE_Timer;
NRF_TIMER2->PRESCALER = 1;
NRF_TIMER2->BITMODE = (TIMER_BITMODE_BITMODE_16Bit << TIMER_BITMODE_BITMODE_Pos);
}
/**@snippet [Handling the data received over UART] */
void uart_event_handle(app_uart_evt_t * p_event)
{
for(;;) {
char str[8];
int p=13;
NRF_TIMER2->TASKS_CLEAR = 1;
NRF_TIMER2->TASKS_START = 1;
int abc=5; ///delay check
abc = abc + 1;
NRF_TIMER2->TASKS_CAPTURE[0] = 1;
int k;
k = NRF_TIMER2->CC[0];
int f = k;
sprintf (str, "%d", f);
uint16_t length = (uint16_t)p;
int x = 5;
if(x>0)
{ //Read GPIO
ble_nus_data_send (&m_nus, &str[0], &length, m_conn_handle);
}
else {
NRF_LOG_INFO("Debug logging for UART over RTT started 888.");
}
}
}