Skip to content
This repository was archived by the owner on Feb 21, 2020. It is now read-only.

Commit 8807b99

Browse files
fpistmalfran
authored andcommitted
ARR register have to be set at Period-1.
Signed-off-by: Frederic.Pillon <frederic.pillon@st.com>
1 parent 5e5251b commit 8807b99

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cores/arduino/stm32/analog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ void pwm_start(PinName pin, uint32_t clock_freq,
712712
timHandle.Instance = pinmap_peripheral(pin, PinMap_PWM);
713713
if (timHandle.Instance == NC) return 0;
714714
timHandle.Init.Prescaler = (uint32_t)(getTimerClkFreq(timHandle.Instance) / clock_freq) - 1;
715-
timHandle.Init.Period = period;
715+
timHandle.Init.Period = period -1;
716716
timHandle.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
717717
timHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
718718
#ifndef STM32L0xx

0 commit comments

Comments
 (0)