Skip to content

Commit 34b5268

Browse files
marcowidmerkartben
authored andcommitted
drivers: counter: nrfx_timer: Use shutdown task if available
Add a workaround for NRF52 anomaly 78: "High current consumption when using timer STOP task only". Use the SHUTDOWN task instead. For consistency, CLEAR the timer timer after STOPPING on devices that lack the SHUTDOWN task. This also aligns the behavior with nrfx_timer_disable(). For devices with the SHUTDOWN task, this restores the behavior previous to e92323f. Fixes #87224 Signed-off-by: Marco Widmer <[email protected]> (cherry picked from commit 491e297)
1 parent 53a3b66 commit 34b5268

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/counter/counter_nrfx_timer.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,13 @@ static int stop(const struct device *dev)
109109
{
110110
const struct counter_nrfx_config *config = dev->config;
111111

112+
#if NRF_TIMER_HAS_SHUTDOWN
113+
nrf_timer_task_trigger(config->timer, NRF_TIMER_TASK_SHUTDOWN);
114+
#else
112115
nrf_timer_task_trigger(config->timer, NRF_TIMER_TASK_STOP);
116+
nrf_timer_task_trigger(config->timer, NRF_TIMER_TASK_CLEAR);
117+
#endif
118+
113119
#ifdef COUNTER_ANY_FAST
114120
struct counter_nrfx_data *data = dev->data;
115121

0 commit comments

Comments
 (0)