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

TIMER draws high current after devices goes to sleep mode

Hi

I am using TIMER3 and TIMER4 for generating PWM signals using PPI and synchronizing ADC sampling, respectively. I posted the preliminary project in here. After taking the ADC samples the device has to go to sleep mode to save power. I just notice that, after disabling(uninit) the PPI, TIMER and ADC, the device draws 600uA which is a way too much than expected. When I debug, it seems the TIMER is the one that is drawing too much current. The functions I use to uninitialize the TIMERs, PPI and ADC are the following. Did I do something wrong in my code?

// unit PPI
void pwm_ppi_unint(void)
{
			NRF_PPI->CHENCLR               			= (1 << PWM0_PPI_CH_LOW) | (1 << PWM0_PPI_CH_HIGH) | (1 << PWM1_PPI_CH_LOW) | (1 << PWM1_PPI_CH_HIGH)
																						| ( 1 << TIMER4_PPI_CH_A) | ( 1 << TIMER4_PPI_CH_B);
	
			NRF_GPIOTE->CONFIG[PWM0_GPIOTE_CH] 	= NRF_GPIOTE->TASKS_CLR[PWM0_GPIOTE_CH];
			NRF_GPIOTE->CONFIG[PWM1_GPIOTE_CH]	= NRF_GPIOTE->TASKS_CLR[PWM1_GPIOTE_CH];
			
}


// Stop and clear timer
void uninit_timers(void)
{
			NRF_TIMER3->TASKS_STOP;
			NRF_TIMER3->TASKS_CLEAR;
			NRF_TIMER3->TASKS_SHUTDOWN; // This is important!!! 

			NRF_TIMER4->TASKS_STOP;
			NRF_TIMER4->TASKS_CLEAR;	
			NRF_TIMER4->TASKS_SHUTDOWN;
}


//uninit adc
void adc_uninit(void)
{
	 nrf_saadc_int_disable(NRF_SAADC_INT_ALL);
    nrf_drv_common_irq_disable(SAADC_IRQn);
    nrf_saadc_task_trigger(NRF_SAADC_TASK_STOP);
				
    uint32_t timeout = 3;

    while (nrf_saadc_event_check(NRF_SAADC_EVENT_STOPPED) == 0 && timeout > 0)
    {
        --timeout;
    }
				
	nrf_saadc_disable();

}

Related