This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Connection loss immediately if timer 2 capture value is changed

Hello All ,

I am working on nrf51822 with sdk 7.1.0 and softdevice 7.1.0 .Earlier my ble connection was working very good with no disconnection anytime unless i disconnect it.but now connection is getting lost after 2 to 3 minutes since i have changed the value of NRF_TIMER2->CC[0].

Earlier it was NRF_TIMER2->CC[0] = 62500 and now NRF_TIMER2->CC[0]=625

my timer_init function

void Duration_Timer_Init(void)
{
	
    NRF_TIMER2->MODE            = TIMER_MODE_MODE_Timer;         // Set the timer in Timer Mode
    NRF_TIMER2->TASKS_CLEAR     = 1;                   // clear the task first to be usable for later
	NRF_TIMER2->PRESCALER       =  8;              // Set prescaler. Higher number gives slower timer. Prescaler = 0 gives 16MHz timer
	NRF_TIMER2->BITMODE         = TIMER_BITMODE_BITMODE_16Bit;	 // Set counter to 16 bit resolution
	
	// Enable interrupt on Timer 2 for CC[0] compare match events
	NRF_TIMER2->INTENSET = (TIMER_INTENSET_COMPARE0_Enabled << TIMER_INTENSET_COMPARE0_Pos);
    NVIC_EnableIRQ(TIMER2_IRQn);
}

this initialization was done for 1 sec ,now i want it to be change to 10msec . so i change the value of NRF_TIMER2->CC[0] = 625 .

what could be the reason for the disconnection. is there any relation between stack and timer2?

thanks & Regards Asma

Related