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

Timer 2 not working with Softdevice

Hello,

I have written a timer driver with timer 0 without SD and used 24 bit mode and it is working.

But when I used the same driver with softdevice and Timer 2 and 16 bit and changed the prescaler for one second interval, it is not working.

Here is the code snippet:

NRF_TIMER2->TASKS_STOP = 1;   // Stop timer
NRF_TIMER2->MODE 			= TIMER_MODE_MODE_Timer;  // Set the timer in Normal Mode
NRF_TIMER2->BITMODE 		= TIMER_BITMODE_BITMODE_16Bit << TIMER_BITMODE_BITMODE_Pos;
NRF_TIMER2->PRESCALER 	= 11;
NRF_TIMER2->TASKS_CLEAR = 1;               // clear the task first to be usable for later
NRF_TIMER2->CC[1] 		= 7813;				// set for 1 sec 
// Enable interrupt on Timer 2
NRF_TIMER2->INTENSET = (TIMER_INTENSET_COMPARE1_Enabled
								<< TIMER_INTENSET_COMPARE1_Pos);
NRF_TIMER2->SHORTS 		= (TIMER_SHORTS_COMPARE1_CLEAR_Enabled
								<< TIMER_SHORTS_COMPARE1_CLEAR_Pos);
NVIC_EnableIRQ(TIMER2_IRQn);
NRF_TIMER2->TASKS_START = 1;

I am getting the interrupts but not for one seconds.

Regards, Sowmya

Related