From ba9d2711a3cd649c676edf0558a2dad7916f0a8d Mon Sep 17 00:00:00 2001 From: Alexandre Bourdiol Date: Thu, 2 Jan 2020 11:53:49 +0100 Subject: [PATCH] HardwareTimer: start timer when only update interrupt needed no more need to use setMode() when only update interrupt required. Simplify timebase interrupt usage: see #841 --- cores/arduino/HardwareTimer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cores/arduino/HardwareTimer.cpp b/cores/arduino/HardwareTimer.cpp index 870c4aa6cd..f21d66d927 100644 --- a/cores/arduino/HardwareTimer.cpp +++ b/cores/arduino/HardwareTimer.cpp @@ -158,7 +158,11 @@ void HardwareTimer::resume(void) if (callbacks[0] != NULL) { __HAL_TIM_CLEAR_FLAG(&(_timerObj.handle), TIM_FLAG_UPDATE); __HAL_TIM_ENABLE_IT(&(_timerObj.handle), TIM_IT_UPDATE); + + // Start timer in Time base mode. Required when there is no channel used but only update interrupt. + HAL_TIM_Base_Start(&(_timerObj.handle)); } + // Resume all channels resumeChannel(1); resumeChannel(2);