I run a basic code on nRF52832 and measure the power consumption of the chip (using DVM). The current consumption is 400 uA which is a lot just for a single timer in my application.
The code initialize only the UART and a single timer, after initializing the system enter idle mode and every second it wakes up and increase a counter.
The card is a basic nRF52832 card and all the external peripherals are disabled.
I'm using nRF5_SDK_14.0.0
the voltage is 3.1V
I've set the timer frequency to 500 kHz and according to the data sheet the power consumption should be less then 9 uA (ITIMER_1M Run current with 1 MHz clock input (PCLK1M) 3 5 8 μA)
All power measurement made without JLink connection
The problem happens when I executing nrf_drv_timer_enable():
When [//1. DEBUG_StopSystem();] is enabled the code freeze and the measured current is 23uA
When [//1. DEBUG_StopSystem();] is disabled and [//2. DEBUG_StopSystem();] is enabled the code freeze and the measured current is 398uA
uint8_t HandleLowPowerTimer(uint8_t Mode)
{
uint32_t time_ms = 1000; //Time(in miliseconds) between consecutive compare events.
uint32_t time_ticks;
uint32_t err_code = NRF_SUCCESS;
if (Mode)
{
//Configure TIMER_LED for generating a tick every second
nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
timer_cfg.frequency = 5; //Set to 500 kHz
err_code = nrf_drv_timer_init(&LOW_POWER_TIMER, &timer_cfg, timer_event_handler);
if (NRF_SUCCESS == err_code)
{
time_ticks = nrf_drv_timer_ms_to_ticks(&LOW_POWER_TIMER, time_ms);
nrf_drv_timer_extended_compare(
&LOW_POWER_TIMER, NRF_TIMER_CC_CHANNEL0, time_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);
//1. DEBUG_StopSystem();
nrf_drv_timer_enable(&LOW_POWER_TIMER);
}
}
// 2. DEBUG_StopSystem();
return(err_code);
}
void DEBUG_StopSystem(void)
{
InitGpio(1); //disable all pins and shut down UART
NRF_UART0->ENABLE = UART_ENABLE_ENABLE_Disabled;
NRF_UART0->TASKS_STOPRX = 1;
NRF_UART0->TASKS_STOPTX = 1;
while (1)
{
__WFI();
}
}
Please advice
Haim