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

timer2 with s110 v1 sdkv6 not working right.

i have ble running perfect in nrf51422 until i turn timer 2 on and this is code for init timer2

void timer2_init(void)
	{
    			NRF_TIMER2->MODE      = TIMER_MODE_MODE_Timer;
    			NRF_TIMER2->BITMODE   = TIMER_BITMODE_BITMODE_16Bit << TIMER_BITMODE_BITMODE_Pos;
    			NRF_TIMER2->PRESCALER = TIMER_PRESCALERS;
    			NRF_TIMER2->TASKS_CLEAR = 1;
                        //for one second interupt
    			NRF_TIMER2->CC[0] = 31250;
    			NRF_TIMER2->INTENSET = (TIMER_INTENSET_COMPARE0_Enabled << TIMER_INTENSET_COMPARE0_Pos);
    			
    			NRF_TIMER2->TASKS_START = 1;
    		
    			NVIC_EnableIRQ(TIMER2_IRQn);
}

    void TIMER2_IRQHandler(void)
    	{
    		
    	
    			if ((NRF_TIMER2->EVENTS_COMPARE[0] != 0) && 
    				((NRF_TIMER2->INTENSET & TIMER_INTENSET_COMPARE0_Msk) != 0))
    			{
    					NRF_TIMER2->EVENTS_COMPARE[0] = 0;
    					// Clears the timer, sets it to 0.
    					NRF_TIMER2->TASKS_CLEAR = 1;
    					
    					Increment_second();
    					
    			}
    	}

when timer is on the ble does not work right sometimes it connected and receiving sometimes connected not receiving anything sometimes its not even show up on phone when i comment the timer2 out it work right

Parents Reply Children
No Data
Related