Skip to content

Commit 2a1ff77

Browse files
committed
HardwareTimer: pause() need to call HAL API to restore HAL state
Due to HAL Cube update it is now required to stop timer with HAL API otherwise HAL state is not restored to HAL_TIM_STATE_READY. Nevertheless it is not sufficient to guarantee that timer is stopped. specially if some channels are still running. So it is also necessary to call LL_TIM_DisableCounter() Signed-off-by: Alexandre Bourdiol <[email protected]>
1 parent 8c34ed0 commit 2a1ff77

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cores/arduino/HardwareTimer.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,11 @@ void HardwareTimer::pause()
108108
__HAL_TIM_DISABLE_IT(&(_timerObj.handle), TIM_IT_CC3);
109109
__HAL_TIM_DISABLE_IT(&(_timerObj.handle), TIM_IT_CC4);
110110

111-
// Disable timer unconditionally
111+
// Stop timer. Required to restore HAL State: HAL_TIM_STATE_READY
112+
HAL_TIM_Base_Stop(&(_timerObj.handle));
113+
114+
/* Disable timer unconditionally. Required to quarantee timer is stopped,
115+
* even if some channels are still running */
112116
LL_TIM_DisableCounter(_timerObj.handle.Instance);
113117

114118
#if defined(TIM_CHANNEL_STATE_SET_ALL)

0 commit comments

Comments
 (0)