[References]
In page 234 of nRF52832_PS_v1.4 it says
"In both modes, the TIMER is started by triggering the START task, and stopped by triggering the STOP task."
In this post MartinBL stated:
"You must start the timer with TASKS_START also in counter mode.",
while the statement from @Mik contradicts as:
"the counter even counts the signals when not started. it would save mi 8uA when not using TASK_START with the same effect in getting the counting value."
In this post Susheel Nuguru stated:
"The information given in the document is not adequate, the designer of the TIMER gave me proper information. In COUNTER mode of the TIMER, the HFCLK is not requested unless there is a COUNT task. When COUNT task is triggered, the TIMER peripheral will request the hfclk to get one clock cycle so that it will be able to do the COUNTER increment logic. And after that it stops requesting the HFCLK. This means that if nothing else is using HFCLK, and when COUNT task is triggered then HFCLK is requested and is turned on for 62ns (1 cycle) and then requested to turn off again."
By testing with the following code, I get the same results as @Mik.
4.8 / 8.7 uA saving is measured on PCA10040 / our PCB if TASKS_START is not set.
Both w/ or w/o TASKS_START will give expected results (1,2,3 are printed)
void main(void) { NRF_LOG_INIT(NULL); NRF_LOG_DEFAULT_BACKENDS_INIT(); NRF_TIMER4->TASKS_CLEAR = 1; NRF_TIMER4->SHORTS = 0; NRF_TIMER4->INTENCLR = 0xffffffff; NRF_TIMER4->MODE = TIMER_MODE_MODE_LowPowerCounter << TIMER_MODE_MODE_Pos; NRF_TIMER4->BITMODE = TIMER_BITMODE_BITMODE_32Bit << TIMER_BITMODE_BITMODE_Pos; NRF_TIMER4->PRESCALER = 0; NRF_TIMER4->CC[0] = 0; NRF_TIMER4->CC[1] = 0; NRF_TIMER4->CC[2] = 0; NRF_TIMER4->CC[3] = 0; NRF_TIMER4->CC[4] = 0; NRF_TIMER4->CC[5] = 0; NVIC_DisableIRQ(TIMER4_IRQn); #ifdef DO_TIMER_TASKS_START NRF_TIMER4->TASKS_START = 1; #endif NRF_TIMER4->TASKS_COUNT = 1; NRF_TIMER4->TASKS_CAPTURE[0] = 1; NRF_LOG_DEBUG("Timer4->CC[0] = %d", NRF_TIMER4->CC[0]); NRF_TIMER4->TASKS_COUNT = 1; NRF_TIMER4->TASKS_CAPTURE[0] = 1; NRF_LOG_DEBUG("Timer4->CC[0] = %d", NRF_TIMER4->CC[0]); NRF_TIMER4->TASKS_COUNT = 1; NRF_TIMER4->TASKS_CAPTURE[0] = 1; NRF_LOG_DEBUG("Timer4->CC[0] = %d", NRF_TIMER4->CC[0]); nrf_pwr_mgmt_init(); while (1) { if (NRF_LOG_PROCESS() == false) { nrf_pwr_mgmt_run(); } } }
Is it possible that Nordic confirms again in this post for the usage of counter mode timer?
4.8 / 8.7 uA is quite big compared with <2 uA current in "system on, sleep" state, and is critical for optimizing battery life.
Please help on this topic, thank you.