Hello,
I would like to use app timer based on RTC1 in order to wake up the MCU every X sec. The app timer seems to work correctly when the MCU is working. I use the following code to initialize it :
void init_timer()
{
APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);
//APP_TIMER_TICKS(1, APP_TIMER_PRESCALER);
APP_TIMER_DEF(Avid_timer_id);
uint32_t err_code;
// Create timers
err_code = app_timer_create(&Avid_timer_id,
APP_TIMER_MODE_REPEATED,
Avid_timer_handler);
APP_ERROR_CHECK(err_code);
// Start timers
err_code = app_timer_start(Avid_timer_id, APP_TIMER_TICKS(1, APP_TIMER_PRESCALER), NULL);
APP_ERROR_CHECK(err_code);
Avid_ticks = ctr_tick;
Avidflag_PC.my_flag.app_timer_enable = 1;
}
With this the handler is called every 1 ms.
When I am in power down down mode without app timer (using app_timer_stop_all(); to stop it) the average current consumption is around 30µA.
When I am in power down mode with app timer, the average current consumption is around 110 µA.
Do you know what is wrong in my software and cause this high current consumption?
For information, I use the following code to enter in low power mode
static void power_manage(void)
{
//Used to stop interrupt flag of the floating co processor
__set_FPSCR(__get_FPSCR() & ~(0x0000009F));
(void) __get_FPSCR();
NVIC_ClearPendingIRQ(FPU_IRQn);
//Enter in low power mode
uint32_t err_code = sd_app_evt_wait();
APP_ERROR_CHECK(err_code);
}
By advanced, thank you for your help.
BR.