Commit 34b52682 authored by Marco Widmer's avatar Marco Widmer Committed by Benjamin Cabé
Browse files

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 e92323f0.

Fixes #87224

Signed-off-by: default avatarMarco Widmer <marco.widmer@bytesatwork.ch>
(cherry picked from commit 491e2974)
parent 53a3b665
Loading
Loading
Loading
Loading
+6 −0
Changes for drivers/counter/counter_nrfx_timer.c: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -109,7 +109,13 @@ static int stop(const struct device *dev)
{
	const struct counter_nrfx_config *config = dev->config;

#if NRF_TIMER_HAS_SHUTDOWN
	nrf_timer_task_trigger(config->timer, NRF_TIMER_TASK_SHUTDOWN);
#else
	nrf_timer_task_trigger(config->timer, NRF_TIMER_TASK_STOP);
	nrf_timer_task_trigger(config->timer, NRF_TIMER_TASK_CLEAR);
#endif

#ifdef COUNTER_ANY_FAST
	struct counter_nrfx_data *data = dev->data;