I'm struggling with current consumption. I need my device to completely sleep and leave only the RTC on when the ext power is off (run on battery). After making sure my RTC was actually working, I ran the following code:
void run_ClockMode()
{
uint32_t err_code;
err_code = nrf_drv_clock_init();
nrf_drv_clock_lfclk_request(NULL);
while (!nrf_drv_clock_lfclk_is_running());
static uint32_t APP_TIMER_BUF[CEIL_DIV(APP_TIMER_BUF_SIZE(1), sizeof(uint32_t))];
err_code = app_timer_init((4095), 2, APP_TIMER_BUF, 0);
err_code = app_timer_create(&MainRTC, APP_TIMER_MODE_REPEATED, MainRTC_handler);
app_timer_start(MainRTC, APP_TIMER_TICKS(1000, 4095), NULL);
}
int main(void)
{
run_ClockMode();
__WFE();
__SEV();
__WFE();
for (;;) {};
}
and the RTC handler is empty. However, is consuming up to 5mA when only the battery is connected. If I dont call the run_ClockMode() then it falls down to 1.6uA. I also tried this:
void run_ClockMode()
{
uint32_t err_code;
err_code = nrf_drv_clock_init();
nrf_drv_clock_lfclk_request(NULL);
}
without actually running the RTC but just the LFCLK. But it's still at least 1mA. Am I missing something here?