This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

TIMER1->INTENSET cause a ble connection drop problem.

Hi,

I want to use timer1 or 2 interrupt ISR to generate complicated PWM signal. but the timer->intenset setting cause ble connection drop problem.

Please refer to my code below.

NRF_TIMER2->MODE      = TIMER_MODE_MODE_Timer;
NRF_TIMER2->BITMODE   = TIMER_BITMODE_BITMODE_16Bit << TIMER_BITMODE_BITMODE_Pos;
NRF_TIMER2->PRESCALER = 9;

// Clears the timer, sets it to 0.
NRF_TIMER2->TASKS_CLEAR = 1;

// Load the initial values to TIMER2 CC registers.
NRF_TIMER2->CC[0] = 10000;

// Interrupt setup.
*NRF_TIMER2->INTENSET = (TIMER_INTENSET_COMPARE0_Enabled << TIMER_INTENSET_COMPARE0_Pos);*


// Enable interrupt on Timer 2.
//NVIC_EnableIRQ(NRF_TIMER2);

// Start the timer.
NRF_TIMER2->TASKS_START = 1;	

if I comment out the TIMER2->INTENSET, then no problem.

Please let me know why...

Best regards, Joy Kang.

Parents
  • If you have not set the priority of this IRQ then it is by default running at highest priority which BLE softdevice will not accept. This is because only SD is allowed to used the highest priority interrupts. Set priority of your timer to APP_PRIORITY_LOW or APP_PRIORITY_HIGH. The timing of your PWM signal will be affected with BLE activity as your interrupt execution might be delayed and it depends totally on the BLE activity.

Reply
  • If you have not set the priority of this IRQ then it is by default running at highest priority which BLE softdevice will not accept. This is because only SD is allowed to used the highest priority interrupts. Set priority of your timer to APP_PRIORITY_LOW or APP_PRIORITY_HIGH. The timing of your PWM signal will be affected with BLE activity as your interrupt execution might be delayed and it depends totally on the BLE activity.

Children
Related