Timer interrupt priority and BLE connection

Hi all,

My configuration:

  • nrf52832 microcontroller
  • Softdevice S132 V4.0.2
  • Nordic SDK 13.0

I'm using an "app_timer" in repeated mode with 10Hz frequency.

#define M_10HZ_TIMER_VALUE  APP_TIMER_TICKS(100) /* 10Hz  = 100ms */

APP_TIMER_DEF(m_10Hz_timer_id);   

app_timer_create(&m_10Hz_timer_id, APP_TIMER_MODE_REPEATED, m_10Hz_timer_handler);

app_timer_start(m_10Hz_timer_id, M_10HZ_TIMER_VALUE, NULL);	

The timer handler (m_10Hz_timer_handler) is a function that execute a complex mathematical algorithm (no use of peripherals).

This handler function is time critical and it's necessary that its interval execution is precise and guaranteed.

In order to obtain this, I set app_timer priority high as possible:

 // <i> Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice
// <0=> 0 (highest) 
// <1=> 1 
// <2=> 2 
// <3=> 3 
// <4=> 4 
// <5=> 5 
// <6=> 6 
// <7=> 7 

#ifndef APP_TIMER_CONFIG_IRQ_PRIORITY
#define APP_TIMER_CONFIG_IRQ_PRIORITY 2
#endif

I tried with priority 2 and 3.

Problem: BLE connection is not stable, if I set priority 2 or 3.

How can I solve this? Is there any way to set timer with high priority and guaranteed the stability of BLE connection?

Thank