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

High power consumption when starting external LFCLK

Just starting the external LFCLK needs a considerable amount of energy. With my evaluation board it takes about 340ms for the XTAL to get started, which is well within the specifications. However, during all this time, the system draws about 820µA at least. I guess this current is not needed for the XTAL itself but for the system to permanently check whether the frequency is stable enough already. It would be much more efficient if this check was done just once in a while, but the user does not have enough control over the clock management in order to change the implementation in this direction.
Is there any way to avoid this high power consumption?

Here is a small demo program which allows to switch the external LFCLK on with BUTTON_0 and off with BUTTON_1. When interpreting the current measurements, keep in mind that the buttons draw some current via the pullups while being pressed (~200µA).

#include "nrf_gpio.h"
#include "boards.h"

int main(void)
{
	NRF_POWER->RESET = POWER_RESET_RESET_Msk;	
	nrf_gpio_cfg_sense_input(BUTTON_0, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);			
	nrf_gpio_cfg_sense_input(BUTTON_1, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);			
	SCB->SCR |= SCB_SCR_SEVONPEND_Msk;
	NRF_GPIOTE->INTENSET = GPIOTE_INTENSET_PORT_Msk;
	for (int clkEnab=0;;)
	{
		__wfe();
		NRF_GPIOTE->EVENTS_PORT = 0;
		NVIC_ClearPendingIRQ(GPIOTE_IRQn);
		if (!clkEnab && nrf_gpio_pin_read(BUTTON_0)==0)
		{
			NRF_CLOCK->LFCLKSRC = CLOCK_LFCLKSRC_SRC_Xtal<<CLOCK_LFCLKSRC_SRC_Pos;
			NRF_CLOCK->TASKS_LFCLKSTART  = 1;
			clkEnab = 1;
		}
		else if (clkEnab && nrf_gpio_pin_read(BUTTON_1)==0)
		{
			NRF_CLOCK->TASKS_LFCLKSTOP  = 1;
			clkEnab = 0;
		}
	}
} ////
Parents Reply Children
No Data
Related