Skip to content

Commit 2d65501

Browse files
committed
ARR register have to be set at Period-1.
Fix #33 Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 6ab15a8 commit 2d65501

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
@@ -719,7 +719,7 @@ void pwm_start(PinName pin, uint32_t clock_freq,
719719
timHandle.Instance = pinmap_peripheral(pin, PinMap_PWM);
720720
if (timHandle.Instance == NC) return 0;
721721
timHandle.Init.Prescaler = (uint32_t)(getTimerClkFreq(timHandle.Instance) / clock_freq) - 1;
722-
timHandle.Init.Period = period;
722+
timHandle.Init.Period = period -1;
723723
timHandle.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
724724
timHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
725725
#ifndef STM32L0xx

0 commit comments

Comments
 (0)